# Ti-Pote — Project Instructions ## Project Overview Robot animatronique de bureau personnel — modulaire, imprimé en 3D, propulsé par l'IA. Monorepo avec pnpm workspaces. ## Stack - **Backend**: NestJS + TypeScript, architecture hexagonale (ports & adapters) - **ORM**: TypeORM avec PostgreSQL + pgvector - **Cache**: Redis (ioredis) - **Frontend**: Next.js (à venir dans `apps/frontend`) - **Infra**: Docker Compose (dev), VPS (prod) ## Repository Structure ``` apps/backend/ # NestJS core backend src/ core/ # Domain (no external deps) ports/inbound/ # Inbound interfaces ports/outbound/ # Outbound interfaces (STT, TTS, LLM, storage, cache...) services/ # Business logic domain/entities/ # TypeORM entities tools/ # LLM function/tool definitions adapters/ inbound/ # REST controllers, WebSocket gateways outbound/ # Implementations of outbound ports config/ # App, DB, Redis config migrations/ # TypeORM migrations (raw SQL) shared/ # Utils (crypto, token counter, logger) apps/frontend/ # Next.js frontend (future) docs/ # Architecture, features, data model, roadmap ``` ## Commands ```bash pnpm dev # Start backend in watch mode pnpm build # Build backend pnpm lint # Lint all packages docker compose up -d # Start PostgreSQL + Redis ``` ## Conventions - Language: TypeScript strict mode - Entities in `core/domain/entities/` — file pattern: `*.entity.ts` - Ports in `core/ports/` — file pattern: `*.port.ts`, exported as Symbols - Adapters implement ports — injected via NestJS DI - Migrations are manually written SQL (not auto-generated) - Use `snake_case` for DB columns (TypeORM `@Column({ name: 'snake_case' })`) - Use `camelCase` for TypeScript properties - All dates stored as `TIMESTAMPTZ` - Credentials encrypted with AES-256-GCM before storage