2025-06-17 20:36:25 -04:00
# Agent Guide
2025-06-14 15:14:08 -04:00
## Commands
2025-07-20 18:21:49 +01:00
Check package.json for available scripts
2025-06-14 15:14:08 -04:00
## Architecture
- **Full-stack Rust + React monorepo** with pnpm workspace
- **Backend**: Rust/Axum API server (port 3001) with Tokio async runtime
- **Frontend**: React 18 + TypeScript + Vite (port 3000) with shadcn/ui components
- **Shared**: Common TypeScript types in `/shared/types.ts`
- **API**: REST endpoints at `/api/*` proxied from frontend to backend in dev
## Code Style
- **Rust**: Standard rustfmt, snake_case, derive Debug/Serialize/Deserialize
- **TypeScript**: Strict mode, @/ path aliases, interfaces over types
- **React**: Functional components, hooks, Tailwind classes
- **Imports**: Workspace deps, @/ aliases for frontend, absolute imports
- **Naming**: PascalCase components, camelCase vars, kebab-case files
2025-06-14 16:26:48 -04:00
# Managing Shared Types Between Rust and TypeScript
ts-rs allows you to derive TypeScript types from Rust structs/enums. By annotating your Rust types with #[derive(TS)] and related macros, ts-rs will generate .ts declaration files for those types.
2025-06-14 17:49:17 -04:00
When making changes to the types, you can regenerate them using `npm run generate-types`
2025-06-15 14:39:45 -04:00
Do not manually edit shared/types.ts, instead edit backend/src/bin/generate_types.rs
2025-06-14 17:52:16 -04:00
2025-06-15 14:16:13 -04:00
# Working on the frontend AND the backend
2025-06-14 17:52:16 -04:00
When working on any task that involves changes to the backend and the frontend, start with the backend. If any shared types need to be regenerated, regenerate them before starting the frontend changes.
2025-06-15 14:16:13 -04:00
# Testing your work
2025-07-20 18:21:49 +01:00
`npm run check` - runs cargo and tsc checks
2025-06-16 17:15:51 -04:00
# Backend data models
SQLX queries should be located in backend/src/models/\*
Use getters and setters instead of raw SQL queries where possible.