A personal portfolio website built with Node.js and Express, featuring projects, videos, and a contact form.
- Runtime: Node.js
- Framework: Express
- View Engine: EJS
- Database: MySQL (via
mysql2) - Email: Nodemailer
- Rate Limiting: express-rate-limit
src/
├── app.js # Express app setup
├── server.js # Entry point
├── config/
│ └── db.js # MySQL connection pool
├── controllers/ # Route handler logic
├── models/ # Database queries
├── routes/ # Route definitions
├── services/ # Business logic
├── middleware/ # Error handling, 404
└── utils/ # Formatters, YouTube helpers
public/
└── js/ # Client-side scripts
tests/ # Unit and route tests
- Node.js
- MySQL database
npm installCreate a .env file in the project root:
PORT=3000
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=yourpassword
DB_NAME=PERSONAL_WEBSITE
ALLOW_DEV_DB=false# Development (database queries blocked by default)
npm run dev
# Development with database access
ALLOW_DEV_DB=true npm run dev
# Production
npm start| Route | Description |
|---|---|
GET / |
Home page |
GET /projects |
Projects list with filters |
GET /videos |
Videos list with filters |
POST /contact |
Contact form submission |
- In
developmentmode, database queries are blocked unlessALLOW_DEV_DB=trueis set. This prevents accidental production DB access during local development. - Rate limiting is applied to protect the contact form endpoint.