JSON Web Token server

Code on GitHub: https://github.com/tx2z/jwt-server

A ready-to-use JSON Web Token (https://jwt.io/) based authentication server.

It’s based on https://devdactic.com/jwt-authentication-ionic-node/

Deploy using Docker-compose

For convenience, everything has been dockerised and a docker-compose file has been created to make it easy to deploy the server.

Just change the JWTSECRET in dotenv-sample and rename the file to “.env”

and launch docker-compose.

docker-compose up -d

Optionally, change the ./Caddyfile to add your domain (by default it exposes the port 80):

<yourdomain.com> {
    proxy / app:5000 {
        websocket
    }
}

Using Node locally

Install MongoDB and run it: https://docs.mongodb.com/manual/administration/install-community/

Edit the file dotenv-sample adding the correct configuration for your environment and rename the file to “.env”

Then you can run the server using:

node src/server.js
npm start

Or use https://nodemon.io/

npm install -g nodemon
nodemon src/server.js