Backend API
Backend Overview
Express API architecture, structure, and patterns
Overview
The backend is built with Express and TypeScript, providing a REST API for the Hireable platform. It runs on port 3001 and connects to MongoDB.
Technology Stack
| Technology | Version | Purpose |
|---|---|---|
| Express | 4.18.2 | Web framework |
| TypeScript | 5.3.3 | Type safety |
| Mongoose | 9.0.0 | MongoDB ODM |
| CORS | 2.8.5 | Cross-origin requests |
| dotenv | 16.3.1 | Environment variables |
Project Structure
Application Entry Point
Route Pattern
Routes define API endpoints and connect them to controllers:
Controller Pattern
Controllers handle request/response logic:
Shared Packages
The API uses shared packages for consistency:
@hireable/database
@hireable/shared
Available Scripts
Environment Variables
API Base URL
- Development:
http://localhost:3001/api - Production: Configured via
NEXT_PUBLIC_API_URL
Next Steps
- Authentication - Auth endpoints and JWT
- Waitlist - Waitlist API endpoints
- Error Handling - Error response patterns