eadfbeab35
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
94 lines
2.0 KiB
Markdown
94 lines
2.0 KiB
Markdown
# destroying_sap
|
|
|
|
A fullstack SaaS web application built with FastAPI, React, and PostgreSQL.
|
|
|
|
## Stack
|
|
|
|
| Layer | Tech |
|
|
|---|---|
|
|
| Backend | FastAPI (async), SQLAlchemy 2, Alembic, PostgreSQL 16 |
|
|
| Auth | JWT bearer tokens, bcrypt password hashing |
|
|
| Frontend | React 18, TypeScript, Vite, React Router v6, TanStack Query |
|
|
|
|
## Current State
|
|
|
|
- User registration and login (JWT auth)
|
|
- Protected dashboard route
|
|
- `/api/users/me` — authenticated user info
|
|
- Vite dev server proxies `/api` to FastAPI — no CORS issues in development
|
|
|
|
## Installation
|
|
|
|
### Prerequisites
|
|
|
|
- Python 3.11+
|
|
- Node.js 18+
|
|
- PostgreSQL 16 (or Docker)
|
|
|
|
### Option A — Docker (recommended)
|
|
|
|
```bash
|
|
git clone <repo>
|
|
cd destroying_sap
|
|
cp .env.example backend/.env
|
|
docker compose up --build
|
|
```
|
|
|
|
- Frontend: http://localhost:5173
|
|
- Backend / API docs: http://localhost:8000/docs
|
|
|
|
### Option B — Local
|
|
|
|
**1. Start PostgreSQL**
|
|
|
|
```bash
|
|
docker compose up db -d
|
|
# or use a local PostgreSQL instance and update backend/.env
|
|
```
|
|
|
|
**2. Backend**
|
|
|
|
```bash
|
|
cd backend
|
|
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
pip install -e ".[dev]"
|
|
cp ../.env.example .env # edit DATABASE_URL and SECRET_KEY as needed
|
|
alembic upgrade head
|
|
uvicorn app.main:app --reload
|
|
```
|
|
|
|
**3. Frontend**
|
|
|
|
```bash
|
|
cd frontend
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
Copy `.env.example` to `backend/.env` and adjust:
|
|
|
|
| Variable | Default | Description |
|
|
|---|---|---|
|
|
| `DATABASE_URL` | `postgresql+asyncpg://postgres:password@localhost:5432/destroying_sap` | Async PostgreSQL URL |
|
|
| `SECRET_KEY` | `change-me-in-production` | JWT signing key |
|
|
| `CORS_ORIGINS` | `["http://localhost:5173"]` | Allowed frontend origins |
|
|
|
|
## Development
|
|
|
|
```bash
|
|
# Backend lint + format
|
|
cd backend && ruff check . && ruff format .
|
|
|
|
# Backend tests
|
|
cd backend && pytest
|
|
|
|
# Frontend type check + lint
|
|
cd frontend && npm run typecheck && npm run lint
|
|
|
|
# New DB migration (after changing models)
|
|
cd backend && alembic revision --autogenerate -m "describe change"
|
|
cd backend && alembic upgrade head
|
|
```
|