# From repo root
task api:serveThe server will:
- Create the SQLite database if it doesn't exist
- Run all migrations (schema + seed data)
- Start listening on
http://localhost:8080
services/api/
├── cmd/ # CLI commands (serve, users, deals)
├── internal/
│ ├── api/ # HTTP handlers and middleware
│ ├── config/ # Configuration structs
│ ├── db/ # Database (sqlc generated + migrations)
│ ├── notify/ # Push notification service
│ ├── rules/ # Deal trigger evaluation
│ └── sources/ # External data sources (MLB, etc.)
├── db/
│ ├── queries.sql # sqlc query definitions
│ └── sqlc.yaml # sqlc configuration
└── docs/ # Documentation
SQLite database with goose migrations.
Located in internal/db/migrations/. Run automatically on server start.
# Wipe database and start fresh
task api:clean
task api:serve- Create a new file:
internal/db/migrations/NNN_description.sql - Use goose format:
-- +goose Up
CREATE TABLE ...;
-- +goose Down
DROP TABLE ...;- Edit
db/queries.sql - Regenerate:
task api:sqlc
./bin/freebie serve # Start API server
./bin/freebie users list # List all users
./bin/freebie deals list # List active deals
./bin/freebie deals create # Create test deal
./bin/freebie deals trigger ID # Trigger specific event
./bin/freebie notify test # Send test notification to all users
./bin/freebie notify send ID # Send notification to specific userConfiguration via flags, environment variables, or config file.
| Flag | Env Var | Default |
|---|---|---|
--db |
FREEBIE_DATABASE_PATH |
freebie.db |
--host |
FREEBIE_SERVER_HOST |
0.0.0.0 |
--port |
FREEBIE_SERVER_PORT |
8080 |
--debug |
- | false |
task api:testDeployed to DigitalOcean Kubernetes (DOKS). See deployment guide for full instructions.