46 lines
2.3 KiB
Markdown
46 lines
2.3 KiB
Markdown
# SXCHNGE product BFF
|
|
|
|
This Go module is the customer-facing executable. `main.go` composes the copied
|
|
runtime and local customer service. Customers, auth, sessions and verification
|
|
own their models and supporting code; generic infrastructure comes from the
|
|
sibling `shared` library module.
|
|
|
|
## Run
|
|
|
|
Requires Go 1.27 and an SXCHNGE-owned MongoDB replica set for transactions.
|
|
Copy `config.example.yml` to an untracked `config.yml` in this directory. Set:
|
|
|
|
- `SXCHNGE_MONGO_URI`: URI for SXCHNGE's database.
|
|
- `SXCHNGE_JWT_SECRET`: random signing key, at least 32 bytes for HS256.
|
|
- `SXCHNGE_DOMAIN`: local hostname, such as `localhost:8082`.
|
|
- `SXCHNGE_API_PROTOCOL`: `http` locally, `https` in deployment.
|
|
- `SXCHNGE_API_ENDPOINT`: `/api/v1`.
|
|
|
|
From the repository root, run `make run-backend`, or run `go run .` here.
|
|
Flags: `-config.file`, `-version`, `-debug`. Configure exact browser origins in
|
|
YAML; browser refresh cookies require HTTPS. An empty local database needs no
|
|
organization, role, policy or seed; the runtime creates its indexes.
|
|
|
|
The runtime mounts health, login, API login, refresh, rotation and logout routes.
|
|
Customer/application-client records must exist for login. The customer service
|
|
supports atomic account/activation creation and deletion with session revocation.
|
|
Signup and email verification delivery/completion are available when
|
|
`api.notifications` is configured. Flutter selects the backend using
|
|
`SXCHNGE_API_URL` and `SXCHNGE_CLIENT_ID`. See
|
|
[auth notification setup and contracts](../../docs/auth-notifications.md).
|
|
API versions are installed explicitly by the product composition. See
|
|
[version installation and compatibility](../../docs/api-versions.md) for selection,
|
|
mounts, shared lifecycle and adding a future version. Customer profile endpoint
|
|
wiring remains follow-up work.
|
|
|
|
Optional `api.sendico` connects sign-up to the public individual registry and
|
|
immutable Facts intake. The adapter owns organization context and consumed wire
|
|
contracts; local customers retain no platform tenancy. See
|
|
[configuration, recovery and measurement](../../docs/signup-facts.md).
|
|
|
|
## Validate
|
|
|
|
`go test -race ./...` and `go vet ./...` validate this module. Tests require Docker
|
|
for disposable Mongo replica sets. Root `make test` and `make lint-backend` also
|
|
validate `shared`. See [source provenance](../PROVENANCE.md).
|