Skip to content

kojiadrianojr/auth-systems

Repository files navigation

Auth Systems - Full-Stack Authentication Monorepo

A modern full stack authentication system built with Typescript, featuring a Node.js/Express backend and Next.js frontend managed in a Turborepo monorepo

Tech Stack

Backend

  • Node.js
  • Express.js
  • PostegreSQL
  • JWT
  • bcryptjs
  • Zod
  • node-postgres

Frontend

  • Next.js (App Router)
  • Typescript
  • Ant Design (Design Framework)

Monorepo

  • Turborepo
  • npm package manager

Getting Started

Prerequisites

  • Node.js >= 18
  • npm >= 11
  • Docker and Docker Compose (for PostgreSQL)

Installation

  1. Clone the repository:
cd auth-systems
  1. Install dependencies:
npm install
  1. Start PostgreSQL database:
docker-compos up -d

This will start a PostgreSQL instance on localhost:5432 with:

  • Database: auth_db
  • User: postgres
  • Password: postgres
  1. Setup backend environment:
cd apps/backend
cp .env.dist.local .env

The default .env values should work with the Docker PostgreSQL setup.

  1. Run database migrations:

    npm run migrate
  2. Set up frontend environment:

    cd ../web
    cp .env.dist.local .env.local

Running the Application

You can run both backend and frontend together from the root directory:

npm run dev

Or run them separately:

Backend only:

cd apps/backend
npm run dev

Backend will be available at http://localhost:3001

Frontend only:

cd apps/web
npm run dev

Frontend will be available at http://localhost:3000

API Reference

POST /api/auth/signup

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"
	}
}

POST /api/auth/login

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"
	}
}

POST /api/auth/validate-token

Validate the user token

Request:

Authorization: Bearer <token>

Note: A Postman collection is available at auth-system.postman_collection.json for testing.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors