This project is a demo for a simple user registration and authentication flow. It uses Node.js & fastify for the web server, MongoDB for the database, and a lightweight HTML/JS web client for the UI. It has JWTs and server-side sessions, email verification, and password resetting.
You'll need Caddy for running the API and UI servers.
You'll also need to add the following to your /etc/hosts
file:
127.0.0.1 nodeauth.dev
127.0.0.1 api.nodeauth.dev
After you've installed Caddy and set up your hosts file, clone down the project:
git clone git@github.com:opes/node-auth-fastify.git
Then, install the API dependencies and start the server:
cd node-auth-fastify/api
npm i
cp .env-example .env
Then, install the web UI dependencies and start the server:
cd node-auth-fastify/web
npm i
cp .env-example .env
Finally, from the root of the project, run Caddy:
cd node-auth-fastify
caddy run