Initially I was using express-generator (still using), but ended-up doing same thing again and again 'user JWT authentication with refresh token and suscription plan' so i decided to create git repository.
- Stateless authentication with JWT allowing for easy horizontal scaling (expiriIn: 2 Minute)
- ESLint Maintain your code quality with ease (Airbnb JavaScript Style).
- MongoDB database
- RefreshToken It can be used to acquire new access Tokens. (expireIn: 7 days)
- Subscription New user initially as 'Trial' and after 7 days as 'Free'.
- Email sendgrid to send welcome and cancellation email.
- Device Limit Only two device login limit.
- express (server)
- body-parser (reading body data)
- validator (input validation)
- helmet (Helmet helps you secure your Express apps by setting various HTTP headers.)
- cors (enable CORS)
- mongoose (Mongoose is a MongoDB object modeling tool)
- morgan (HTTP request logger middleware for node.js)
- express-rate-limit (ratelimiting endpoints)
- bcryptjs (password Encryption)
- jsonwebtoken (jwt creation & signing)
- compression (compress response bodies)
- dotenv (It loads environment variables from a .env file into process.env)
- multer (handling multipart/form-data)
- sharp (convert large images in common formats to smaller)
- debug (A tiny JavaScript debugging utility)
- sendgrid (just want to send email)
- nodemon (hot-reload)
- eslint (ESLint is a linter for the JavaScript programming language.)
- eslint-config-airbnb-base (Airbnb JavaScript Style)
- jest (Jest is a delightful JavaScript Testing Framework with a focus on simplicity.)
- supertest (HTTP assertions made easy via superagent.)
- Clone the project
git clone https://github.com/vinodnimbalkar/express-api-starter.git
. cd express-api-starter
- Make it your own
rm -rf .git && git init && npm init
- Install dependencies
npm install
- Create a
.env
file in the root like the.env.example
file. - For dev you need to have mongodb db locally.
- For dev -
npm run dev
- For lint -
npm run lint
- For test -
npm run test
βββ app.js
βββ bin
βΒ Β βββ www
βββ .env
βββ .eslintrc.js
βββ .gitignore
βββ jest.config.js
βββ LICENSE
βββ nodemon.json
βββ package.json
βββ package-lock.json
βββ public
βΒ Β βββ images
βΒ Β βββ index.html
βΒ Β βββ javascripts
βΒ Β βββ stylesheets
βΒ Β βββ style.css
βββ README.md
βββ src
βΒ Β βββ controllers
βΒ Β βΒ Β βββ user.js
βΒ Β βββ db
βΒ Β βΒ Β βββ mongoose.js
βΒ Β βββ email
βΒ Β βΒ Β βββ account.js
βΒ Β βββ middleware
βΒ Β βΒ Β βββ auth.js
βΒ Β βββ models
βΒ Β βΒ Β βββ user.js
βΒ Β βββ routes
βΒ Β βββ index.js
βΒ Β βββ users.js
βββ tests
βββ user.test.js
13 directories, 21 files
- signup email verification by sending OTP
- Add docker support
Feel free to open an issue (or even better, send a Pull Request). Contributions are very welcome!! π
MIT Β© Vinod Nimbalkar