Self-documenting REST API built with FastAPI and PostgreSQL.
Generated autonomously by Jarvis
- JWT Authentication — register, login, refresh tokens
- User Management — CRUD endpoints with role-based access
- Database — SQLAlchemy async + Alembic migrations
- Health Check —
GET /healthendpoint - Tests — pytest suite targeting 80%+ coverage
| Component | Technology |
|---|---|
| Framework | FastAPI |
| Database | PostgreSQL + SQLAlchemy (async) |
| Migrations | Alembic |
| Auth | JWT (python-jose) + bcrypt (passlib) |
| Config | pydantic-settings |
| Tests | pytest + httpx + pytest-asyncio |
# Create virtual environment
python -m venv .venv && source .venv/bin/activate
# Install dependencies
pip install -e ".[dev]"
# Set up environment
cp .env.example .env # Edit with your database URL and secret key
# Run migrations
alembic upgrade head
# Start the server
uvicorn src.app.main:app --reload --host 0.0.0.0 --port 8000| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /api/auth/register |
Register new user | No |
| POST | /api/auth/login |
Login, get token pair | No |
| POST | /api/auth/refresh |
Refresh access token | No |
| GET | /api/users/me |
Get current user | Yes |
| PUT | /api/users/me |
Update current user | Yes |
| DELETE | /api/users/me |
Delete account | Yes |
| GET | /health |
Health check | No |
pytestsrc/app/
├── config.py # Settings (pydantic-settings)
├── database.py # Async SQLAlchemy engine
├── dependencies/ # FastAPI dependencies (auth, db session)
├── models/
│ ├── user.py # User model
│ └── refresh_token.py
├── routers/ # API route handlers
├── schemas/ # Pydantic request/response models
├── services/ # Business logic (auth, CRUD)
└── utils/
alembic/ # Database migrations
tests/ # Test suite
MIT