- Add Custom Mutation Patterns section to frontend docs - Document useWorkflowAction for fire-and-forget workflow actions - Document safeParse pattern for mutations needing typed response data - Explain why provider-level validation is not used (TypeScript DataProvider limitation) |
||
|---|---|---|
| .agents/skills/playwright | ||
| .github/workflows | ||
| backend | ||
| backlog | ||
| docs | ||
| frontend | ||
| scripts | ||
| .envrc | ||
| .gitignore | ||
| AGENTS.md | ||
| devenv.lock | ||
| devenv.nix | ||
| devenv.yaml | ||
| LICENSE.txt | ||
| opencode.json | ||
| README.md | ||
| recreate_admin_permissions.py | ||
| secretspec.toml | ||
Flux
Flux is a modern full-stack application built with FastAPI and React, utilizing Refine for the frontend and Shadcn UI for components. It leverages devenv for a reproducible development environment.
Tech Stack
Backend
- Framework: FastAPI
- Database ORM: SQLAlchemy
- Migrations: Alembic
- Authentication: OAuth2 with JWT (python-jose, passlib)
- Linting & Formatting: Ruff
- Type Checking: ty
- Testing: Pytest
Frontend
- Framework: React 19
- Build Tool: Vite
- Data Framework: Refine
- UI Components: Shadcn UI, Radix UI
- Styling: Tailwind CSS
- Form Handling: React Hook Form
- Validation: Zod
Prerequisites
Getting Started
This project uses devenv to manage dependencies and services.
-
Clone the repository:
git clone <repository-url> cd fluxapp -
Start the development environment:
devenv upThis command will start all necessary services, including the backend API and frontend development server.
Runtime Configuration
Configuration is loaded from environment variables (backend/.env, frontend/.env) with examples in:
backend/.env.examplefrontend/.env.example
Backend variables
| Variable | Local development | Production | Notes |
|---|---|---|---|
ENVIRONMENT |
Optional (development default) |
Required (production) |
Controls strict config guards |
DATABASE_URL |
Required (can use local DB URL) | Required (must not use local default) | Backend startup fails outside development if left at local default |
SECRET_KEY |
Optional | Required | Backend startup fails outside development if missing or placeholder |
FRONTEND_URL |
Required | Required | Used in auth email links |
SENTRY_DSN |
Optional | Optional | If set, must not be a placeholder |
SMTP_*, EMAILS_*, DB_* |
Optional | Optional/recommended | Email + pool tuning |
Frontend variables
| Variable | Local development | Production | Notes |
|---|---|---|---|
VITE_API_URL |
Required | Required | Frontend boot fails if missing/placeholder/invalid |
VITE_APP_ENVIRONMENT |
Optional (development) |
Required (production) |
Used for strict runtime checks |
VITE_SENTRY_DSN |
Optional | Required | Frontend boot fails outside development if missing/placeholder |
Project Structure
fluxapp/
├── backend/ # FastAPI application
│ ├── app/ # Application source code
│ ├── alembic/ # Database migrations
│ └── tests/ # Backend tests
├── frontend/ # React application
│ ├── src/ # Frontend source code
│ └── public/ # Static assets
├── devenv.yaml # Development environment configuration
└── README.md # Project documentation
Documentation
- Backend Development Guide
- Adding Models
- Creating Endpoints
- Migrations
- Frontend Development Guide
- Generating API Client
- Adding Views & Columns
- Form Validation
Development
Pull Request Quality Gates
Every pull request runs CI quality gates for backend and frontend checks. A PR is merge-ready only when all jobs pass.
Required checks:
generated-client-sync: runs./scripts/generate-client.shand fails ifbackend/openapi.jsonorfrontend/src/lib/api-client/changes.backend-quality: runsuv run ruff check .,uv run ty check ., anduv run pytestinbackend/.frontend-quality: runsbun run lint,bunx tsc --noEmit,bun run test, andbun run buildinfrontend/.
Expected pass criteria before merge:
- Every command exits with status
0. - No generated API/client drift remains after
./scripts/generate-client.sh.
Backend
Navigate to the backend directory:
cd backend
- Run Tests:
pytest - Linting:
ruff check . - Type Checking:
ty check .
Frontend
Navigate to the frontend directory:
cd frontend
- Start Dev Server:
bun run dev # or refine dev - Build for Production:
bun run build - Linting:
bun run lint
Canonical Feature + API Sync Workflow
- Update backend models/schemas/endpoints in
backend/. - Regenerate the frontend API client from the repo root:
(or use the helper command./scripts/generate-client.shapi-generateinsidedevenv) - Wire generated client methods in
frontend/src/providers/generated-provider.tsand register routes/resources infrontend/src/App.tsx. - Use generated validation schemas from
frontend/src/lib/api-client/zod.gen.tsas the form validation source of truth.