Quick Start
Prerequisites
Section titled “Prerequisites”- Node.js 20+
- PostgreSQL 14+ running locally
- npm or pnpm
Installation
Section titled “Installation”git clone <repo> saas-corecd saas-corecp .env.example .envnpm installEdit .env to set your database connection string and admin token:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/saas_coreADMIN_TOKEN=your_admin_token_min_16_charsBETTER_AUTH_SECRET=your_secret_at_least_32_charsBETTER_AUTH_BASE_URL=http://localhost:3000AUTH_COOKIE_DOMAIN=.localhostSAAS_TRUSTED_ORIGINS=http://localhost:5173,http://localhost:5175,http://localhost:5176Database Migration
Section titled “Database Migration”npm run db:migrateStart Development
Section titled “Start Development”Start all services:
./scripts/dev.sh startOr start services individually:
npm run dev # Backend on :3000npm run dev:admin # Admin console on :5176npm run dev:client # Auth demo on :5173npm run dev:oauth # OAuth demo on :5175Verify
Section titled “Verify”- Open
http://localhost:3000/api/auth/jwks— you should see JWKS keys - Open
http://localhost:5176and log in with yourADMIN_TOKEN - Register a test application via the admin console
- Open
http://localhost:5173to verify the auth flow end-to-end
Service Ports
Section titled “Service Ports”| Port | Service | Purpose |
|---|---|---|
| 3000 | saas-core backend | All API endpoints |
| 5173 | saas-client-demo | Path A direct auth demo |
| 5175 | saas-oauth-demo | Path B OAuth redirect demo |
| 5176 | saas-admin | Admin console |