A versatile NodeJS project that can be used as both REST API and MVC application. This project demonstrates best practices for building scalable Node.js applications with a clean architecture.
- Supports both API and MVC architectures
- Built with NodeJS and Express
- Easy to configure and extend
- Node.js & Express.js
- MongoDB for database
- Express-validator for input validation
- JWT for authentication
- Morgan for logging
- Swagger for API documentation
├── config/ # Configuration files
├── controllers/ # Request handlers
├── models/ # Database models
├── routes/ # Application routes
├── middlewares/ # Custom middleware
├── utils/ # Utility functions
├── views/ # MVC view templates
└── tests/ # Test files
- Node.js (v14 or higher)
- npm or yarn
- Clone the repository
- Copy
.env.exampleto.envand update the values - Run
npm install - Set up MongoDB database
- Run
npm startfor production ornpm run devfor development
The project runs on: http://localhost:8000/
Access Swagger documentation at: http://localhost:8000/api-docs
- Authentication
- POST
/api/auth/register- Register new user - POST
/api/auth/login- User login
- POST
- Users
- GET
/api/users- Get all users - GET
/api/users/:id- Get user by ID
- GET
- Other endpoints coming soon...
- GET
/- Home page - GET
/dashboard- User dashboard - GET
/profile- User profile
- Run tests:
npm test - Lint code:
npm run lint - Format code:
npm run format
Feel free to submit issues and pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.