Files
backend/README.md
Andriy Oblivantsev f51126419c
CI / test (push) Successful in 7s
Improve developer integration docs and Docker dev workflow.
Add TypeScript frontend integration documentation, repository agent guidance files, Go-served frontend routing, and an advanced Docker Compose setup with watch mode plus BuildKit cache configuration.

Made-with: Cursor
2026-03-01 11:57:22 +00:00

89 lines
1.8 KiB
Markdown

# Momswap Geo Backend
Go backend service for user-owned GeoJSON feature collections with Ed25519 authentication and invitation-based onboarding.
## What is implemented
- Ed25519 challenge-response auth (`/v1/auth/challenge`, `/v1/auth/login`)
- Hybrid invitation onboarding (signed invite payload + inviter lineage)
- User registration with ownership proof (`/v1/auth/register`)
- Per-user collections and Point feature CRUD endpoints
- Static no-build frontend (`web/`) using Vue + Vuetify from CDN
- Reusable TypeScript API client (`libs/geo-api-client`) using `@noble/ed25519`
- Bun tests for the TS client and Go tests for API flows
- Gitea CI workflow running Go and Bun test suites
## Quick start
```bash
go test ./...
go run ./cmd/api
```
Server default: `http://localhost:8080`.
Optional environment variables:
- `ADDR` (default `:8080`)
- `ADMIN_PUBLIC_KEY` (bootstrap initial inviter/admin user)
## Docker Compose
Build and run the backend service:
```bash
COMPOSE_BAKE=true docker compose up --build -d
```
Stop the service:
```bash
docker compose down
```
For local development with auto-rebuild on file changes:
```bash
COMPOSE_BAKE=true docker compose --profile dev up --watch
```
Notes:
- `api` service uses the production `runtime` image target.
- `api-dev` profile uses the `dev` image target and Docker Compose watch.
- Build cache is persisted at `.docker/buildx-cache` via `cache_from`/`cache_to`.
## Frontend
Frontend is served by the Go backend at runtime.
Example:
```bash
go run ./cmd/api
```
Then visit `http://localhost:8080/web/`.
## API client library
Path: `libs/geo-api-client`
```bash
cd libs/geo-api-client
bun install
bun test
bun run build
```
Frontend TypeScript integration guide:
- `docs/typescript-frontend-integration.md`
## CI
Workflow: `.gitea/workflows/ci.yml`
- `go test ./...`
- `bun test` in `libs/geo-api-client`