Event management system with authentication and real-time tracking.
Backend:
- NestJS
- TypeScript
- PostgreSQL
- TypeORM
- Passport.js (JWT)
- Nodemailer
Frontend:
- React 19
- TypeScript
- React Router v7
- Axios
npm install
cd client ; npm installCreate a .env file in the root directory:
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=your_password
DB_DATABASE=aha
JWT_SECRET=your-secret-key-change-this-in-production
JWT_EXPIRES_IN=1d
# Required to access admin/debug endpoints
ADMIN_API_KEY=your-strong-admin-key
NODE_ENV=development
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
SMTP_FROM=AHA <your-email@gmail.com>
APP_URL=http://localhost:3001
# Optional explicit backend URL used for OAuth callback construction
BACKEND_URL=http://localhost:3000
# Youthacks OAuth/OIDC (confidential client)
YOUTHACKS_BASE_URL=https://auth.youthacks.org
YOUTHACKS_CLIENT_ID=your-client-id
YOUTHACKS_CLIENT_SECRET=your-client-secret
# Recommended to set explicitly in production
YOUTHACKS_CALLBACK_URL=http://localhost:3001/auth/youthacks/callback
# Optional dedicated callback for account linking from Settings
YOUTHACKS_LINK_CALLBACK_URL=http://localhost:3001/auth/youthacks/integration/callback
# Optional manual overrides; if omitted, discovery/fallback is used
# YOUTHACKS_AUTH_URL=https://auth.youthacks.org/oauth/authorize
# YOUTHACKS_TOKEN_URL=https://auth.youthacks.org/oauth/token
# YOUTHACKS_USERINFO_URL=https://auth.youthacks.org/oauth/userinfo
# Frontend URL used for redirect after successful OAuth callback
FRONTEND_URL=http://localhost:3001OAuth callback port notes:
- Default flow uses frontend callback routes on port 3001:
/auth/youthacks/callbackand/auth/youthacks/integration/callback. - Backend still performs token exchange through
/auth/youthacks/exchange. - If you prefer backend callback endpoints, set
YOUTHACKS_CALLBACK_URLandYOUTHACKS_LINK_CALLBACK_URLto port 3000 endpoints instead.
CREATE DATABASE aha;# Backend (runs on port 3000)
npm run start:dev
# Frontend (runs on port 3001)
cd client ; npm startTo reset the database and delete all data:
node wipe-db.jsPOST /auth/register- Register new userPOST /auth/login- Login userGET /auth/youthacks-url- Get Youthacks OAuth login redirect URLGET /auth/youthacks-link-url- Get Youthacks OAuth link redirect URL (protected)GET /auth/youthacks/callback- OAuth/OIDC callback handlerGET /auth/youthacks/integration/callback- OAuth/OIDC callback handler for account linking flowGET /auth/verify-email- Verify emailPOST /auth/resend-verification- Resend verification emailPOST /auth/forgot-password- Request password resetPOST /auth/reset-password- Reset passwordGET /auth/profile- Get user profile (protected)
GET /events- List all eventsPOST /events- Create eventGET /events/:id- Get event detailsPATCH /events/:id- Update eventDELETE /events/:id- Delete eventPOST /events/:id/join- Join eventPOST /events/:id/archive- Archive eventPOST /events/:id/unarchive- Unarchive event
POST /reset-database- Reset entire database (requires X-Admin-Key header)GET /health- Health check
aha/
├── src/ # Backend (NestJS)
│ ├── auth/ # Authentication module
│ ├── users/ # User management
│ ├── events/ # Events & members
│ ├── email/ # Email service
│ └── main.ts # App entry point
├── client/ # Frontend (React)
│ └── src/
│ ├── pages/ # Page components
│ ├── components/ # Reusable components
│ ├── services/ # API services
│ └── context/ # React context
├── migrate-admin-to-owner.js # Database migration script
├── API_DOCUMENTATION.md # Complete mobile API docs
└── README.md # This file