Back to work

Case study

In development

Node.js Auth API

Backend authentication/security project.

  1. 01

    Overview

    A from-scratch JWT authentication and authorization API — the access/refresh token, password hashing and role-based access control layer that most "add auth" tutorials skip over.

  2. 02

    Architecture

    Express 5 with Mongoose for the data layer, bcrypt for password hashing, jsonwebtoken for access and refresh tokens. Auth is enforced through composable middleware — protect for authentication, allowRoles for role checks — so a route can require login, a specific role, or several roles at once.

  3. 03

    What it does

    Register, login, get-current-user, refresh-token, and both single-device and all-device logout. Role-gated admin routes (list/delete users), plus multi-role and single-role route guards built on the same middleware.