A modern full stack blog platform with authentication, user management, posts, comments, and admin features.
- Frontend: React (Vite) + Tailwind CSS
- Backend: Express.js + MongoDB
You can use this account to log in as an admin and try all features:
- Email: admin@blogs.com
- Password: admin123
- User registration, login, JWT authentication
- Role-based access (admin/user)
- Create, edit, delete posts and comments
- Like/unlike comments
- User profile management
- Admin user management (suspend, delete, reset password, change role)
- Flag/unflag posts and comments, admin moderation
- Audit logging & real-time monitoring
- API documentation (Swagger)
- Dockerized for easy deployment
finalProject/
backend/ # Express.js API, MongoDB models, controllers, routes
fronted/ # React frontend (Vite, Tailwind CSS)
README.md # (this file)
-
Install dependencies
cd backend pnpm install # or npm install
-
Configure environment
- Copy
.env.exampleto.envand fill in your values.
Required environment variables:
MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret NODE_ENV=development PORT=5000 CLIENT_ORIGIN=http://localhost:5173 - Copy
-
Run the server
npm run dev # or pnpm dev -
API Docs
-
Monitoring
- Visit http://localhost:5000/api/monitor (localhost only in production)
-
Install dependencies
cd fronted pnpm install # or npm install
-
Configure environment
- If needed, copy
.env.exampleto.envand set API base URL. - By default, the frontend proxies
/apitohttp://localhost:5000(seevite.config.js).
- If needed, copy
-
Run the frontend
npm run dev # or pnpm dev -
Visit the app
docker build -t finalproject-backend ./backend
# Run with environment file
docker run -d -p 5000:5000 --env-file backend/.env finalproject-backendIf deploying on Linux, add this to /etc/logrotate.d/finalproject-backend:
/path/to/your/project/backend/logs/*.log {
daily
rotate 14
compress
missingok
notifempty
copytruncate
}
- In production, restrict
/api/monitorand/api/docsto admin users or internal IPs. - Set
CLIENT_ORIGINin backend.envto your real frontend domain in production. - Never commit
.envfiles with secrets.
MONGO_URI=mongodb://localhost:27017/finalproject
JWT_SECRET=your_jwt_secret
NODE_ENV=development
PORT=5000
CLIENT_ORIGIN=http://localhost:5173
(Usually not needed unless you want to override Vite defaults, e.g. for API base URL.)
# Example: VITE_API=http://localhost:5000/api
MIT