feat: complete remaining Go backend modules

This commit is contained in:
zn-admin committed 2026-08-14 00:02:43 +08:00
1 parent cea2751dc5
commit aef5a97165
145 files changed
+18376 -199

No files matched your search

+30 -17
View File
@@ -1,19 +1,31 @@
# Go backend foundation
# Go modular backend
This directory contains the first implementation slice of ADR-003. It is a
runnable compatibility foundation, but it is **not** the current production API
This directory contains the separately runnable Go implementation of ADR-003.
It now owns the checked-in compatibility implementation for all 66 explicit
HTTP method/path entries, but it is **not** the current production traffic
owner: Next.js, the Node Worker, Docker Compose, and the ACK manifests remain
unchanged until later route-by-route cutover work passes the shared contracts.
unchanged until a later, explicit cutover.
Implemented Modules:
- `identity`: legacy `zhinian_session` HMAC/chunking, database-refreshed
authorization, and the password-login lifecycle.
- `identity` and `administration`: legacy `zhinian_session` HMAC/chunking,
database-refreshed authorization, password lifecycle, accounts, and
organizations.
- `assets`: scoped registration, upload, download, deletion, local filesystem,
bounded remote import, and Alibaba Cloud OSS adapters.
- `jobs`, `providers`, and `orchestration`: provider preparation/protocols,
idempotent creation, embedded WorkerLoop, retries, output assets, usage,
refunds, Seedance settlement, and signed Webhooks.
- `billing` and `usage`: integer-fen quote/wallet/ledger/catalog behavior and
tenant-scoped reports.
- `templates`, `prompt`, `settings`, and `logging`: the remaining compatibility
modules used by the HTTP surface.
- `postgres`: fail-closed configuration, verified-CA TLS, readiness, atomic
password lockout transactions, and calls to the existing claim and wallet
PostgreSQL functions.
- `httpapi`: process health, database readiness, current-session, password
login, and logout handlers.
account mutations, and calls to the existing claim and wallet PostgreSQL
functions. PostgreSQL is the production relational source of truth.
- `localstore`: a mutex-protected, non-durable, single-process development
store covering the same business Module ports.
- `httpapi`: the complete checked-in route compatibility surface.
- `application`: composition and the `cmd/zhinian-api` process entry point.
From the repository root:
@@ -33,11 +45,12 @@ server, use a different port:
ZHINIAN_DATA_BACKEND=local GO_BACKEND_PORT=8080 ./backend/zhinian-api
```
`/api/health`, `/api/ready`, `/api/auth/me`, `/api/auth/password`, and
`/api/auth/logout` are implemented in the separately runnable Go process. No
Ingress, Docker, ACK, Secret, or Worker ownership has moved to Go yet, so
Next.js remains the production owner of every route.
In local mode, persistent business data is process-local and is discarded on
restart; it is intended only for development and contract smoke tests. The
default demo identity is the same optional-auth super administrator used by the
current Next development flow.
The authentication handlers reuse the shared Cookie contracts and PostgreSQL
Adapters. Self-service/admin password mutation and production route ownership
remain with Next.js until later path-level cutover.
No Ingress, Docker, ACK, Secret, or Worker ownership has moved to Go yet, so
Next.js remains the deployed owner of every route. Real RDS/CA, OSS, provider,
Webhook, Worker drain/recovery, and rollback validation are mandatory before
that route ownership changes.