Auth is flexible authentication solution.
✨ Features
- Is nodejs based.
- Stores session data in redis store.
- Persistent data stored in MongoDB.
- Has active session management functionality.
- Can display all the logged in/active session.
- Has ability to perform targeted session invalidation.
- Has ability to logout from all the sessions.
- Can store session context data such as : ip, login-time, device.
- IP to location resolver using GeoLite IP.
- Has configurable session TTL. Default is 86400 seconds.
Clone this repo
git clone https://github.com/krjj/auth.gitthen install dependencies
yarn install
or
npm installTo start the server in production mode
yarn run startyarn run devFor demo purpose the instance is running on the DO Droplet. Location of the API Server - API Server.
The above server is configured in following way -
- Nginx as a reverse proxy.
- HTTPS connections handled by Nginx.
- Letsencrypt SSL cert generated.
- Node-based Auth API Server managed by PM2. Running in daemonized form.
- Uses hosted Redis Database. Provided by Redis Labs.
- Uses hosted MongoDB provided by Mongo Atlas.
Access demo front-end here
All the environment variables are store in .env file.
| Variable | Description |
|---|---|
| redis-host | Host name or an IP address |
| redis-port | Redis port |
| redis-password | If your instance is password protected, used for authentication |
| mongo-connect-uri | Url with mongodb+srv:// protocol |
| session-ttl-secs | Defines how long session should be valid after which the session is invalidated automatically. Default is 86400 seconds or 1 Day. |
- NodeJS
- Fastify
- Redis
- MongoDB
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.