60 lines
1.1 KiB
Markdown
60 lines
1.1 KiB
Markdown
# NautilusDesk Backend (FastAPI Starter)
|
|
|
|
FastAPI starter with PostgreSQL, JWT auth, and a clean project structure.
|
|
|
|
## Quickstart
|
|
|
|
1. Create a virtualenv and install deps:
|
|
|
|
```bash
|
|
python -m venv .venv
|
|
source .venv/bin/activate
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
2. Create your `.env` file:
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
3. Start Postgres (example docker-compose below), or point to your own DB in `.env`.
|
|
|
|
4. Run the API:
|
|
|
|
```bash
|
|
uvicorn app.main:app --reload
|
|
```
|
|
|
|
## Docker Postgres (optional)
|
|
|
|
```yaml
|
|
version: "3.9"
|
|
services:
|
|
db:
|
|
image: postgres:16
|
|
ports:
|
|
- "5432:5432"
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: nautilusdesk
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
volumes:
|
|
postgres_data:
|
|
```
|
|
|
|
## Auth flow
|
|
|
|
- `POST /api/v1/auth/register` with JSON `{ "email": "user@example.com", "password": "secret" }`
|
|
- `POST /api/v1/auth/login` with form fields `username` (email) + `password`
|
|
- Use `Authorization: Bearer <token>` for protected routes
|
|
|
|
## Endpoints
|
|
|
|
- `GET /api/v1/health`
|
|
- `POST /api/v1/auth/register`
|
|
- `POST /api/v1/auth/login`
|
|
- `GET /api/v1/users/me`
|