No description
  • Go 94.1%
  • HTML 4.9%
  • Shell 0.5%
  • Makefile 0.4%
Find a file
2026-03-02 22:38:15 +01:00
cmd/server fix 2026-01-16 22:50:25 +01:00
deploy fix(deploy): robust env loading without xargs 2026-02-25 21:18:12 +01:00
html refactor and prepare and App Store Review Guidelines compliance 2026-03-02 22:38:15 +01:00
internal refactor and prepare and App Store Review Guidelines compliance 2026-03-02 22:38:15 +01:00
migration feat(billing): send idempotent STEO PRO welcome email on first subscription activation 2026-03-01 19:51:01 +01:00
spec add xp system 2026-02-28 19:19:00 +01:00
.env.example fix auth apple 2026-02-26 23:47:13 +01:00
.gitignore add GMail API 2026-01-05 22:16:09 +03:00
atlas.hcl init service 2025-11-15 11:59:08 +01:00
docker-compose.yml add guest 2026-01-29 22:02:19 +01:00
Dockerfile delete legacy 2025-12-14 21:57:15 +03:00
go.mod make_gender_nullable_add_avatar_id 2026-02-10 21:57:54 +01:00
go.sum make_gender_nullable_add_avatar_id 2026-02-10 21:57:54 +01:00
Makefile feat(access): migrate to grant-based access, drop users premium legacy columns, and align mobile/backend contracts 2026-02-16 22:28:52 +01:00
oapi-codegen.yaml init service 2025-11-15 11:59:08 +01:00
README.md eat(billing): auto-route Apple subscription verification across production/sandbox 2026-03-01 20:33:10 +01:00

Backend quick start

1. Environment

cp .env.example .env
# edit .env to set DATABASE_URL, JWT_SECRET, AUTH_REFRESH_PEPPER, OPENAI_API_KEY, etc.

The .env file is consumed both by Docker Compose (for variable substitution) and by the containers themselves (env_file). Never commit your personal .env—the file is ignored by git.

Apple subscriptions use:

  • APPLE_MONTHLY_PRODUCT_ID, APPLE_YEARLY_PRODUCT_ID
  • APPLE_ISSUER_ID, APPLE_KEY_ID, APPLE_BUNDLE_ID
  • APPLE_PRIVATE_KEY_PATH
  • APPLE_SERVER_ENVIRONMENT (production, sandbox, or auto)
    • auto tries production first, then sandbox (recommended for one backend that serves both App Store live and TestFlight/review flows)

If Apple Server API credentials are not set, the backend still accepts ASN/confirm and uses local history for sync.

Optional overrides for Compose can be kept in docker-compose.local.yml (ignored). Start the stack with both files:

docker compose -f docker-compose.yml -f docker-compose.local.yml up --build

2. Run with Docker

docker compose up --build

The API becomes available at http://127.0.0.1:8080. Compose boots Postgres, applies migrations via Atlas and starts the server at cmd/server.

For local product testing with seeded content and access backfill:

make dev-up

This target runs compose-up, seed-local, and backfill-local.

3. Run without Docker

Ensure Postgres is running and reachable via DATABASE_URL, then:

go run ./cmd/server

4. Migrations

  • Create a migration: make migrate-new name=add_table
  • Hash migrations (Atlas checkpoint): make migrate-hash
  • Apply migrations outside Compose: atlas migrate apply --dir file://migration --url "$DATABASE_URL"

5. Testing

  • Unit tests: make test
  • Integration tests (requires Docker/Testcontainers): make integration-test

6. Local data helpers

  • Seed local data: make seed-local
  • Apply access backfill on current local DB: make backfill-local
  • Full local startup + seed + backfill: make dev-up

Set OPENAI_API_KEY in your environment when you want to exercise chat-related flows locally.