Automated Setup¶
Complete Apso + BetterAuth project setup in 5 minutes using Claude Code.
Quick Start¶
In Claude Code, simply ask:
What you'll have:
- Apso NestJS backend with REST API
- BetterAuth authentication
- PostgreSQL database configured
- Next.js frontend
- Both servers running
Setup Options¶
Basic Setup¶
Claude Code will prompt you for:
- Project name
- Database name
- Port preferences
Detailed Setup¶
Provide all details upfront:
Set up an Apso backend with BetterAuth.
Project name: my-saas
Database name: my_saas_dev
Backend port: 3001
Frontend port: 3003
Using a Template¶
Or for a full-featured B2B setup:
What Claude Code Does¶
Phase 1: Prerequisites Check¶
Claude Code verifies:
- Node.js version (>= 18)
- npm version (>= 9)
- PostgreSQL is running
- Ports are available
If anything is missing, Claude Code will help you resolve it.
Phase 2: Backend Setup¶
- Creates
backend/directory - Initializes Apso project
- Configures
.apsorcwith entities - Runs
apso server scaffold - Installs dependencies
- Creates
.envwith secure secrets
Phase 3: Database Setup¶
- Creates PostgreSQL database
- Configures connection
- Runs migrations
- Verifies tables created
Phase 4: Authentication Setup¶
- Adds BetterAuth entities to schema
- Configures auth endpoints
- Sets up session handling
- Generates secure secrets
Phase 5: Frontend Setup¶
- Creates Next.js project
- Installs BetterAuth client
- Configures environment
- Sets up auth integration
Phase 6: Verification¶
- Starts development servers
- Tests health endpoints
- Verifies database connection
- Confirms auth is working
Generated Structure¶
my-project/
├── backend/
│ ├── src/
│ │ ├── autogen/ # Generated code (don't edit)
│ │ └── extensions/ # Your custom code
│ ├── .apsorc # Schema definition
│ ├── .env # Configuration
│ └── docker-compose.yml
│
└── frontend/
├── app/ # Next.js pages
├── lib/ # Auth client
└── .env.local # Configuration
Environment Variables¶
Backend (.env)¶
NODE_ENV=development
PORT=3001
# Database
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=your-password
DB_NAME=project_name_dev
# Auth (auto-generated)
JWT_SECRET=<secure-random>
AUTH_SECRET=<secure-random>
# CORS
FRONTEND_URL=http://localhost:3003
Frontend (.env.local)¶
NEXT_PUBLIC_API_URL=http://localhost:3001
BETTER_AUTH_SECRET=<secure-random>
BETTER_AUTH_URL=http://localhost:3003
Custom Configuration¶
Different Ports¶
External Database¶
Set up backend using external PostgreSQL at 192.168.1.100:5433
Database: custom_db
User: myuser
Password: mypassword
Skip Steps¶
Or:
Common Tasks After Setup¶
Check Status¶
Restart Servers¶
View Logs¶
Stop Servers¶
Troubleshooting¶
PostgreSQL Connection Issues¶
Claude Code will:
- Check if PostgreSQL is running
- Verify connection settings
- Test the connection
- Suggest fixes
Port Conflicts¶
Claude Code will:
- Find what's using the port
- Offer to kill the process or use a different port
- Update configuration if needed
Database Already Exists¶
Claude Code will ask for confirmation before dropping/recreating.
Auth Not Working¶
Claude Code will check:
- Auth secret configuration
- Session handling
- Endpoint availability
- Cookie settings
Verify Setup¶
After setup completes:
Claude Code checks:
| Check | What It Verifies |
|---|---|
| Database | Connection successful |
| Backend | Health endpoint responds |
| Auth | Login/register endpoints work |
| Frontend | Dev server running |
Access Your Services¶
| Service | URL |
|---|---|
| Backend API | http://localhost:3001 |
| OpenAPI Docs | http://localhost:3001/api/docs |
| Frontend | http://localhost:3003 |
Next Steps¶
After setup is complete:
- Add features - Build your application
- Run discovery - Gather requirements properly
- Generate tests - Create test scenarios