Files
Final-Year-Project/Backend/README.md

814 B

backend

Install

bun install

Environment

Create a .env file:

cp .env.example .env

Set:

DATABASE_URL=postgres://username:password@localhost:5432/database_name
JWT_SECRET=replace_with_a_long_random_secret
JWT_EXPIRES_IN=7d
PORT=3000

Run app

bun run dev

Drizzle ORM

Generate migrations:

bun run db:generate

Apply migrations:

bun run db:migrate

Open Drizzle Studio:

bun run db:studio

Auth API

Register:

POST /auth/register
{
  "email": "user@example.com",
  "password": "password123",
  "name": "User Name"
}

Login:

POST /auth/login
{
  "email": "user@example.com",
  "password": "password123"
}

Get current user:

GET /auth/me
Authorization: Bearer <token>