Skip to content

A basic boilerplate for Node.js/Express with Authentication, Database, Mailing and MVC pattern setup.

License

Notifications You must be signed in to change notification settings

AnsurM/Node.js-Express-Basic-Boilerplate

Repository files navigation

Express / [Nodejs Starter] with JWT authentication, MySQL database, Sequelize ORM, Nodemailer mailing module unit tests and basic tooling (to be implemented).


Open-Source Nodejs Starter - Product cover image.


Requirements


Authentication

Authentication is based on json web tokens. passport-jwt strategy is used to handle the email / password authentication. After a successful login the generated token is sent to the requester.


Setting up for development

  • clone repo: git clone https://github.com/AnsurM/express-jwt-mysql-mvc-boilerplate.git

  • change directory to express-jwt-mysql-mvc-boilerplate:

  • create a file named .env which should contain a default setup as shown in the example environment file .env.example:

      SALT=35kj7waj3k5kja09jeoi21kn0pg13iuhlkn
      JWT_SECRET=myjwtsecret
      SESSION_SECRET=secret
      PORT=3000
      SERVER_ADDRESS=127.0.0.1
    
      DB_USERNAME=root
      DB_PASSWORD=mysql@123
      DB_NAME=test
    
      SALT_ROUNDS = 10
    
      MAILTRAP_HOST=smtp.mailtrap.io
      MAILTRAP_PORT=2525,
      MAILTRAP_USER=c18jrei892sd42
      MAILTRAP_PASS=1a83nfj37jmf6c
    
      Gmail_SMTP_username=johndoe@gmail.com
      Gmail_SMTP_password=jkerjidisajdk
      Gmail_SMTP_server_address=smtp.gmail.com
      Gmail_SMTP_port_TLS=587
      Gmail_SMTP_port_SSL=465
      Gmail_SMTP_TLS_SSL_required=yes
    
      MAIL_SENDER="John Doe johndoe@gmail.com"
    
  • users are saved in file config/users.js


Scripts

Install Modules

$ npm i
$ npm i nodemon -g

Run

$ npm run start # classic start OR
$ npm run dev # with nodemon live update

Runs the application with nodemon. Server is listening on Port 3000 by default. This can be overwritten by PORT constant in .env file.


Support

For issues and features request, use Github or reach out to support at support page provided by Syed Ansur Mehdi


License

License



Express Basic Starter provided by Syed Ansur Mehdi with starter pulled from Nodejs-starter by AppSeed

About

A basic boilerplate for Node.js/Express with Authentication, Database, Mailing and MVC pattern setup.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published