A RESTful Authentication API built with Node.js, Express.js, and Supabase Authentication as part of the FlyRank Backend AI Engineering assignment.
- User Signup
- User Login
- User Logout
- JWT Authentication
- Protected Routes
- Public Routes
- Swagger API Documentation
- Environment Variable Configuration
- Error Handling
- Node.js
- Express.js
- Supabase
- JWT Authentication
- Swagger UI
- dotenv
flyrank-auth-api/
│
├── middleware/
│ └── auth.js
│
├── .env
├── .env.example
├── server.js
├── supabase.js
├── package.json
└── README.md
Clone the repository:
git clone https://github.com/SHREYA-G-AMIN/flyrank-auth-api.gitGo into the project:
cd flyrank-auth-apiInstall dependencies:
npm installCreate a .env file in the project root.
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_anon_key
PORT=3000
node server.jsServer runs at:
http://localhost:3000
Swagger UI is available at:
http://localhost:3000/api-docs
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/signup |
Register a new user |
| POST | /auth/login |
Login and receive JWT |
| POST | /auth/logout |
Logout user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /public/info |
Public endpoint |
| Method | Endpoint | Description |
|---|---|---|
| GET | /protected/profile |
Requires JWT authentication |
Protected endpoints require a Bearer Token.
Example:
Authorization: Bearer <your_access_token>
| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Resource Created |
| 204 | No Content |
| 400 | Bad Request |
| 401 | Unauthorized |