Polski

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.

By · · 49 min read

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:

  1. Week 1 Kick-off and context – Goal, scope, stakeholders, constraints. An NFR workshop with operations, finance and the PO – numbers instead of adjectives.
  2. 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.
  3. 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?
  4. 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.
  5. 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.

— Project goal, VoltGo HLD v1.0

The goal translates into business metrics by which, a year from now, we will judge whether the project succeeded:

MetricTodayTarget after 12 months
Sessions started from the app or a QR code35%70%
Failed charging starts6%< 2%
App store rating2.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, invoicesOCPP 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 installroaming 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, tariffspayment terminals in DC chargers – supplied by the manufacturer
OCPP 1.6J for all 4,000 points, dynamic load management at 120 sitesfield 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 ERPenergy 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:

  1. UC-1 Find and reserve – the driver sees connector availability on the map (delay < 5 s) and reserves a connector for 15 minutes.
  2. UC-2 Start charging – from the app, with a QR code (no account) or an RFID card; ad hoc payment with pre-authorisation.
  3. 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.
  4. 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).
  5. 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:

IDAreaRequirementHow we will verify it
NFR-01Scale4,000 points connected today, 10,000 in 2029; designed for 20,000 (2× headroom)k6 load test (PoC-01)
NFR-02Throughputtelemetry 1,000 msg/s on average (10,000 × 1 message / 10 s), 3,000 msg/s at peakPoC-01, then a pre-launch test
NFR-03LatencyOCPP 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-04Charging start“Start” in the app → accepted by the charger p95 < 5 s; session confirmation p95 < 15 sE2E test in the lab with 3 models
NFR-05Availabilitycharging core (authorisation, start/stop, payment) 99.95% per monthSLO, monthly report
NFR-06Availabilityapp (map, history) 99.9%; NOC dashboard 99.9% 24/7SLO
NFR-07Resiliencea backend outage does not interrupt ongoing sessions; RFID cards are authorised from the charger’s local list, transactions are bufferedchaos test: gateway cut off for 15 min
NFR-08Reconnect storm10,000 chargers reconnect within ≤ 5 min after a network outage, with no lost transactionsPoC-01, scenario 2
NFR-09RPO/RTOsessions and payments: RPO ≤ 1 min, RTO 30 min; region failure: RPO 15 min, RTO 4 hDR drill every six months
NFR-10Paymentsno card data in VoltGo (PCI DSS SAQ A); zero double capturessecurity review, idempotency test
NFR-11Datasessions and invoices 5 years; raw telemetry 90 days readily available, then a 2-year archive; a driver’s charging history anonymised after 24 monthsreview with the DPO
NFR-12Securitychargers: OCPP security profile 2 (TLS + a password per charger) at minimum, profile 3 (mTLS) for new ones; operators SSO + MFA; 100% of remote commands auditedpentest, configuration review
NFR-13ComplianceAFIR, GDPR, NIS2 (early incident warning within 24 h), reporting to EIPAlegal review, incident drill
NFR-14Costcloud ≤ PLN 35,000 per month at 4,000 points; cost per point falls with scaleAWS 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:

capacity.txt
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 peak

3. 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.

Diagram: C4 – level 1, Context: the VoltGo platform and its surroundings

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.

OptionDescriptionStrengthWeakness
A. SaaS CSMSa new white-label vendor + our own app on its APIfastest start, ready support for many charger modelslicence grows with the network, limited control over UX and tariffs, data at the vendor
B. Own platformOCPP gateway, domain core, telemetry – on AWS, in TypeScriptfull control, cost does not grow linearly with the number of pointsthe most work, risk of charger compatibility issues and of missing the deadline
C. Open source + own domainan open-source OCPP server with our own services around itfaster start on the protocol parta fork to maintain, data model imposed by the project
Criterion (weight)ABC
Time to MVP (20%)523
Control over UX, tariffs, reservations (20%)254
5-year TCO at 10,000 points (20%)2 – ~PLN 25 m4 – ~PLN 20 m4 – ~PLN 19 m
Scalability and reliability: 20,000 points, 99.95% (15%)343
OCPP 1.6J/2.0.1 support and charger models (10%)533
Data ownership and compliance: GDPR, NIS2, AFIR (15%)254
Weighted score3.053.853.55
Weighted score of the options (scale 1–5) – Weights agreed in a workshop before scoring. Sensitivity analysis: with a 35% weight on “time to MVP” (taken from TCO) the scores are B 3.55, A 3.50, C 3.40 – B still leads, but by a small margin.
Weighted score
A. SaaS CSMS3.05
B. Own platform3.85
C. Open source + domain3.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.md
# 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 sites

Lesson 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:

ADRDecisionStatus
ADR-0001Own CSMS platform (option B)accepted conditionally → accepted after PoC-01
ADR-0002Core as a modular monolith; OCPP gateway and telemetry processor as separate servicesaccepted
ADR-0003Kafka (Amazon MSK) as the telemetry bus, partition key = charger identifieraccepted after PoC-01 (with conditions)
ADR-0004Ad hoc payment: PLN 150 pre-authorisation and capture after the sessionaccepted
ADR-0005Raw telemetry in S3 (Parquet), only minute aggregates in the databaseaccepted
ADR-0006Commands to chargers through a connection registry in Redis and a call to the right gateway instanceaccepted

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.

Diagram: C4 – level 2, Container: what is inside the VoltGo platform

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:

ComponentResponsibilityTechnologyScalingTeam
OCPP gatewayholds WebSocket connections, authenticates chargers, translates OCPP into events and callsNode.js 24, ws, TypeScriptby number of connections: ≤ 5,000 per instance, min. 2 per zoneCharging
VoltGo Coresessions, reservations, tariffs, payments, accounts, load management, integrations; Driver API and Operator APINestJS, modular monolithby CPU and request rate (HPA)Charging, Driver, Operations (modules)
Telemetry processorlive connector state, minute aggregates, anomaly detectionNode.js, KafkaJSby consumer lagOperations
Kafkatelemetry and domain event bus, buffer during outagesAmazon MSK, 3 brokerspartitions: 24 for telemetryPlatform
Aurora PostgreSQLtransactional data, outbox, aggregates (daily partitions)Aurora PostgreSQL 16vertically + read replicaPlatform
Redislive state, connection registry, reservation locksElastiCache (Redis OSS)replica in a second zonePlatform
Driver app, NOC dashboardUIReact Native, ReactCDNDriver, 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, StartTransaction and StopTransaction go synchronously to the core, because the response must carry a decision (e.g. the transactionId and 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 CALLRESULT and 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

Diagram: Charging start: pre-authorisation, remote command and synchronous StartTransaction

Telemetry and live state

Diagram: Telemetry: acknowledged after the Kafka write, live state in Redis at p95 < 300 ms

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:

Telemetry latency budget: gateway → live state, 300 ms (p95) – Design values verified in PoC-01. The cellular network between the charger and the gateway is outside the budget (50–500 ms, outside our control).
Budget
Parsing and validation5 ms
Micro-batch (flush every 5 ms)5 ms
Kafka write (acks=all)30 ms
Consumer fetch50 ms
Processing10 ms
Redis write5 ms
Push to the dashboard20 ms
Reserve175 ms

Stop and settlement

Diagram: Ending a session: StopTransaction, pricing, capture and an invoice via an event

Payment is a separate decision with its own trade-offs – recorded in ADR-0004:

adr/0004-ad-hoc-payment-pre-authorisation.md
# 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

Create a free account · Sign in