Tutorial · Solution Architect – role and craft · Event-Driven Architecture
A complete HLD by example: the VoltGo charging network – document, diagrams, ADRs and tools
A full, realistic High-Level Design document walked through section by section on the VoltGo electric-vehicle charging platform: a driver app, 4,000 chargers over OCPP, reservations, ad hoc payments through a payment service provider and a network operations dashboard. NFRs in numbers, C4 Context and Container, three sequence diagrams, a deployment diagram, a weighted options matrix, ADR excerpts and a risk register – plus a downloadable HLD template and the complete example document, and a tour of the tools: Structurizr, Mermaid, PlantUML, draw.io, Excalidraw, IcePanel, arc42, ADRs, OpenAPI/AsyncAPI, Threat Dragon and cloud cost calculators.
HLDs are easy to talk about in theory: “goal and scope, NFRs, context, options…”. It is much harder to find a whole, real document where you can see how those chapters connect: where a number in the NFRs comes from, which decision follows from which requirement, why exactly this arrow is on the diagram. This article is such a document – the HLD of the VoltGo electric-vehicle charging platform – walked through chapter by chapter, with a template and the full version to download, plus a tour of the tools that help you write it.
- 4,000 → 10,000
- charge points – today and in 2029
- 1,000 msg/s
- charger telemetry – on average, 3,000 at peak
- 99.95%
- charging core availability – ≤ 22 min of downtime a month
- 11
- HLD chapters – from goal to risks
How this HLD came about
A document like this is not written in one evening. At VoltGo it took five weeks of the architect’s work (about 60% of their time), with workshops and one PoC along the way:
- Week 1 Kick-off and context – Goal, scope, stakeholders, constraints. An NFR workshop with operations, finance and the PO – numbers instead of adjectives.
- Week 2 AS-IS and Event Storming – A current-state workshop (the old CSMS, the ERP, RFID cards) and a big-picture Event Storming of the charging process on a Miro board. Three solution options.
- Week 3 Options, decision, PoC – A decision matrix with weights agreed with stakeholders beforehand, ADR-0001 accepted “conditionally”. PoC-01 starts: can our own OCPP gateway handle telemetry from 10,000 chargers?
- Week 4 TO-BE and threat modelling – C4 diagrams, sequences, deployment, data. A STRIDE session with security in OWASP Threat Dragon. Version 0.5 goes to team review.
- Week 5 Review and approval – Comments from the teams, security and the platform team; the PoC-01 result added to the ADR. Version 0.9 goes to the architecture board, 1.0 after fixes.
Versions matter: 0.1 is a draft for the teams, 0.5 the first complete version for technical review, 0.9 the candidate for the board, 1.0 the approved document from which the teams start epics and LLDs. After approval the HLD lives on: every changed decision means a new ADR and a version bump.
The product: VoltGo in one paragraph
VoltGo (a fictional company with very real problems) runs a network of public chargers in Poland: 1,100 sites and 4,000 charge points from three manufacturers, 30% of them fast DC chargers. Today the network is managed by a vendor’s licensed system (CSMS – Charging Station Management System) delivered as SaaS with a generic app: a 2.9 rating in the app stores, no reservations, payment only by topping up a wallet, and 6% of charging starts end with an error. The licence costs EUR 9 per charge point per month and grows with the network, and the contract expires in 13 months. On top of that comes AFIR (EU Regulation 2023/1804): ad hoc charging without a contract, the price per kWh known before the start, and availability data shared publicly.
Chargers talk to the backend using OCPP (Open Charge Point Protocol) – in version 1.6J these are JSON messages over WebSocket: BootNotification, Heartbeat, StatusNotification, Authorize, StartTransaction, MeterValues, StopTransaction, and remote commands from the backend such as RemoteStartTransaction. The protocol sets most of this project’s constraints.
1. Goal and scope
The first page of an HLD must be readable by the CEO. The goal in one sentence, with numbers and a date:
By 1 June 2027, launch VoltGo’s own platform for 4,000 charge points (10,000 in 2029): charging start from the app in < 5 s, AFIR-compliant ad hoc payment, 99.95% availability of the charging core.
The goal translates into business metrics by which, a year from now, we will judge whether the project succeeded:
| Metric | Today | Target after 12 months |
|---|---|---|
| Sessions started from the app or a QR code | 35% | 70% |
| Failed charging starts | 6% | < 2% |
| App store rating | 2.9 | ≥ 4.5 |
| Licence or cloud cost per charge point per month | ~PLN 39 (SaaS licence) | ≤ PLN 7 (cloud at 10,000 points; team cost counted in the TCO) |
We write the scope down explicitly – especially what we are not doing. “Out of scope” items are not a bin for rejected ideas but a deliberate deferral: each has a phase or an owner.
| In MVP scope (1 June 2027) | Out of scope / phase 2 |
|---|---|
| iOS/Android driver app: map with live availability, 15-min reservation, remote start and stop, history, invoices | OCPP 2.0.1 and Plug & Charge (ISO 15118) – phase 2 |
| ad hoc payment: card, Apple Pay, Google Pay through a payment service provider; a payment page opened from a QR code with no app install | roaming with other networks (OCPI) – phase 2 |
| RFID cards and subscriptions of existing customers (account migration) | B2B fleet portal – phase 2 |
| operator dashboard (NOC): live network status, alarms, remote commands, tariffs | payment terminals in DC chargers – supplied by the manufacturer |
| OCPP 1.6J for all 4,000 points, dynamic load management at 120 sites | field service and installations – existing field service system |
| reporting prices and availability to EIPA (the Polish national register of charging points, run by UDT, the Office of Technical Inspection), invoices through the ERP | energy trading, dynamic exchange-based tariffs |
Stakeholders: COO (sponsor), driver app PO, Head of Operations (NOC), finance (settlement, ERP), legal and the DPO, CISO, the cloud platform team, three development teams – Charging (OCPP gateway, sessions), Driver (app, payments), Operations (NOC dashboard, load management) – and the charger manufacturers.
Constraints: a deadline before the summer holiday season; AWS as the company cloud (an EU region, eu-central-1); TypeScript and Node.js as the teams’ skill set, React Native for the app; personal data in the EU; card data never in our systems; the ERP and its integration with KSeF (the Polish national e-invoicing system) stay as they are; the old CSMS runs in parallel until 31 December 2027.
2. Requirements and NFRs
Key use cases – only those that shape the architecture:
- UC-1 Find and reserve – the driver sees connector availability on the map (delay < 5 s) and reserves a connector for 15 minutes.
- UC-2 Start charging – from the app, with a QR code (no account) or an RFID card; ad hoc payment with pre-authorisation.
- UC-3 Stop and settle – stop from the app, from the charger or by unplugging the cable; capture of the actual amount, a receipt or an invoice.
- UC-4 Supervise the network – the dispatcher sees alarms and the live status of 4,000 points and sends commands (reset, unlock connector, set unavailable).
- UC-5 Limit site power – the total power of a site’s chargers never exceeds the grid connection capacity (meter reading every 5 s).
Non-functional requirements are the heart of an HLD. Each has a number, conditions and a way to verify it – without that it is only a wish:
| ID | Area | Requirement | How we will verify it |
|---|---|---|---|
| NFR-01 | Scale | 4,000 points connected today, 10,000 in 2029; designed for 20,000 (2× headroom) | k6 load test (PoC-01) |
| NFR-02 | Throughput | telemetry 1,000 msg/s on average (10,000 × 1 message / 10 s), 3,000 msg/s at peak | PoC-01, then a pre-launch test |
| NFR-03 | Latency | OCPP gateway ingress → live state p95 < 300 ms; in the app < 5 s (the charger’s cellular network is outside the budget) | PoC-01, SLO in production |
| NFR-04 | Charging start | “Start” in the app → accepted by the charger p95 < 5 s; session confirmation p95 < 15 s | E2E test in the lab with 3 models |
| NFR-05 | Availability | charging core (authorisation, start/stop, payment) 99.95% per month | SLO, monthly report |
| NFR-06 | Availability | app (map, history) 99.9%; NOC dashboard 99.9% 24/7 | SLO |
| NFR-07 | Resilience | a backend outage does not interrupt ongoing sessions; RFID cards are authorised from the charger’s local list, transactions are buffered | chaos test: gateway cut off for 15 min |
| NFR-08 | Reconnect storm | 10,000 chargers reconnect within ≤ 5 min after a network outage, with no lost transactions | PoC-01, scenario 2 |
| NFR-09 | RPO/RTO | sessions and payments: RPO ≤ 1 min, RTO 30 min; region failure: RPO 15 min, RTO 4 h | DR drill every six months |
| NFR-10 | Payments | no card data in VoltGo (PCI DSS SAQ A); zero double captures | security review, idempotency test |
| NFR-11 | Data | sessions and invoices 5 years; raw telemetry 90 days readily available, then a 2-year archive; a driver’s charging history anonymised after 24 months | review with the DPO |
| NFR-12 | Security | chargers: OCPP security profile 2 (TLS + a password per charger) at minimum, profile 3 (mTLS) for new ones; operators SSO + MFA; 100% of remote commands audited | pentest, configuration review |
| NFR-13 | Compliance | AFIR, GDPR, NIS2 (early incident warning within 24 h), reporting to EIPA | legal review, incident drill |
| NFR-14 | Cost | cloud ≤ PLN 35,000 per month at 4,000 points; cost per point falls with scale | AWS calculator, then cost reports |
The numbers do not come out of thin air. Below the NFR table it is worth leaving back-of-the-envelope calculations so the reviewer can check them:
Telemetry (worst case: every point is charging):
10,000 points × 1 message / 10 s = 1,000 msg/s
peak (reconnect storm + StatusNotification) ≈ 3,000 msg/s
~600 B of JSON per message → 0.6 MB/s ≈ 52 GB/day raw
Kafka: ~4× compression, 3× replication, 7 days ≈ 270 GB
WebSocket connections:
designed for 20,000 points, limit 5,000 per gateway instance → 4 instances
+ loss of one of 3 availability zones → 6 instances (2 per zone)
Sessions: 2,000 concurrent today, 8,000 in 2029; driver API: 500 req/s at peak3. System context
The context diagram (C4, level 1) shows the platform as a single box and everything it talks to. It is the first diagram every reviewer will see – and the only one the business will understand.
Visualising software architecture with the C4 model - Simon Brown, Agile on the Beach 2019 (youtube) – Simon Brown explains why most architecture diagrams fail and how the four C4 levels (context, containers, components, code) plus a simple notation make them readable for developers and the business.
What goes from the AS-IS workshop into the HLD is constraints, not a story: (1) the backend address in chargers is changed with the manufacturers’ tools, and 8% of models require a service visit; (2) chargers connect over LTE modems – network latency of 50–500 ms is outside our control; (3) the ERP accepts invoice requests only over REST between 6:00 and 23:00, so at night we queue; (4) the old CSMS offers only a CSV export of accounts and RFID cards.
4. Options and decision
We consider three realistic options. Criteria and weights are agreed with the stakeholders before anyone sees the scores – otherwise the matrix becomes a tool for justifying a decision made earlier.
| Option | Description | Strength | Weakness |
|---|---|---|---|
| A. SaaS CSMS | a new white-label vendor + our own app on its API | fastest start, ready support for many charger models | licence grows with the network, limited control over UX and tariffs, data at the vendor |
| B. Own platform | OCPP gateway, domain core, telemetry – on AWS, in TypeScript | full control, cost does not grow linearly with the number of points | the most work, risk of charger compatibility issues and of missing the deadline |
| C. Open source + own domain | an open-source OCPP server with our own services around it | faster start on the protocol part | a fork to maintain, data model imposed by the project |
| Criterion (weight) | A | B | C |
|---|---|---|---|
| Time to MVP (20%) | 5 | 2 | 3 |
| Control over UX, tariffs, reservations (20%) | 2 | 5 | 4 |
| 5-year TCO at 10,000 points (20%) | 2 – ~PLN 25 m | 4 – ~PLN 20 m | 4 – ~PLN 19 m |
| Scalability and reliability: 20,000 points, 99.95% (15%) | 3 | 4 | 3 |
| OCPP 1.6J/2.0.1 support and charger models (10%) | 5 | 3 | 3 |
| Data ownership and compliance: GDPR, NIS2, AFIR (15%) | 2 | 5 | 4 |
| Weighted score | 3.05 | 3.85 | 3.55 |
| Weighted score | |
|---|---|
| A. SaaS CSMS | 3.05 |
| B. Own platform | 3.85 |
| C. Open source + domain | 3.55 |
Sensitivity analysis is one sentence that saves an hour of discussion at the board: we check whether a reasonable change of weights reverses the result. Here it does not, but B’s lead shrinks to 0.05 points when the deadline is what matters most – which is why the decision has a condition and a scope-cutting plan. We record the decision in an ADR (MADR format, shortened):
# ADR-0001: Own CSMS platform instead of a licensed SaaS
- Status: accepted conditionally – condition: the result of PoC-01 (ADR-0003)
- Date: 2026-11-12
- Deciders: solution architect, CTO, Head of Operations, driver app PO
- Consulted: Charging, Driver and Operations teams, security, finance
## Context
The contract for the current charging station management system (CSMS), delivered
as SaaS, ends on 31 Dec 2027. The licence costs EUR 9 per charge point per month and
grows with the network (4,000 points today, 10,000 in 2029). The system has no
reservations and no ad hoc payment as required by AFIR, and the vendor's app is rated
2.9 in the app stores. We need control over the driver experience, tariffs and data.
## Considered options
- A. A new SaaS CSMS (white-label) + our own app on the vendor's API
- B. Our own platform: OCPP gateway, domain core, telemetry processing
- C. An open-source OCPP server + our own domain services around it
## Decision
We choose **B**: 3.85 points versus 3.55 for C and 3.05 for A (criteria and weights:
HLD, chapter 4). The result is robust to weight changes – with a 35% weight on
"time to MVP", B still leads (3.55 versus 3.50 for A). We limit the deadline risk by
cutting the MVP scope: OCPP 1.6J only, no roaming and no fleet portal.
## Consequences
- (+) control over UX, tariffs, reservations and data; cost does not grow linearly with the number of points
- (+) 5-year TCO of ~PLN 20 m versus ~PLN 25 m for A (estimate ±30%)
- (−) the most in-house work: 15 people for 18 months, then 10
- (−) risk of compatibility with manufacturers' OCPP implementations (R1) and of gateway performance (R2)
## Confirmation
- PoC-01: 10,000 simulated chargers, telemetry p95 < 300 ms (ADR-0003)
- a lab with three charger models before the pilot
- decision review after the pilot at 20 sitesLesson 55 - Architecture Decision Records (youtube) – Mark Richards describes Architecture Decision Records – a lightweight, necessary tool for documenting the decisions an architect makes – building on Michael Nygard's original format.
The HLD does not repeat the content of the ADRs – it links them and summarises them in a decision index:
| ADR | Decision | Status |
|---|---|---|
| ADR-0001 | Own CSMS platform (option B) | accepted conditionally → accepted after PoC-01 |
| ADR-0002 | Core as a modular monolith; OCPP gateway and telemetry processor as separate services | accepted |
| ADR-0003 | Kafka (Amazon MSK) as the telemetry bus, partition key = charger identifier | accepted after PoC-01 (with conditions) |
| ADR-0004 | Ad hoc payment: PLN 150 pre-authorisation and capture after the session | accepted |
| ADR-0005 | Raw telemetry in S3 (Parquet), only minute aggregates in the database | accepted |
| ADR-0006 | Commands to chargers through a connection registry in Redis and a call to the right gateway instance | accepted |
5. Target architecture
Level 2 of the C4 model (Container) shows what the platform is made of: applications, services, databases and buses – each with its technology and responsibility.
Every box gets a table row in the HLD. This is where the teams check whether the boundaries make sense and infrastructure checks how it scales:
| Component | Responsibility | Technology | Scaling | Team |
|---|---|---|---|---|
| OCPP gateway | holds WebSocket connections, authenticates chargers, translates OCPP into events and calls | Node.js 24, ws, TypeScript | by number of connections: ≤ 5,000 per instance, min. 2 per zone | Charging |
| VoltGo Core | sessions, reservations, tariffs, payments, accounts, load management, integrations; Driver API and Operator API | NestJS, modular monolith | by CPU and request rate (HPA) | Charging, Driver, Operations (modules) |
| Telemetry processor | live connector state, minute aggregates, anomaly detection | Node.js, KafkaJS | by consumer lag | Operations |
| Kafka | telemetry and domain event bus, buffer during outages | Amazon MSK, 3 brokers | partitions: 24 for telemetry | Platform |
| Aurora PostgreSQL | transactional data, outbox, aggregates (daily partitions) | Aurora PostgreSQL 16 | vertically + read replica | Platform |
| Redis | live state, connection registry, reservation locks | ElastiCache (Redis OSS) | replica in a second zone | Platform |
| Driver app, NOC dashboard | UI | React Native, React | CDN | Driver, Operations |
Three decisions shape this diagram the most:
- Two OCPP paths. Telemetry (
MeterValues,StatusNotification,Heartbeat) goes asynchronously through Kafka – the gateway acknowledges it only after the Kafka write.Authorize,StartTransactionandStopTransactiongo synchronously to the core, because the response must carry a decision (e.g. thetransactionIdand the card status). - A modular monolith in the core (ADR-0002). Three teams, one database, clear modules with their own schemas. We scale separately only what scales differently: the gateway (connections) and the telemetry processor (throughput). More on this approach: Modular monolith.
- Commands through a connection registry (ADR-0006). The connection to a charger lives on one specific gateway instance. The core looks up in Redis which instance that is and calls it over internal HTTP; the gateway waits for the
CALLRESULTand returns it in the response.
6. Key flows
We draw sequence diagrams for the flows that carry the most risk. At VoltGo there are three: charging start (NFR-04, payment), telemetry (NFR-02/03) and stop and settlement (money).
Starting a charge from the app
Telemetry and live state
If the NFR says “300 ms”, every step of the path gets its allocation and the remainder is kept for surprises. Such a budget also gives you ready-made alert thresholds:
| Budget | |
|---|---|
| Parsing and validation | 5 ms |
| Micro-batch (flush every 5 ms) | 5 ms |
| Kafka write (acks=all) | 30 ms |
| Consumer fetch | 50 ms |
| Processing | 10 ms |
| Redis write | 5 ms |
| Push to the dashboard | 20 ms |
| Reserve | 175 ms |
Stop and settlement
Payment is a separate decision with its own trade-offs – recorded in ADR-0004:
# ADR-0004: Ad hoc payment – pre-authorisation and capture after the session
- Status: accepted
- Date: 2026-11-20
- Deciders: solution architect, driver app PO, finance
- Consulted: security, legal, payment service provider (PSP)
## Context
AFIR requires that a car can be charged without a contract or registration, with the
price per kWh known before the start. The final amount is unknown when charging starts –
it depends on the energy delivered and on idle time. Card data must not enter VoltGo's
systems (PCI DSS scope: SAQ A).
## Considered options
1. Prepaid wallet – top up before charging (how it works today)
2. Pre-authorisation of a fixed amount and capture of the actual amount after the session
3. Charge after the session without pre-authorisation
## Decision
Option 2. The app, or a payment page opened from the charger's QR code, tokenises
the card in the payment service provider's SDK – VoltGo receives only a token. Before
the start we hold PLN 150, after `StopTransaction` we capture the actual amount and
release the rest of the hold. The idempotency key of the capture is `sessionId`. When
the session value reaches 95% of the hold, the core stops charging
(`RemoteStopTransaction`).
Rejected: (1) requires registration and a top-up – it does not meet the ad hoc
charging requirement; (3) risk of unpaid sessions and payment disputes.
## Consequences
- (+) AFIR compliance, no card data on our side, no unpaid sessions
- (+) the same flow in the app and on the QR-code payment page
- (−) a PLN 150 hold can feel high – a clear message before the start
- (−) a pre-authorisation expires after a few days (depending on the card scheme) –
the capture must happen immediately; failures go to a retry queue with an alert
- the wallet stays for subscriptions and RFID cards (that is not ad hoc charging)
## Confirmation
- test in the PSP sandbox: partial capture and release of the rest of the hold (A2)
- metric: zero double captures, failed capture rate < 0.5%The rest of this article is for members
Create a free account or sign in to read it all. Still ahead:
- 7. Integrations and contracts
- 8. Data
- 9. Security
- 10. Deployment and operations
- 11. Risks and open issues
- Template and complete document to download
- Tools that help
- Diagrams as code: Structurizr DSL
- What to start with
- The most common HLD gaps that surface in review
- Related
- Check yourself