This repository holds jwt token based authentication server written in typescript using node, express and containerized with docker.
- NodeJS - JavaScript runtime environment.
- Express - Web framework for NodeJS.
- Typescript - Strongly typed programming language.
- MongoDB - Document-oriented database.
- Docker - Open source containerization platform.
- Yup - Schema validation.
- Request payload validation with yup.
- Use of express middlewares.
- Basic CRUD operations.
- Generate auth token and refresh token.
- Proper error handling with a seperate module.
In order for the server to start there are few environment variables that needs to be given via a dotenv file. Create a .env
file in the root of the cloned repository and add following environment variables.
- PORT - Port to run server.
- DATABASE_URL_DEV - MongoDB Database Connection string.
- DATABASE - Name of the database.
- JWT_SECRET_KEY - Jwt secret key.
Clone repository.
https://github.com/nipunravisara/jwt-auth.git
By default, the Docker will expose port 4000 so change this within the Dockerfile if necessary. When ready, simply use the Dockerfile to build the image. This will create the dillinger image and pull in the necessary dependencies.
docker-compose build
Once done, run the Docker image
docker-compose up
MIT
Free Software, Hell Yeah!