Zero to first API call in 5 minutes. This guide uses Docker Compose and makes every choice for you. For more options, see Getting Started.
services:
snaapi:
image: ghcr.io/snaapi/snaapi:latest
ports:
- "8000:8000"
environment:
DATABASE_URL: "postgres://snaapi:snaapi@db:5432/snaapi"
BETTER_AUTH_SECRET: "change-me-to-something-random"
BETTER_AUTH_URL: "http://localhost:8000"
SNAAPI_SESSION_SECRET: "change-me-to-something-random"
SNAAPI_AUTO_MIGRATE: "true"
SNAAPI_INSTALL_TOKEN: "my-setup-token"
depends_on:
- db
db:
image: postgres:15
environment:
POSTGRES_USER: snaapi
POSTGRES_PASSWORD: snaapi
POSTGRES_DB: snaapi
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:docker compose up -dWait a few seconds for PostgreSQL and Snaapi to start, then open http://localhost:8000 in your browser.
- Enter your install token (
my-setup-tokenfrom the compose file above). - Create an admin account with your name, email, and password.
You are now logged into the Admin Console.
- Click Add Resource.
- Name it
tasks. - Add two fields:
title-- type string, toggle required ondone-- type boolean
- Save the resource.
Snaapi creates the database table and REST endpoints automatically.
curl -X POST http://localhost:8000/token \
-H "Content-Type: application/json" \
-d '{"email":"your@email.com","password":"your-password"}'Copy the token from the response (it starts with sna_).
curl -X POST http://localhost:8000/v1/tasks \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sna_YOUR_TOKEN" \
-d '{"title": "Buy groceries", "done": false}'curl http://localhost:8000/v1/tasks \
-H "Authorization: Bearer sna_YOUR_TOKEN"You should see a JSON array containing the task you just created.
- Getting Started -- binary install, manual PostgreSQL setup, and full configuration
- Resources -- system fields, soft delete, and resource settings
- Fields -- all 10 field types, validation, and generated values
- Tutorials -- build a blog API, multi-tenant SaaS, and more
