Crown Solar HTTP Server — Management API
The HTTP management/control-plane API for the solar inverter product: users, plants, devices (registration/claiming metadata), memberships, roles, and settings. Consumer is the Flutter mobile app.
This is a REST-style HTTP API (API Gateway HTTP API v2 + Lambda), the opposite shape from the TCP Server's device-facing side. It does not serve telemetry, live readings, or alarm detection — that stays entirely on the TCP Server / WebSocket side. See Architecture → Hard invariant for why that boundary is enforced deliberately, not just by convention.
:::caution dev is deployed; prod is not
A dev stack was deployed to AWS account 574317420690 (us-east-1) on
2026-09-17 — see Infrastructure for the real Cognito
User Pool ID, app client IDs, and API base URL, and
Authentication for how the FE team uses them. No prod
stack exists yet. Every request/response example in the
API reference is still marked as an illustrative
example derived from the Zod schemas and handler code, not yet a captured
execution against dev — per this doc set's own rule against fabricating
execution results; see
Operations → Capturing real execution results
for how those get replaced with genuine traces.
:::
Repository layout
bin/app.ts CDK entry — 4 stacks, explicit env, tags
lib/ CDK stacks (data, auth, api, observability)
lib/constructs/ ApiFunction — the ONLY way to create a Lambda
packages/core/ domain, Zod schemas, repositories, IdentityProvider (+ test/)
packages/api/ thin Lambda handlers, http/ helpers (+ test/)
docs/ data model, cost model, ADRs, getting-started, openapi.yaml
(API contract source of truth, mirrored into this site)
specs/ Spec Kit feature specs (001-onboarding-access)
scripts/git-hooks/ pre-commit hook that warns if these docs look unsynced
This documentation site itself lives in a separate sibling repo,
cse-solar-docs — the same
site the TCP Server docs live in, under a separate http-docs/ content
instance. See that repo's README for the deploy model.
Stack
- TypeScript (strict), Node 24, Lambda arm64, Zod 3 for validation, ULIDs for IDs
- API Gateway HTTP API v2 +
HttpUserPoolAuthorizer - DynamoDB single table
- Cognito User Pools on the LITE feature plan
- AWS CDK v2 for all infrastructure
- Region
us-east-1
Where to go next
- Architecture — request/data flow, AWS services, auth model, DB interactions, error handling, security, and the hard isolation invariant from the TCP Server.
- API reference — every
/v1/endpoint: auth, request/response shapes, validation, status codes, error codes. - Types & schemas — the Zod schemas, DTOs, error envelope, and DynamoDB entity shapes.
- Infrastructure — the four CDK stacks, every deployed resource, and their dependencies.
- Operations — local dev, deployment, commands, logs, debugging, troubleshooting.
- Known issues & gaps — defects and unverified
behavior found in the code, each linked from the page it affects. Read
it before integrating. Notably,
PUT /v1/me/selected-plantcurrently returns500, and the email OTP sign-in flow is unproven (SES sandbox, DKIM and a verified sender are still owner actions). - Roadmap (planned) — the proposed, not yet implemented plan to serve the web admin console and the mobile app from this one API: organisations and access, device registry, commands, the HTTP ↔ TCP integration bus, and what it needs from the TCP Server.