Start here for the current Jan Server standards. Detailed references live in the other files inside
docs/conventions/.
| File | Purpose |
|---|---|
conventions.md (this file) |
TL;DR and quick links |
architecture-patterns.md |
Repository and service layout patterns |
design-patterns.md |
Code-level guidance (DB, errors, entities) |
workflow.md |
Daily workflow: git, testing, deployments |
- Go version:
1.25.0(matches the rootgo.mod). Rungo fmt ./...andgo test ./...before committing. - Dependency hygiene:
go mod tidyinside the service you changed.
- Each service lives under
services/<name>/and follows the same structure (cmd/,internal/,migrations/, etc.). - Clean architecture still applies: Interfaces (HTTP) ? Domain ? Infrastructure. Domain packages never import database or HTTP packages.
- GORM zero-value issue still exists. Use pointer fields (
*bool,*float64, etc.) in schema structs and convert to plain types in domain models. - When schemas change, run
make gormgenfrom the service directory (e.g.,cd services/llm-api && make gormgen).
- Trigger point (repository) creates errors via
platformerrors.NewError(). - Handlers call
responses.HandleError()so every response includesrequestID. - Never log secrets or the raw error from external providers.
- Exported symbols:
PascalCase. Unexported:camelCase. - Database columns:
snake_case. - Avoid stuttering (
provider.ID, notprovider.ProviderID). - Avoid single word naming, must meaningful, easy to read and understand
- Conventional commits:
feat:,fix:,docs:,test:,chore:, etc. - Branches:
type/short-description(e.g.,feat/dev-full-refresh).
- Secrets only live in
.env/environment variables..envis created from.env.templateviamake setupand never committed. - Kong + Keycloak handle auth; do not bypass JWT/API-key validation in services.
# Setup & environments
make setup # Copy .env.template -> .env and docker/.env
make up-full # Start infra + APIs + MCP in Docker
make dev-full # Start Docker stack with host routing for native services
./jan-cli.sh dev run llm-api # Run a service on host (macOS/Linux)
.\jan-cli.ps1 dev run llm-api # Same on Windows
# Monitoring & tooling
make monitor-up # Prometheus + Grafana + Jaeger
make monitor-clean # Stop monitoring and remove volumes
# Testing
make test-all # Run every jan-cli api-test collection
make test-auth # Focused suite (see Makefile for others)
go test ./services/llm-api/... # Service-level unit tests
# Code generation
(cd services/llm-api && make gormgen) # Regenerate GORM queries after schema changes
make swagger # Rebuild Swagger docs for all services
# Database helpers
make db-console # Open psql shell inside api-db
make db-reset # Drop + recreate llm-api databasego fmt ./...in every service you touched.go test ./...(unit) andmake test-allor the relevant jan-cli api-test suites if you changed APIs.make swaggerif REST contracts changed.(cd services/<name> && make gormgen)if DB schemas changed..env/secrets unchanged and never committed.- Conventional commit message, CI passes locally (
make up-full && make health-check).
- Structure & file placement:
architecture-patterns.md - Code patterns (DB, entities, errors):
design-patterns.md - Daily workflow (git, CI/CD, deployment):
workflow.md
Always keep docs and commands in sync with the Makefile, jan-cli, and the actual service directories. If a command does not exist locally, update the documentation first.