Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlyRank Auth API

A RESTful Authentication API built with Node.js, Express.js, and Supabase Authentication as part of the FlyRank Backend AI Engineering assignment.

Features

  • User Signup
  • User Login
  • User Logout
  • JWT Authentication
  • Protected Routes
  • Public Routes
  • Swagger API Documentation
  • Environment Variable Configuration
  • Error Handling

Tech Stack

  • Node.js
  • Express.js
  • Supabase
  • JWT Authentication
  • Swagger UI
  • dotenv

Project Structure

flyrank-auth-api/
│
├── middleware/
│   └── auth.js
│
├── .env
├── .env.example
├── server.js
├── supabase.js
├── package.json
└── README.md

Installation

Clone the repository:

git clone https://github.com/SHREYA-G-AMIN/flyrank-auth-api.git

Go into the project:

cd flyrank-auth-api

Install dependencies:

npm install

Environment Variables

Create a .env file in the project root.

SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_anon_key
PORT=3000

Run the Project

node server.js

Server runs at:

http://localhost:3000

API Documentation

Swagger UI is available at:

http://localhost:3000/api-docs

API Endpoints

Authentication

Method Endpoint Description
POST /auth/signup Register a new user
POST /auth/login Login and receive JWT
POST /auth/logout Logout user

Public

Method Endpoint Description
GET /public/info Public endpoint

Protected

Method Endpoint Description
GET /protected/profile Requires JWT authentication

Authentication

Protected endpoints require a Bearer Token.

Example:

Authorization: Bearer <your_access_token>

HTTP Status Codes

Code Meaning
200 Success
201 Resource Created
204 No Content
400 Bad Request
401 Unauthorized

About

A secure REST API built with Express.js and Supabase Auth featuring user signup, login, JWT authentication, protected routes, logout, and Swagger documentation. [ WEEK - 04 ]

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages