A modern full stack authentication system built with Typescript, featuring a Node.js/Express backend and Next.js frontend managed in a Turborepo monorepo
- Node.js
- Express.js
- PostegreSQL
- JWT
- bcryptjs
- Zod
- node-postgres
- Next.js (App Router)
- Typescript
- Ant Design (Design Framework)
- Turborepo
- npm package manager
- Node.js >= 18
- npm >= 11
- Docker and Docker Compose (for PostgreSQL)
- Clone the repository:
cd auth-systems- Install dependencies:
npm install- Start PostgreSQL database:
docker-compos up -dThis will start a PostgreSQL instance on localhost:5432 with:
- Database:
auth_db - User:
postgres - Password:
postgres
- Setup backend environment:
cd apps/backend
cp .env.dist.local .envThe default .env values should work with the Docker PostgreSQL setup.
-
Run database migrations:
npm run migrate
-
Set up frontend environment:
cd ../web cp .env.dist.local .env.local
You can run both backend and frontend together from the root directory:
npm run devOr run them separately:
Backend only:
cd apps/backend
npm run devBackend will be available at http://localhost:3001
Frontend only:
cd apps/web
npm run devFrontend will be available at http://localhost:3000
Create a new user account.
Request:
{
"email": "user@example.com",
"password": "yourpassword"
}Response (201):
{
"message": "User created successfully",
"token": "jwt_token_here",
"user": {
"id": 1,
"email": "user@example.com",
"created_at": "2026-02-06T10:30:00.000Z"
}
}Authenticate an existing user.
Request:
{
"email": "user@example.com",
"password": "yourpassword"
}Response (200):
{
"message": "Login successful",
"token": "jwt_token_here",
"user": {
"id": 1,
"email": "user@example.com",
"created_at": "2026-02-06T10:30:00.000Z"
}
}Validate the user token
Request:
Authorization: Bearer <token>
Note: A Postman collection is available at auth-system.postman_collection.json for testing.