A simple boilerplate project based on ES6+ for kickstarting your web application development with Express.js, Mongoose, and JWT
-
User Authentication:
- Register and login functionality with bcrypt for password hashing.
- JWT-based authentication for secure user sessions.
- Refresh-Token based authentication for long-lived sessions.
-
Middleware:
- Utilizes Express.js middleware for handling various aspects of request processing.
- CORS middleware for enabling cross-origin resource sharing.
- Helmet middleware for securing your app by setting various HTTP headers.
-
Validation:
- Express-validator for request validation, ensuring data integrity.
-
Logging:
- Pino (pino-http & pino-pretty) for efficient and structured logging.
-
Security:
- Utilizes Helmet middleware for securing the application against common web vulnerabilities.
-
Database Integration:
- MongoDB integration using Mongoose, providing a robust database layer.
-
Clone the repository:
git clone https://github.com/mortezaom/express-mongoose-jwt-boilerplate.git
-
Install the dependencies:
pnpm install
-
Set the environment variables:
cp .env.example .env
-
Start the server:
pnpm run dev
-
Open the browser and navigate to
http://localhost:5000
.
- bcrypt
- cors
- dotenv
- express
- express-validator
- helmet
- jsonwebtoken
- mongoose
- pino
- pino-http
- pino-pretty
Released under the MIT License.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.