A clean, scalable, and production-ready REST API boilerplate built with Express.js and Mongoose.
🔥 Features:
- Full CRUD operations
- MVC architecture
- Environment-based configuration
- Ready for real-world projects
| Tech | Purpose |
|---|---|
| Node.js | Runtime |
| Express.js | Backend framework |
| Mongoose | MongoDB ODM |
| dotenv | Env config |
| Nodemon | Dev auto-restart |
git clone https://github.com/your-username/mongo-api.git
cd mongo-apinpm installPORT=5000
MONGO_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/mydbnpm run dev
npm start
Content-Type: application/json
JSON
"name": "John Doe",
"email": "john@example.com",
"age": 25
}
{
"_id": "665f1b2c3e4a5b6c7d8e9f00",
"name": "John Doe",
"email": "john@example.com",
"age": 25,
"createdAt": "2024-06-04T10:30:00.000Z",
"updatedAt": "2024-06-04T10:30:00.000Z",
"__v": 0
}
{
name: String, // required
email: String, // required, unique
age: Number // optional
}
Timestamps (createdAt, updatedAt) are automatically added.
| Variable | Description |
|---|---|
| PORT | Server port (default: 5000) |
| MONGO_URI | MongoDB connection string |
Pull requests are welcome!
If you’re planning major changes:
Open an issue Discuss first Then submit PR
Built with ❤️ by @ekalavya