MERN Boilerplate is a project made with the follow technologies:
- Express JS
- React JS
- Redux
- MongoDB / Mongoose
- Typescript
- NodeJs
set .env file in root with this template:
CLUSTER=
NODE_ENV=
PORT=
FRONTEND_URL=
ACCESS_TOKEN_SECRET=
REFRESH_TOKEN_SECRET=
ACCESS_TOKEN_LIFE=
ADMIN_PASSWORD=
MAILER_HOST=
MAILER_PORT=
MAILER_USER=
MAILER_PASSWORD=
PUBLIC_URL=
set .env file in /client with this template:
REACT_APP_BASE_URL_SERVER=
run to CLI:
npm install
npm run dev / npm run start
- Authentication with JWT (Web JSON Token)
- API documentation with Swagger model
- Data typing with Typescript
- User registration flow with MVC pattern (Model-View-Controller)
- CORS management (Cross-Origin Resource Sharing)
- Project tree with code subdivision
- Detailed and generic management of HTTP call status codes
- Personal data managed through environment variables
- CRUD pattern on model (Create, Read, Update, Delete)
- Input validated by a generic validator
- Combine Express routes (Backend endpoint) and React routes (Frontend pages)
You can see the first deploy in Heroku here
Month | Description |
---|---|
March 2021 |
|
April 2021 |
|
May 2021 |
|
June 2021 |
|
July 2021 |
|
Key | Example | Description |
---|---|---|
CLUSTER | false | Start backend with or without cluster |
NODE_ENV | development | Run in "development" mode or in "production" mode |
PORT | 8000 | Port used by ExpressJS |
FRONTEND_URL | http://localhost:3000 | Url frontend associated with it |
ACCESS_TOKEN_SECRET | example | just a simple string to generate a token |
REFRESH_TOKEN_SECRET | example2 | just a simple string to generate a token |
ACCESS_TOKEN_LIFE | 86400000 | Duration time of the token expressed in milliseconds |
REFRESH_TOKEN_LIFE | 25920000 | Duration time of the refresh token expressed in milliseconds |
ADMIN_PASSWORD | gino | Password that accesses the services, bypassing the controls |
MAILER_HOST | smtp.ethereal.email | Email host |
MAILER_PORT | 432 | Email port |
MAILER_USER | [email protected] | Email address |
MAILER_PASSWORD | myPassword123 | Email password |
HOST_APPLICATION | localhost | Host backend application |
This project are made in my free time. Currently under construction by myself. If you have any suggestions to improve the project or noticed errors please make a pull-request or send me an email to: [email protected]