Community
Contributing
How to contribute to Auth Service.
Contributing
Contributions are welcome. Please read the CONTRIBUTING.md file in the repository before opening a pull request.
Development setup
Follow the Installation guide to get the project running locally.
Running tests
# Unit tests
pnpm test
# Watch mode
pnpm test:watch
# Integration tests (requires a running database)
pnpm test:integration
Tests use Vitest and Supertest. The test suite currently covers smoke tests for the health endpoint, consumption routes, and admin application routes.
Code style
The project uses TypeScript strict mode (tsconfig.json). There is currently no ESLint or Prettier configuration — follow the conventions of the surrounding code.
Database migrations
When you change src/db/schema.ts, generate a new migration file before committing:
pnpm db:generate
Commit both the schema change and the generated migration file in drizzle/.
Project structure
auth-service/
├── src/
│ ├── index.ts # Fastify server entry point
│ ├── auth.ts # BetterAuth configuration and plugins
│ ├── config.ts # Zod-validated environment config
│ ├── errors.ts # ApiError class and error code registry
│ ├── bootstrap.ts # Superadmin auto-creation at startup
│ ├── migrate.ts # Programmatic Drizzle migrations
│ ├── db/
│ │ ├── index.ts # Drizzle + postgres connection
│ │ └── schema.ts # Custom table definitions
│ ├── services/
│ │ ├── claims.ts # OIDC custom claims builder
│ │ ├── email.ts # Nodemailer email helpers
│ │ ├── stripe.ts # Stripe client factory
│ │ └── templates.ts # Auth page template resolver
│ └── routes/
│ ├── health.ts
│ ├── consumption.ts
│ ├── stripe-webhook.ts
│ ├── user.ts
│ └── admin/
│ ├── applications.ts
│ ├── roles.ts
│ ├── plans.ts
│ ├── users.ts
│ ├── sessions.ts
│ └── services.ts
├── frontend/ # Vue 3 admin SPA
├── drizzle/ # Generated SQL migrations
├── templates/ # Built-in HTML auth page templates
└── tests/ # Vitest test files