api


The NovaTrail platform service, the only service of the first slice. It checks the account owner's sign-in and keeps the learners, their consent and their attempts in its database — among the platform's parts, the one place where learners' data is stored on the server, and the learner model lives there too, as an append-only log of evidence. It runs each check — tutor reads handwritten work and module-kit gives the verdict, while a choice tapped among options is checked without AI — then has learner-model weigh the attempt's evidence and engine pick the next lesson or task with a reason code: all four are libraries in its own process, and it reaches AI providers only through tutor, without the learner's identifiers.
A component of NovaTrail, a universal open platform for adaptive learning, interactive lessons and AI tutoring. It belongs to stage 2, First slice with learners, with tutor, canvas, app, skill-map and infra.
Status
Detailing is done. The first epic of RUN.md decided everything the component's card left open, and docs/architecture.md now describes the service; the code epics it proposes are in RUN.md. The first, E2 — the skeleton, database, sign-in and deletion — has begun: the service's skeleton is here, and serves nothing of the contract yet. Its first build with app, the first app, which the author alone runs locally, waits for this repository's skeleton, app's code and tutor's first code: the module format's code and content, the learner model and engine have released, and spec's contract between app and api is already out. E2 needs none of these, and spec's cross-repository plan lets it run now (RUN.md, table 1). No child learns here before verifiable parental consent and the contracts with AI providers are in place.
Build and run
Inside the devcontainer, which pins Go and just:
just build # a static binary, bin/api
./bin/api version # its version, commit, build date and Go
just run # serve on PORT, 8080 by default
just ci-lint, just ci-test, just ci-vuln and just ci-licenses are the checks CI runs: gofmt and go vet, the tests with the race detector and their coverage in coverage/go.out, govulncheck and go-licenses.
A release comes out by itself once CI passes on main, from just release-files: static binaries for linux/amd64 and linux/arm64, the Dockerfile, the licenses the binaries come with and SHA256SUMS, each file signed. NovaTrail publishes no image. Whoever deploys checks the files with just -f spec/justfile release-verify api <tag> <file> and builds the image around the binary: docker build --target release --build-context binary=<a folder holding the binary as api> ., with the release's Dockerfile.
The binary reads its configuration from the environment, and only these variables:
| Variable |
Default |
Meaning |
PORT |
8080 |
the port to listen on |
API_LOG_LEVEL |
info |
debug, info, warn or error |
API_HTTP_READ_HEADER_TIMEOUT |
5s |
how long a client may take to send its headers |
API_HTTP_READ_TIMEOUT |
30s |
how long a client may take to send its whole request |
API_HTTP_WRITE_TIMEOUT |
60s |
how long the server may take to answer |
API_HTTP_IDLE_TIMEOUT |
120s |
how long an idle connection is kept |
API_SHUTDOWN_TIMEOUT |
9s |
the whole way out after a stop is asked for; under 10s when deployed |
K_SERVICE |
— |
set by Cloud Run; a deployment is known by it |
A secret — a key, a token, a connection string — comes from its variable or from a file outside the repository whose absolute path the variable with the suffix _FILE names; a file inside a git working tree is refused. The log is JSON on stdout, and writes only the events and fields of its table, internal/logging/events.go: no identifier, address or content of a learner's work.
Documents
The documents are in Russian.
- docs/architecture.md — the component: what it does and does not do, its data and links, what was decided and how the service is built.
- docs/decisions.md — the decision log: what was decided, why, and what was rejected.
- RUN.md — the work plan, in epics.
The working rules, for people and coding agents alike, are in CLAUDE.md and AGENTS.md. The platform's shared vocabulary, formats, contracts and decisions are in spec, checked out here as a git submodule at v0.9.11: clone this repository with git clone --recurse-submodules.
License
Apache-2.0.