Skip to content

Commit 0606467

Browse files
authored
Merge pull request #1 from sarunas-llm/feat/add-agents-md
feat: Add AGENTS.MD file
2 parents 6453dea + 158ad48 commit 0606467

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed

AGENTS.MD

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# AGENTS.MD - Instructions for AI Agents
2+
3+
This document provides guidance for AI agents working on this project. It outlines the project structure, development workflow, and other important information to help you contribute effectively.
4+
5+
## Project Overview
6+
7+
This is a full-stack web application built with the following technologies:
8+
9+
* **Backend:**
10+
* [FastAPI](https://fastapi.tiangolo.com/): A modern, fast (high-performance) web framework for building APIs with Python.
11+
* [SQLModel](https://sqlmodel.tiangolo.com/): A library for interacting with SQL databases from Python code, with Python objects.
12+
* [PostgreSQL](https://www.postgresql.org/): A powerful, open-source object-relational database system.
13+
* [Alembic](https://alembic.sqlalchemy.org/): A lightweight database migration tool for SQLAlchemy.
14+
* **Frontend:**
15+
* [React](https://react.dev/): A JavaScript library for building user interfaces.
16+
* [TypeScript](https://www.typescriptlang.org/): A typed superset of JavaScript that compiles to plain JavaScript.
17+
* [Vite](https://vitejs.dev/): A fast frontend build tool.
18+
* [Chakra UI](https://chakra-ui.com/): A simple, modular and accessible component library for React.
19+
* **DevOps & Tooling:**
20+
* [Docker](https://www.docker.com/): For containerizing the application for consistent development and deployment.
21+
* [Traefik](https://traefik.io/): A modern reverse proxy and load balancer.
22+
* [uv](https://docs.astral.sh/uv/): For Python package and environment management.
23+
* [pre-commit](https://pre-commit.com/): For running pre-commit hooks to maintain code quality.
24+
25+
## Getting Started
26+
27+
### Backend Setup
28+
29+
1. Navigate to the `backend` directory: `cd backend`
30+
2. Install the Python dependencies using `uv`:
31+
```bash
32+
uv sync
33+
```
34+
3. Activate the virtual environment:
35+
```bash
36+
source .venv/bin/activate
37+
```
38+
39+
### Frontend Setup
40+
41+
1. Navigate to the `frontend` directory: `cd frontend`
42+
2. Ensure you have `nvm` or `fnm` installed. Then, install and use the correct Node.js version:
43+
```bash
44+
# Using fnm
45+
fnm install
46+
fnm use
47+
48+
# Or using nvm
49+
nvm install
50+
nvm use
51+
```
52+
3. Install the NPM dependencies:
53+
```bash
54+
npm install
55+
```
56+
57+
## Development Workflow
58+
59+
The primary way to run the application for development is using Docker Compose.
60+
61+
1. From the project root, start the entire stack:
62+
```bash
63+
docker compose watch
64+
```
65+
2. This will make the following services available:
66+
* **Frontend:** `http://localhost:5173`
67+
* **Backend API:** `http://localhost:8000`
68+
* **API Docs (Swagger):** `http://localhost:8000/docs`
69+
* **Database Admin (Adminer):** `http://localhost:8080`
70+
* **Email Catcher (MailCatcher):** `http://localhost:1080`
71+
72+
For a faster development loop, you can run the frontend or backend services locally outside of Docker. See `development.md` for more details.
73+
74+
## Testing
75+
76+
### Backend Tests
77+
78+
1. Navigate to the `backend` directory.
79+
2. Run the tests using the provided script:
80+
```bash
81+
bash ./scripts/test.sh
82+
```
83+
This script uses `pytest` to run the test suite.
84+
85+
### Frontend End-to-End Tests
86+
87+
1. Make sure the Docker stack is running: `docker compose up -d --wait backend`
88+
2. Navigate to the `frontend` directory.
89+
3. Run the Playwright tests:
90+
```bash
91+
npx playwright test
92+
```
93+
94+
## Code Generation
95+
96+
The frontend has a generated API client based on the backend's OpenAPI schema. If you make changes to the backend API, you must regenerate the client.
97+
98+
1. Ensure the backend virtual environment is activated.
99+
2. From the project root, run the generation script:
100+
```bash
101+
./scripts/generate-client.sh
102+
```
103+
3. Commit the updated client files in `frontend/src/client/`.
104+
105+
## Code Style & Linting
106+
107+
This project uses `pre-commit` to enforce code style and linting. The hooks are defined in `.pre-commit-config.yaml`.
108+
109+
* **Installation:** Run `pre-commit install` once to set up the git hooks.
110+
* **Usage:** The hooks will run automatically before each commit. If a hook modifies a file, you will need to stage the changes and commit again.
111+
* **Manual Run:** You can run the hooks on all files at any time with `pre-commit run --all-files`.
112+
113+
## Deployment
114+
115+
The application is designed to be deployed using Docker. A CI/CD pipeline using GitHub Actions is configured for `staging` and `production` environments. For detailed deployment instructions, please refer to the `deployment.md` file.
116+
117+
## Key Files & Directories
118+
119+
* `AGENTS.MD`: (This file) Instructions for AI agents.
120+
* `README.md`: General project information.
121+
* `development.md`: Detailed local development guide.
122+
* `deployment.md`: Detailed deployment guide.
123+
* `.env`: Configuration file for environment variables (passwords, keys, etc.).
124+
* `docker-compose.yml`: Main Docker Compose configuration.
125+
* `docker-compose.override.yml`: Docker Compose overrides for local development.
126+
* `backend/`: Contains the FastAPI backend application.
127+
* `backend/app/main.py`: Main application entry point.
128+
* `backend/app/models.py`: SQLModel data models.
129+
* `backend/app/api/`: API endpoint definitions.
130+
* `backend/app/crud.py`: CRUD operations.
131+
* `backend/app/tests/`: Backend tests.
132+
* `frontend/`: Contains the React frontend application.
133+
* `frontend/src/main.tsx`: Main application entry point.
134+
* `frontend/src/routes/`: Application routes and pages.
135+
* `frontend/src/components/`: Reusable React components.
136+
* `frontend/src/client/`: Generated API client.
137+
* `frontend/tests/`: Playwright E2E tests.
138+
* `.github/workflows/`: GitHub Actions CI/CD workflows.

0 commit comments

Comments
 (0)