A robust and scalable MongoDB template using Express.js and TypeScript, designed for building modern web applications.
- Node.js (v14 or higher)
- MongoDB (v4.4 or higher)
- TypeScript (v4.5 or higher)
- npm or yarn
- Clone the repository:
git clone https://github.com/git-dariel/Mongo.git
cd Mongo
- Install dependencies:
npm install
- Create a
.env
file in the root directory:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/your-database
NODE_ENV=development
- Start the development server:
npm run dev
npm run dev
: Start development server with hot-reloadnpm run build
: Build for productionnpm start
: Start production servernpm run lint
: Run ESLintnpm test
: Run tests
├── config/ # Configuration files
├── helpers/ # Helpers files
├── controllers/ # Route controllers
├── middlewares/ # Custom middlewares
├── models/ # MongoDB models
├── repositories/ # Database operations
├── routes/ # API routes
├── services/ # Business logic
└── index.ts # Express app initialization
Variable | Description | Default |
---|---|---|
PORT | Server port | 5000 |
MONGODB_URI | MongoDB connection URL | - |
NODE_ENV | Environment | development |
Document your API endpoints here. Example:
GET /api/v1/resource
POST /api/v1/resource
PUT /api/v1/resource/:id
DELETE /api/v1/resource/:id
- Express.js
- TypeScript
- MongoDB & Mongoose
- ESLint & Prettier
- Winston (Logging)
- Helmet (Security)
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Dariel Avila
- GitHub: @git-dariel
- Express.js documentation
- MongoDB documentation
- TypeScript documentation