GithubHelp home page GithubHelp logo

tonyguesswho / express-jwt-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 2.0 29 KB

A stateless and scalable express rest api boilerplate integrating jwt, docker, mongodb, rate limiting, and more.

License: MIT License

Dockerfile 1.78% JavaScript 98.22%

express-jwt-boilerplate's Introduction

Express-JWT-Boilerplate

License GitHub last commit

Foreword

I created this initially as a learning platform to pick up JWT and stateless authentication however because of how useful it eventually became i decided to post it on a repo to share as a scalable JWT example in express.

Features

  • Stateless authentication with JWT allowing for easy horizontal scaling
  • Docker containerization for easy deployment of the full system (databases, clusters, and all)
  • HaProxy loadbalancing for a simple load balancer for our api clusters
  • Clean and effective code following StandardJS
  • MongoDB databasing
  • A "Semi-Secure" Express api to handle database transactions & functionality

Dependencies

Infrastructure

  • HAProxy loadbalancing (optional)
  • MongoDB (required)
  • Docker & Docker-Compose (optional)

Libraries

  • body-parser (reading body data)
  • express (server)
  • express-validator (input validation)
  • helmet (header protection)
  • mongodb (databasing)
  • morgan (logging)
  • express-rate-limit (ratelimiting endpoints)
  • rate-limit-mongo (ratelimiting store)
  • bcryptjs (password Encryption)
  • jsonwebtoken (jwt creation & signing)
  • express-jwt (jwt validation)
  • short-uuid (uuid generation for users)

Dev Dependencies

  • standard (programming principles & linter)
  • jest (unit testing)

Usage

I put all the relevant config stuff in ./src/settings/api_settings.json.

Remember to sanitize user inputs / api outputs through some xss filter!

TODO

  • [] Add refresh tokens for expired tokens and change token expiry to like 5 mins
  • [] Move configuration to a .env instead of .json
  • [] Validate env config values on boot

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

All code must follow standardjs principles. Keep documentation thorough as well.

GitHub stars GitHub followers

express-jwt-boilerplate's People

Contributors

gagepielsticker avatar paolotiu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.