After writing the same lines code again and again, I felt fraustrated and decided to make this. This is rather a basic implementation for an Express app. There's no Kubernetes or Docker configs covered yet, but I'll upgrade to these overtime.
- Minimal secure middleware setup.
- JWT authentication.
- Password reset gmail.
- User model and route system.
- Error handling.
- Clone the repository:
git clone http://github.com/JasontheOmnivorous/express-boilerplate.git
- Navigate to your project directory:
cd express-boilerplate
- Install dependencies:
npm i
Development script:
npm run dev
Start script:
npm start
Build script:
npm run build
PORT=8000
DB=<Your-MongoDB-cluster-connection-string>
NODE_ENV=development # switch dev and prod environment
JWT_SECRET=cdjhebwyfgo837guowfaljbksdflieurpf982bkjskcjbuwbkeefib2u3uif # generate random bullshits
JWT_EXPIRES=90d # config to your liking
ADMIN_EMAIL=<Your-admin-email>
EMAIL_USER=<Your-email-account-to-send-password-reset-token>
EMAIL_PASSWORD=<Your-gmail-app-password>
EMAIL_PASSWORD is not your normal gmail account password. It's an app password and you can obtain it by enabling two step verification in your google account.
I don't care bro, do whatever you want.😂