Skip to content

Auth API is a secure and scalable authentication service built with NestJS and Supabase. It provides RESTful endpoints for user registration, login, and profile access using JWT-based authentication.

Notifications You must be signed in to change notification settings

AthulSabu2002/nest-js-supabase-jwt-auth

Repository files navigation

Nest Logo

Auth API

A secure authentication API built with NestJS and Supabase.

Description

Auth API is a RESTful service that provides robust user authentication capabilities. The project uses NestJS as the backend framework and Supabase for authentication services.

Tech Stack

  • NestJS - Backend framework
  • Supabase - Authentication
  • TypeScript - Programming language

Prerequisites

  • Node.js (v14 or later)
  • npm or yarn
  • Supabase account

Environment Variables

Create a .env file in the root directory with the following variables:

PORT=3000
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_anon_key

Project setup

$ npm install

Compile and run the project

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

API Endpoints

Authentication

  • POST /auth/signup - Register a new user

    • Body: { "email": "user@example.com", "password": "password" }
  • POST /auth/signin - Login existing user

    • Body: { "email": "user@example.com", "password": "password" }
  • GET /auth/profile - Get user profile (requires authentication)

    • Header: Authorization: Bearer your_jwt_token

Authentication

The API uses Supabase Authentication with JWT tokens. To access protected endpoints, include the JWT token in the Authorization header:

Authorization: Bearer your_jwt_token

Run tests

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Support

For support, please open an issue in the repository or contact the project maintainers.

License

This project is MIT licensed.

About

Auth API is a secure and scalable authentication service built with NestJS and Supabase. It provides RESTful endpoints for user registration, login, and profile access using JWT-based authentication.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published