# System Discovery ## Current Architecture The Canino Iran system is structured around an active customer storefront and a NestJS REST API backend. ### Active Core Applications 1. **React / Vite Storefront Application** (`src/`): React 19 + Vite 6 Single Page Application for customer product discovery, supplement dosage recommendation, pet registration, health tracking, and wallet management. 2. **NestJS Backend Service** (`backend/src/`): Modular NestJS 11 backend service providing business logic, authentication, pet data, catalog management, orders, and system settings. 3. **Database Layer**: PostgreSQL database modeled via Prisma ORM 5.22 (`backend/prisma/schema.prisma`). 4. **Caching & Session Layer**: Redis via `ioredis` for throttling, caching, and session storage. ### Excluded / Non-Auditable Artifacts 1. **`frontend/application`**: Next.js build/cache placeholder containing only `.next/`, `tsconfig.tsbuildinfo`, `next-env.d.ts`, and `node_modules/`. Lacks an active `package.json` or source tree. Excluded from code audit. 2. **`frontend/admin-panel`**: Placeholder directory containing only `node_modules/`. Excluded from code audit. --- ## Major Business Domains Discovered - **User & Wallet Domain**: User profile, authentication (JWT), multi-address support, wallet deposit/withdrawal ledger. - **Pet & Health Domain**: Pet registration, breed/weight profiling, medical conditions tracking, daily health logs, dosing reminders. - **Product & Dosage Domain**: Supplement catalog, dosage logic calculation based on pet weight and species, category listings, ingredient/symptom mapping. - **Order & Charity Domain**: Checkout workflow, coupon validation, tracking numbers, automatic charity donation allocations. - **Settings & Content Domain**: Administrative UI text updates and scientific glossary definitions. --- ## Technical Architecture Summary - **Authentication / Authorization**: JWT tokens issued via NestJS Passport strategy (`backend/src/auth`). Supported roles in schema: `User_PetOwner` and `Admin`. - **API Architecture**: REST endpoints documented via NestJS Swagger OpenAPI (`backend/src/main.ts`) and root `swagger.yml`. - **Database & Migration**: PostgreSQL managed by Prisma ORM (`backend/prisma/schema.prisma`). - **Container Infrastructure**: Multi-stage Dockerfiles and `docker-compose.yml` for `frontend`, `backend`, `postgres`, `redis`, `nginx`, and `prometheus`. --- ## Evidence-Based Status Matrix | Component / Finding | Classification | Supporting Evidence | | :--- | :--- | :--- | | Root Storefront App (React 19 + Vite 6) | Active Application | `package.json`, `vite.config.ts`, `src/App.tsx` | | NestJS Backend Service | Active Application | `backend/package.json`, `backend/prisma/schema.prisma`, `backend/src/main.ts` | | PostgreSQL & Prisma ORM Layer | Active Database Layer | `backend/prisma/schema.prisma`, `backend/package.json` | | Redis In-Memory Store | Active Cache/Throttle | `backend/src/redis/`, `backend/package.json` | | Docker Compose Environment | Active Infrastructure | `docker-compose.yml`, `Dockerfile`, `backend/Dockerfile` | | `frontend/application` | Excluded Placeholder | Lacks `package.json` and `src/`. Contains only build artifacts (`.next/`, `next-env.d.ts`). | | `frontend/admin-panel` | Excluded Placeholder | Lacks `package.json` and `src/`. Contains only `node_modules/`. | | Standalone Admin Panel App | Non-Existent | No source tree found in `frontend/admin-panel` or `src/components/Admin*`. Admin API capabilities exist in backend (`backend/src/settings`). | | Live Payment Gateway Integration | Inferred / Unknown | Frontend relies on mock checkout; schema supports transactions. | | Automated CI/CD Pipelines | Missing / Unknown | No `.github/workflows` or equivalent discovered. |