An open API service indexing awesome lists of open source software.

https://github.com/athulsabu2002/nest-js-supabase-jwt-auth


https://github.com/athulsabu2002/nest-js-supabase-jwt-auth

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          


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](https://nestjs.com/) - Backend framework
- [Supabase](https://supabase.io/) - 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

```bash
$ npm install
```

## Compile and run the project

```bash
# 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

```bash
# 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](LICENSE).