Database
Use SQL migrations + ATL_DATABASE_URL. Development usually starts with
SQLite; production often uses Postgres.
1. Configure
export ATL_DATABASE_URL="sqlite:./tmp/app.db?mode=rwc"
# production example:
# export ATL_DATABASE_URL="postgres://user:pass@host:5432/dbname"
2. Migrate
atlantus db migrate --path .
Migrations live under db/migrations/ (created by atlantus new or your team’s
templates).
3. From handlers
Use the runtime’s DB built-ins (names validated by atlantus check on your
binary). Pattern:
get "/users/{id}" {
def show(req) {
let id = req.param("id")
let user = /* db_query_one / project helper for users by id */
if user is none {
return json({ "error": "not_found" }, 404)
}
return json(user)
}
}
Prefer putting SQL access in app/repositories/ or app/services/ and keeping
routes thin — that is what atlantus new scaffolds toward.
Checklist
| Step | Command / env |
|---|---|
| URL | ATL_DATABASE_URL |
| Schema | atlantus db migrate --path . |
| Serve | atlantus dev --path . |
Production notes
- Run migrations in deploy before
atlantus start - Do not commit secrets; inject via env
- Prefer Postgres for multi-node