Skip to content
This repository was archived by the owner on Jun 15, 2026. It is now read-only.

Commit a04a01c

Browse files
committed
feat: add agents md file
1 parent 0471310 commit a04a01c

3 files changed

Lines changed: 48 additions & 4 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ yarn-error.log*
3030

3131
# IDE
3232
.vscode/
33+
.idea
34+
35+
# Schema Spy
36+
schemaspy/output/

AGENTS.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# AGENTS.md
2+
3+
## Big picture
4+
- `tasknote` is a monorepo with a React/Vite frontend (`client/`) and Spring Boot API (`server/`) sharing a PostgreSQL schema managed by Flyway migrations (`server/src/main/resources/db/migration/`).
5+
- Request boundary is explicit: unauthenticated endpoints under `/auth/**`, authenticated business endpoints under `/rest/**`, and public shared-note endpoints under `/public/**` (see `server/src/main/java/br/com/tasknoteapp/server/config/SecurityConfig.java`).
6+
- Frontend talks directly to backend URLs from `client/src/api-service/apiConfig.ts` (`VITE_BACKEND_SERVER`), using `fetch` wrapper logic in `client/src/api-service/api.ts`.
7+
- Auth is JWT-in-header + localStorage persistence (`API_TOKEN`), with automatic 2-minute token refresh in `client/src/context/AuthProvider.tsx` via `/rest/user-sessions/refresh`.
8+
9+
## Architecture details that matter
10+
- Frontend route split is auth-state driven in `client/src/App.tsx` + `client/src/routes/ProtectedRoute/index.tsx`; private screens render through `client/src/layout/PrivateLayout/index.tsx`.
11+
- Home view (`client/src/views/Home/index.tsx`) is a key integration surface: loads tasks/notes/tags, applies client-side filtering, and drives note sharing (`/rest/notes/{id}/share` + `/public/notes/{token}`).
12+
- Backend follows controller -> service -> repository layering (`server/src/main/java/br/com/tasknoteapp/server/{controller,service,repository}`).
13+
- Global API error shape comes from `server/src/main/java/br/com/tasknoteapp/server/controller/RestExceptionController.java`; frontend expects `message` or `fields[].fieldMessage` (`client/src/api-service/api.ts`).
14+
- Email and password-reset flows are Mailgun-backed (`server/src/main/java/br/com/tasknoteapp/server/service/MailgunEmailService.java`) and use templates under `server/src/main/java/br/com/tasknoteapp/server/templates/` + `mailgun-templates/`.
15+
16+
## Developer workflows (use these first)
17+
- Frontend quality gate: `bash tools/check-frontend.sh` (runs `npm ci`, `lint:fix`, `build`, `test:no-watch`).
18+
- Backend quality gate: `bash tools/check-backend.sh` (runs checkstyle, compile, then `clean verify -P tests`).
19+
- Important Maven default: tests/checkstyle/jacoco are skipped unless profile `-P tests` is enabled (`server/pom.xml`).
20+
- Dev stack via Docker Compose/Taskfile (`Taskfile.yml`, `docker-compose.dev.yml`): app `5000`, API `8585`, Java debug port `5005`, Postgres `5432`.
21+
- Frontend local dev: run from `client/` with `npm start`; backend local dev: run from `server/` with `./mvnw spring-boot:run`.
22+
23+
## CI/CD and release behavior
24+
- PR workflows (`.github/workflows/client-ci.yml`, `.github/workflows/server-ci.yml`) run checks then push `:candidate` images to GHCR.
25+
- Main workflows (`.github/workflows/main-client.yml`, `.github/workflows/main-server.yml`) push versioned tags + `latest`; backend workflow also increments `server/pom.xml` version.
26+
- Deploy workflows (`.github/workflows/deploy-stg.yml`, `.github/workflows/deploy.yml`) apply Terraform in `terraform-stg/` and `terraform/` to Kubernetes.
27+
- Infra wiring (secrets, services, ingress, image vars) is defined in `terraform/main.tf`.
28+
29+
## Project conventions to preserve
30+
- Frontend style is ESLint flat config + stylistic rules (2-space indent, single quotes, semicolons) in `client/eslint.config.mjs`.
31+
- Backend style is Google Checkstyle (`server/.mvn/google_checks.xml`), including 100-char line length and Javadoc requirements on public APIs.
32+
- Integration tests are named `*IntTest.java` and are run by Failsafe; unit tests exclude that suffix (`server/pom.xml`).
33+
- Migration files are versioned `V<timestamp>__description.sql`; never edit old migrations, add new ones in `server/src/main/resources/db/migration/`.
34+
35+
## Agent guardrails
36+
- Prefer editing source, not generated artifacts (`server/target/`, `schemaspy/output/`, `TaskNoteBruno/results.html`).
37+
- Keep API contract compatibility with frontend `ApiConfig` paths; changing endpoint paths requires synchronized client updates.
38+
- When changing auth/session behavior, update both backend filters/controllers and frontend `AuthProvider` token lifecycle.
39+
- If you change CI/build/deploy commands, update both `README.md` and this `AGENTS.md` to keep workflows discoverable.
40+

docker-compose.prod.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ services:
2929
POSTGRES_PORT: 5432
3030
CORS_ALLOWED_ORIGINS: http://tasknote-web:5000, http://localhost:5000
3131
SERVER_SERVLET_CONTEXT_PATH: /
32-
TARGET_ENV: development
33-
SECURITY_KEY: this-is-a-very-long-security-key-for-dev
34-
MAILGUN_APIKEY: invalid-api-key-only-placeholder
32+
TARGET_ENV: production
33+
SECURITY_KEY: ${SECURITY_KEY:-default-security-key}
34+
MAILGUN_APIKEY: ${MAILGUN_APIKEY:-default-mailgun-apikey}
3535
ports: ["8585:8585"]
3636
image: ghcr.io/rmcampos/tasknote/api:latest
3737
healthcheck:
@@ -62,4 +62,4 @@ services:
6262

6363
networks:
6464
tasknote-network:
65-
driver: bridge
65+
driver: bridge

0 commit comments

Comments
 (0)