Skip to content

Commit 445b5a4

Browse files
committed
back and front docs.
1 parent 9f8d55f commit 445b5a4

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed

.cursor/.DS_Store

6 KB
Binary file not shown.

.cursor/rules/backend-overview.mdc

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
description: General description of the backend used in the repository. Use this to have more context on the /backend structure.
3+
globs: backend, *.py
4+
alwaysApply: false
5+
---
6+
# Cursor Rules for FastAPI Backend Project
7+
8+
## Project Overview
9+
This is a FastAPI backend project structured with SQLModel for database models, JWT authentication, and a modular architecture. The project uses PostgreSQL for data storage, uv for package management, and follows a clear separation of concerns.
10+
11+
## Key Technologies
12+
- **FastAPI**: Web framework for building APIs
13+
- **SQLModel**: ORM for working with SQL databases
14+
- **PostgreSQL**: Database backend
15+
- **JWT**: For authentication
16+
- **uv**: For Python package and environment management
17+
- **Alembic**: For database migrations
18+
- **Docker**: For containerization
19+
20+
## Project Structure Rules
21+
22+
### Core Components
23+
- **/app/core/**: Contains core configuration and utilities
24+
- **config.py**: Centralized configuration using Pydantic settings
25+
- **security.py**: Authentication and security functions
26+
- **db.py**: Database engine and initialization
27+
28+
### Models
29+
- **/app/models.py**: All data models are defined using SQLModel
30+
- Models use UUID fields as primary keys
31+
- Relationships are defined with cascading delete behavior
32+
- Models include clear separation between base, public, and internal models
33+
34+
### API Structure
35+
- **/app/api/**: API route definitions and dependencies
36+
- **/api/routes/**: Organized by resource (users, items, login, etc.)
37+
- **/api/deps.py**: Dependency injection for routes
38+
39+
### Authentication
40+
- JWT-based authentication is implemented
41+
- Access tokens expire after configurable time (8 days default)
42+
- Password recovery flow is supported
43+
44+
### Database
45+
- Models are managed via Alembic migrations
46+
- UUIDs are used for all IDs (migrated from integers)
47+
- String fields have explicit max lengths
48+
49+
### Environment
50+
- Environment variables are loaded from .env file
51+
- Development vs production environment settings
52+
- CORS settings for frontend communication
53+
54+
### Email Templates
55+
- Located in **/app/email-templates/**
56+
- Built from MJML source files to HTML
57+
58+
## Development Rules
59+
60+
### Code Patterns
61+
- Use type annotations throughout
62+
- Follow REST principles for API endpoints
63+
- Use dependency injection via FastAPI
64+
- Use SQLModel for database operations
65+
- Handle errors with proper HTTP status codes
66+
67+
### Testing
68+
- Tests are in **/app/tests/**
69+
- Tests use pytest fixtures for database and client
70+
- Mock external services in tests
71+
72+
### Docker Setup
73+
- Use Docker Compose for local development
74+
- FastAPI run with live reloading during development
75+
- PostgreSQL database runs in a container
76+
77+
## API Response Standards
78+
- Consistent response objects for collections (with count and data fields)
79+
- Use of standard message response objects
80+
- Proper error handling with appropriate status codes
81+
82+
## Security Practices
83+
- Password hashing with bcrypt
84+
- JWT token-based authentication
85+
- Environment-specific secrets management
86+
- CORS configuration for frontend access
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
description: General description of the frontend used in the repository. Use this to have more context on the /frontend structure.
3+
globs: frontend, *.tsx, *.ts
4+
alwaysApply: false
5+
---
6+
# frontend-rule
7+
8+
## Project Overview
9+
This frontend project is built with:
10+
- [Vite](mdc:https:/vitejs.dev) as the build tool and dev server
11+
- [React](mdc:https:/reactjs.org) as the UI library
12+
- [TypeScript](mdc:https:/www.typescriptlang.org) for type safety
13+
- [TanStack Query](mdc:https:/tanstack.com/query) for API data fetching and caching
14+
- [TanStack Router](mdc:https:/tanstack.com/router) for routing
15+
- [Chakra UI](mdc:https:/chakra-ui.com) for component library and styling
16+
17+
## Project Structure
18+
- `/src` - Main frontend code
19+
- `/assets` - Static assets
20+
- `/client` - Auto-generated OpenAPI client
21+
- `/components` - Reusable React components
22+
- `/hooks` - Custom React hooks
23+
- `/routes` - Application routes and pages
24+
- `/public` - Static files served directly
25+
- `/tests` - End-to-end tests with Playwright
26+
27+
## API Integration
28+
- The OpenAPI client is auto-generated from the backend schema
29+
- API services are available in `/src/client/sdk.gen.ts`
30+
- Types are defined in `/src/client/types.gen.ts`
31+
- Use the `npm run generate-client` script to update the client
32+
33+
## Development Workflow
34+
- Use `npm run dev` for local development
35+
- The backend API URL can be configured via `VITE_API_URL` environment variable
36+
- Code formatting and linting is handled by Biome
37+
38+
## Testing
39+
- End-to-end testing with Playwright
40+
- Test files are in the `/tests` directory
41+
- Run tests with `npx playwright test`
42+
43+
## Docker Support
44+
- Production build uses multi-stage Docker build
45+
- Nginx serves the static files in production
46+
- Configuration in `Dockerfile` and `nginx.conf`
47+
48+
## Key Files
49+
- `vite.config.ts` - Vite configuration
50+
- `package.json` - Dependencies and scripts
51+
- `tsconfig.json` - TypeScript configuration
52+
- `biome.json` - Code formatting and linting rules
53+
- `openapi-ts.config.ts` - API client generation configuration

0 commit comments

Comments
 (0)