Node.js / Express REST API for an online course marketplace (auth, courses, lessons, purchases, payments).
- Node.js 18+
- PostgreSQL
- Cloudinary account
- Gmail App Password (or SMTP credentials via Nodemailer)
- Copy environment file and fill in secrets:
cp .env.example .env- Install dependencies:
npm install-
Create the PostgreSQL database named in
DB_NAME. -
Start the API:
npm run dev- API:
http://127.0.0.1:3000/api - Health:
http://127.0.0.1:3000/health - Swagger (non-production only):
http://127.0.0.1:3000/api-docs
| Script | Description |
|---|---|
npm run dev |
Start with file watching |
npm start |
Production start |
npm run lint |
Syntax check entrypoint |
- Public registration allows
studentorinstructoronly (admins are created by super-admin). - Email verification is required before login.
- Password reset requires a valid OTP.
- Lesson video URLs require a paid purchase (or instructor/admin ownership).
- Rate limiting and Helmet headers are enabled.
- Set
CORS_ORIGINand strong JWT secrets before deploying.