| ← Back to README | Documentation Index | Backend Setup | API Docs |
Get the authentication system up and running in 5 minutes.
npm install @prisma/client bcryptjs jsonwebtoken
Option A: Docker (Easiest)
docker run --name analytics-db \
-e POSTGRES_USER=admin \
-e POSTGRES_PASSWORD=password123 \
-e POSTGRES_DB=analytics_db \
-p 5432:5432 \
-d postgres:16
Option B: Already have PostgreSQL?
createdb analytics_db
# Copy and edit .env
cp .env.example .env
# Update DATABASE_URL in .env:
# DATABASE_URL="postgresql://admin:password123@localhost:5432/analytics_db"
npx prisma migrate dev --name init
curl -X POST http://localhost:3000/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "SecurePass123",
"name": "John Doe"
}'
# From response, copy the accessToken value
# export TOKEN="your_token_here"
curl -X POST http://localhost:3000/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "SecurePass123"
}'
curl -X GET http://localhost:3000/api/v1/auth/me \
-H "Authorization: Bearer $TOKEN"
For more details, see:
docs/BACKEND_SETUP_GUIDE.md (PostgreSQL, Prisma, troubleshooting)docs/API_DOCUMENTATION.md (all endpoints, examples, error handling).confidential/PHASE1_WEEK1_IMPLEMENTATION.md (what was built)| Method | Endpoint | Purpose |
|---|---|---|
| POST | /api/v1/auth/register |
Create account |
| POST | /api/v1/auth/login |
Login & get tokens |
| GET | /api/v1/auth/me |
Get user profile |
| POST | /api/v1/auth/logout |
Logout |
.env with DATABASE_URLnpx prisma migrate devHaving issues? Check docs/BACKEND_SETUP_GUIDE.md troubleshooting section.