feat: add Go migration compatibility foundation

This commit is contained in:
zn-admin committed 2026-08-13 10:35:52 +08:00
1 parent 7de3300034
commit 716a8031b1
27 files changed
+2582

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
# Go backend foundation
This directory contains the first implementation slice of ADR-003. It is a
runnable compatibility foundation, but it is **not** the current production API
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.
Implemented Modules:
- `identity`: legacy `zhinian_session` HMAC, parsing, and chunking contract.
- `postgres`: fail-closed configuration, verified-CA TLS, readiness, and calls
to the existing atomic claim and wallet PostgreSQL functions.
- `httpapi`: process health and database readiness handlers.
- `application`: composition and the `cmd/zhinian-api` process entry point.
From the repository root:
```bash
npm run go:fmt
npm run go:test
npm run go:vet
npm run go:build
```
The runner defaults to `CGO_ENABLED=0` for reproducible cross-platform builds.
To exercise the local foundation manually without changing the existing Next
server, use a different port:
```bash
ZHINIAN_DATA_BACKEND=local GO_BACKEND_PORT=8080 ./backend/zhinian-api
```
Only `/api/health` and `/api/ready` are implemented in this foundation. No
Ingress, Docker, ACK, Secret, or Worker ownership has moved to Go yet.