Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
node-version: 22
cache: pnpm

- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0

- name: Install dependencies
run: pnpm install --frozen-lockfile

Expand Down Expand Up @@ -60,9 +63,11 @@ jobs:

- name: Generate Prisma Client
run: bun run prisma:generate
env:
DATABASE_URL: ${{ secrets.DATABASE_URL || 'postgresql://dummy:dummy@localhost:5432/dummy' }}

- name: Run All Tests (with Coverage)
run: pnpm test:coverage
- name: Run Backend & Frontend Tests
run: bun run test:all
Comment thread
tahiry-dev-29 marked this conversation as resolved.

- name: Upload Test Coverage
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
Expand Down Expand Up @@ -101,6 +106,8 @@ jobs:

- name: Generate Prisma client
run: bun run prisma:generate
env:
DATABASE_URL: ${{ secrets.DATABASE_URL || 'postgresql://dummy:dummy@localhost:5432/dummy' }}

- name: Run Build (Nx affected / fallback all)
run: bunx nx affected --target=build --base=origin/main || pnpm build:all
Expand Down
100 changes: 50 additions & 50 deletions AGENT.MD
Original file line number Diff line number Diff line change
Expand Up @@ -12,58 +12,58 @@

### Strict Structural Boundaries & Anti-Spaghetti Blueprint

* **No Spaghetti Code Allowed:** Maintain strict, clean boundaries with a highly separated structure using modular micro-components.
* **One File = One Class:** A strict rule for everyone. Exactly **1 class per file**.
* **Size Limit:** Keep it under **200 lines max**. If a file grows past this, split that beast into micro-components, widgets, or sub-classes immediately.
* **No Naked Functions in Services:** Service files are exclusively for the Service Class. Do not toss loose helper functions in there.
* **Dedicated Auxiliary Files:** Keep the main app logic perfectly clean by isolating secondary and helper tasks into their own explicit files:
* **Utilities:** Use `.util.ts` or place them inside a `utils/` folder.
* **Tests:** Use `.spec.ts` or `.test.ts`.
* **Seeds:** Use `.seed.ts`.
* **Shell Scripts:** Use `.sh`.
* **Database:** Keep migrations, database configs, and raw scripts far away from your core application logic.
- **No Spaghetti Code Allowed:** Maintain strict, clean boundaries with a highly separated structure using modular micro-components.
- **One File = One Class:** A strict rule for everyone. Exactly **1 class per file**.
- **Size Limit:** Keep it under **200 lines max**. If a file grows past this, split that beast into micro-components, widgets, or sub-classes immediately.
- **No Naked Functions in Services:** Service files are exclusively for the Service Class. Do not toss loose helper functions in there.
- **Dedicated Auxiliary Files:** Keep the main app logic perfectly clean by isolating secondary and helper tasks into their own explicit files:
- **Utilities:** Use `.util.ts` or place them inside a `utils/` folder.
- **Tests:** Use `.spec.ts` or `.test.ts`.
- **Seeds:** Use `.seed.ts`.
- **Shell Scripts:** Use `.sh`.
- **Database:** Keep migrations, database configs, and raw scripts far away from your core application logic.

### DX, DRY, & Styling

* **Zero Copy-Pasting:** Code must be completely DRY (Don't Repeat Yourself).
* **Design Patterns:** Leverage solid design patterns (Singleton, Factory, Decorators). Apply **1 pattern per feature** to keep the codebase elegant.
* **Styling:** **TailwindCSS only**. Absolutely no raw CSS or SCSS allowed.
* **Data Integrity:** Real data streams only! No fake or mocked initial data.
* **Docs & Tests:** Keep it minimal and clean. Use **Doxygen** for tiny class or function comments, and **Vitest** for testing.
- **Zero Copy-Pasting:** Code must be completely DRY (Don't Repeat Yourself).
- **Design Patterns:** Leverage solid design patterns (Singleton, Factory, Decorators). Apply **1 pattern per feature** to keep the codebase elegant.
- **Styling:** **TailwindCSS only**. Absolutely no raw CSS or SCSS allowed.
- **Data Integrity:** Real data streams only! No fake or mocked initial data.
- **Docs & Tests:** Keep it minimal and clean. Use **Doxygen** for tiny class or function comments, and **Vitest** for testing.

---

## ⚙️ 2. Tech Stack & Ecosystem

### Package Management & Runtime

* **Runtime:** **Bun** is the go-to standard over Node for running, testing, and building code.
* **Package Manager:** Use **pnpm** to install packages. Do **not** use bun for installation.
* **Command Execution:**
* Run `pnpm install` to fetch dependencies.
* Use `bun <file>`, `bun run <script>`, `bun test`, or `bun build` for execution.
* Use `bunx` instead of `npx`.
- **Runtime:** **Bun** is the go-to standard over Node for running, testing, and building code.
- **Package Manager:** Use **pnpm** to install packages. Do **not** use bun for installation.
- **Command Execution:**
- Run `pnpm install` to fetch dependencies.
- Use `bun <file>`, `bun run <script>`, `bun test`, or `bun build` for execution.
- Use `bunx` instead of `npx`.

* **Environment Variables:** Bun loads `.env` files automatically. Utilize configuration variants like `.env-example`, `.env-local`, and `.env-development`.
* **Path Mapping:** Always use absolute path aliases (e.g., `@features/`, `@core/`, `@shared/`). Crazy deep relative paths like `../../../../` are banned.
- **Environment Variables:** Bun loads `.env` files automatically. Utilize configuration variants like `.env-example`, `.env-local`, and `.env-development`.
- **Path Mapping:** Always use absolute path aliases (e.g., `@features/`, `@core/`, `@shared/`). Crazy deep relative paths like `../../../../` are banned.

### Framework-Specific Guidelines

#### 🚀 Bun APIs

* **SSE (Server-Sent Events):** The preferred, highly efficient method for handling GET streams.
* **Testing Execution:** Structure your test commands cleanly via scripts like `bun test` with targets like `bun:test:controller`, `bun:test:service`, etc.
- **SSE (Server-Sent Events):** The preferred, highly efficient method for handling GET streams.
- **Testing Execution:** Structure your test commands cleanly via scripts like `bun test` with targets like `bun:test:controller`, `bun:test:service`, etc.

#### 🅰️ Angular

* For handling GET requests, strictly use the new modern resources: **`httpResource()`**, **`resource()`**, or **`rxResource()`**.
* Alternatively, use classic RxJS Observables handled via the `async` pipe, utilizing operators like `.map()`, `.filter()`, and `.switchMap()`.
- For handling GET requests, strictly use the new modern resources: **`httpResource()`**, **`resource()`**, or **`rxResource()`**.
- Alternatively, use classic RxJS Observables handled via the `async` pipe, utilizing operators like `.map()`, `.filter()`, and `.switchMap()`.

#### 🟢 Backend

* Follow the standard **Nest.js Clean Architecture** principles as outlined in the core guidelines.
* **Micro-Component Isolation:** A service must be split into specific layers (Interfaces, Repository, Formatter, and Service). One Class Per File!
* **Prevent I/O Bottlenecks (Master Summary):** Never use `logger.warn()` or send notifications inside a `for` loop. Buffer the data and use a single "Master Summary Log" or grouped notification to avoid CPU/IO saturation.
- Follow the standard **Nest.js Clean Architecture** principles as outlined in the core guidelines.
- **Micro-Component Isolation:** A service must be split into specific layers (Interfaces, Repository, Formatter, and Service). One Class Per File!
- **Prevent I/O Bottlenecks (Master Summary):** Never use `logger.warn()` or send notifications inside a `for` loop. Buffer the data and use a single "Master Summary Log" or grouped notification to avoid CPU/IO saturation.

---

Expand All @@ -73,39 +73,39 @@ No shortcuts. Write highly defensive, strongly-typed code.

> ### ❌ Strictly Forbidden TypeScript Patterns
>
> * **No `any` type:** Zero exceptions. Use proper typing, generics, or `unknown`.
> * **No `as` keyword:** Type casting is banned. Use type guards instead.
> * **No `!` operator:** Non-null assertions are not allowed. Validate your optional data safely.
> * **No compiler bypass comments:** The following annotations are completely banned:
> * `// @ts-ignore`
> * `// @ts-nocheck`
> * `// @ts-expect-error`
> - **No `any` type:** Zero exceptions. Use proper typing, generics, or `unknown`.
> - **No `as` keyword:** Type casting is banned. Use type guards instead.
> - **No `!` operator:** Non-null assertions are not allowed. Validate your optional data safely.
> - **No compiler bypass comments:** The following annotations are completely banned:
> - `// @ts-ignore`
> - `// @ts-nocheck`
> - `// @ts-expect-error`

* **Advanced Type Systems:** Leverage **Generics** and **Discriminated Unions** to model your UI states and API responses robustly.
- **Advanced Type Systems:** Leverage **Generics** and **Discriminated Unions** to model your UI states and API responses robustly.

---

## 🎨 4. Design System (UI/UX Pro Max)

* **Core UI Stack:** **TailwindCSS 4**.
* **Icons:** Pure **SVG icons only**. Emojis are strictly banned inside the actual user interface.
* **Accessibility & Mobile UX:**
* Maintain a minimum **44x44px touch target** size for all interactive elements to avoid misclicks.
* Ensure a strict **4.5:1 color contrast ratio** for text readability.
* Build responsive layouts by default using Tailwind breakpoints (`md:`, `max-md:`, etc.).
- **Core UI Stack:** **TailwindCSS 4**.
- **Icons:** Pure **SVG icons only**. Emojis are strictly banned inside the actual user interface.
- **Accessibility & Mobile UX:**
- Maintain a minimum **44x44px touch target** size for all interactive elements to avoid misclicks.
- Ensure a strict **4.5:1 color contrast ratio** for text readability.
- Build responsive layouts by default using Tailwind breakpoints (`md:`, `max-md:`, etc.).

---

## 🚀 5. Post-Change Verification Workflow

Before pushing any changes to source control, always run validation checks to ensure zero regressions:

| Step | Command | Purpose |
| --- | --- | --- |
| **1** | `pnpm run lint` | Ensures code style and strict TS compliance match project rules. |
| **2** | `bun test` | Executes the Vitest suite to ensure no logic is broken. |
| **3** | `bun build` | Compiles the application to catch build-time errors before deployment. |
| Step | Command | Purpose |
| ----- | --------------- | ---------------------------------------------------------------------- |
| **1** | `pnpm run lint` | Ensures code style and strict TS compliance match project rules. |
| **2** | `bun test` | Executes the Vitest suite to ensure no logic is broken. |
| **3** | `bun build` | Compiles the application to catch build-time errors before deployment. |

---

*Knowledge Sync Location: Checkout `.agents/rules` for real-time local updates. Use semantic keyword searches (e.g., searching for `product`, `produit`) to navigate the workspace efficiently.*
_Knowledge Sync Location: Checkout `.agents/rules` for real-time local updates. Use semantic keyword searches (e.g., searching for `product`, `produit`) to navigate the workspace efficiently._
113 changes: 70 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,89 @@
"license": "MIT",
"packageManager": "pnpm@10.33.0",
"scripts": {
"start:all": "dotenv -e .env.local -- bun run prisma:generate && dotenv -e .env.local -- bunx nx run-many --target=serve --projects=store,dashboard,api --parallel",
"start:store": "dotenv -e .env.local -- bunx nx run store:serve:development --port=4200",
"start:dashboard": "dotenv -e .env.local -- bunx nx run dashboard:serve:development --port=4201",
"start:api": "dotenv -e .env.local -- bunx nx run api:serve:development",
"prisma:generate": "dotenv -e .env.local -- bunx prisma generate",
"prisma:generate:local": "dotenv -e .env.local -- bunx prisma generate",
"prisma:generate:docker": "dotenv -e .env.docker -- bunx prisma generate",
"prisma:generate:prod": "dotenv -e .env.production -- bunx prisma generate",
"prisma:seed": "dotenv -e .env.local -- bun prisma/seed.ts",
"prisma:seed:local": "dotenv -e .env.local -- bun prisma/seed.ts",
"prisma:seed:docker": "dotenv -e .env.docker -- bun prisma/seed.ts",
"prisma:migrate:deploy": "dotenv -e .env.local -- bunx prisma migrate deploy",
"prisma:migrate:deploy:docker": "dotenv -e .env.docker -- bunx prisma migrate deploy",
"prisma:migrate:deploy:prod": "dotenv -e .env.production -- bunx prisma migrate deploy",
"prisma:studio": "dotenv -e .env.local -- bunx prisma studio --port 5555",
"prisma:studio:local": "dotenv -e .env.local -- bunx prisma studio --port 5555",
"prisma:studio:docker": "dotenv -e .env.docker -- bunx prisma studio --port 5556",
"build:all": "dotenv -e .env.local -- bun run prisma:generate && bunx nx run-many --target=build --all --parallel",
"build:api": "dotenv -e .env.local -- bun run prisma:generate && bunx nx build api",
"build:store": "bunx nx build store",
"build:dashboard": "bunx nx build dashboard",
"dev": "bun run dev:all",
"dev:all": "dotenv -e .env.local -- bun run db:generate && dotenv -e .env.local -- bunx nx run-many --target=serve --projects=store,dashboard,api --parallel",
"dev:api": "dotenv -e .env.local -- bunx nx run api:serve:development",
"dev:dashboard": "dotenv -e .env.local -- bunx nx run dashboard:serve:development --port=4201",
"dev:store": "dotenv -e .env.local -- bunx nx run store:serve:development --port=4200",
"start": "bun run dev",
"start:all": "bun run dev:all",
"start:api": "bun run dev:api",
"start:dashboard": "bun run dev:dashboard",
"start:store": "bun run dev:store",
"start:api:prod": "dotenv -e .env.production -- bun dist/apps/api/main.js",
"build": "bun run build:all",
"build:all": "dotenv -e .env.local -- bun run db:generate && bunx nx run-many --target=build --all --parallel",
"build:api": "dotenv -e .env.local -- bun run db:generate && bunx nx build api",
Comment thread
tahiry-dev-29 marked this conversation as resolved.
"build:dashboard": "bunx nx build dashboard",
"build:store": "bunx nx build store",
"db:generate": "dotenv -e .env.local -- bunx prisma generate",
"db:generate:docker": "dotenv -e .env.docker -- bunx prisma generate",
"db:generate:local": "bun run db:generate",
"db:generate:prod": "dotenv -e .env.production -- bunx prisma generate",
"db:migrate:deploy": "dotenv -e .env.local -- bunx prisma migrate deploy",
"db:migrate:deploy:docker": "dotenv -e .env.docker -- bunx prisma migrate deploy",
"db:migrate:deploy:prod": "dotenv -e .env.production -- bunx prisma migrate deploy",
"db:seed": "dotenv -e .env.local -- bun prisma/seed.ts",
"db:seed:docker": "dotenv -e .env.docker -- bun prisma/seed.ts",
"db:seed:local": "bun run db:seed",
"db:studio": "dotenv -e .env.local -- bunx prisma studio --port 5555",
"db:studio:docker": "dotenv -e .env.docker -- bunx prisma studio --port 5556",
"db:studio:local": "bun run db:studio",
"prisma:generate": "bun run db:generate",
"prisma:generate:docker": "bun run db:generate:docker",
"prisma:generate:local": "bun run db:generate:local",
"prisma:generate:prod": "bun run db:generate:prod",
"prisma:migrate:deploy": "bun run db:migrate:deploy",
"prisma:migrate:deploy:docker": "bun run db:migrate:deploy:docker",
"prisma:migrate:deploy:prod": "bun run db:migrate:deploy:prod",
"prisma:seed": "bun run db:seed",
"prisma:seed:docker": "bun run db:seed:docker",
"prisma:seed:local": "bun run db:seed:local",
"prisma:studio": "bun run db:studio",
"prisma:studio:docker": "bun run db:studio:docker",
"prisma:studio:local": "bun run db:studio:local",
"lint": "bunx nx run-many --target=lint --all --parallel",
"lint:fix": "bunx nx run-many --target=lint --all --parallel -- --fix",
"format": "bunx prettier --write .",
"format:check": "bunx prettier --check .",
"test": "bunx vitest",
"test:all": "bunx nx run-many --target=test --projects=cart,cms,order,payment,shipping,pricing,store,dashboard",
"test:backend": "bunx nx run-many --target=test --projects=cart,cms,order,payment,shipping,pricing",
"test:cart": "bunx nx run cart:test",
"test:cms": "bunx nx run cms:test",
"test:coverage": "bunx nx run-many --target=test --all --parallel -- --coverage",
"test:frontend": "bunx nx run-many --target=test --projects=store,dashboard",
"test:order": "bunx nx run order:test",
"test:payment": "bunx nx run payment:test",
"test:pricing": "bunx nx run pricing:test",
"test:shipping": "bunx nx run shipping:test",
"test:ui": "bunx vitest --ui",
"test:watch": "bunx vitest",
"validate": "bun run lint && bun run build:all && bun run test:all",
"clean": "bunx nx reset && rm -rf dist coverage docs",
"docker:build": "docker compose --env-file .env.docker build",
"docker:build:api": "docker compose --env-file .env.docker build api",
"docker:build:store": "docker compose --env-file .env.docker build store",
"docker:build:dashboard": "docker compose --env-file .env.docker build dashboard",
"docker:build:store": "docker compose --env-file .env.docker build store",
"docker:build:studio": "docker compose --env-file .env.docker build prisma-studio",
"docker:up": "docker compose --env-file .env.docker up -d --build",
"docker:up:backend": "docker compose --env-file .env.docker up -d --build postgres api",
"docker:up:api": "docker compose --env-file .env.docker up -d --build api",
"docker:up:store": "docker compose --env-file .env.docker up -d --build store",
"docker:up:dashboard": "docker compose --env-file .env.docker up -d --build dashboard",
"docker:up:studio": "docker compose --env-file .env.docker up -d --build prisma-studio",
"docker:down": "docker compose --env-file .env.docker down",
"docker:logs": "docker compose --env-file .env.docker logs -f store dashboard api postgres prisma-studio",
"docker:logs:backend": "docker compose --env-file .env.docker logs -f api postgres",
"docker:logs:dashboard": "docker compose --env-file .env.docker logs -f dashboard",
"docker:logs:front": "docker compose --env-file .env.docker logs -f store dashboard",
"docker:logs:store": "docker compose --env-file .env.docker logs -f store",
"docker:logs:dashboard": "docker compose --env-file .env.docker logs -f dashboard",
"docker:logs:studio": "docker compose --env-file .env.docker logs -f prisma-studio",
"docker:ps": "docker compose --env-file .env.docker ps",
"docker:down": "docker compose --env-file .env.docker down",
"lint": "bunx nx run-many --target=lint --all --parallel",
"test": "bunx vitest",
"test:coverage": "bunx nx run-many --target=test --all --parallel -- --coverage",
"test:ui": "bunx vitest --ui",
"test:cms": "bunx nx run cms:test",
"test:cart": "bunx nx run cart:test",
"test:order": "bunx nx run order:test",
"test:payment": "bunx nx run payment:test",
"test:shipping": "bunx nx run shipping:test",
"test:pricing": "bunx nx run pricing:test",
"test:backend": "bunx nx run-many --target=test --projects=cart,cms,order,payment,shipping,pricing",
"docker:up": "docker compose --env-file .env.docker up -d --build",
"docker:up:api": "docker compose --env-file .env.docker up -d --build api",
"docker:up:backend": "docker compose --env-file .env.docker up -d --build postgres api",
"docker:up:dashboard": "docker compose --env-file .env.docker up -d --build dashboard",
"docker:up:store": "docker compose --env-file .env.docker up -d --build store",
"docker:up:studio": "docker compose --env-file .env.docker up -d --build prisma-studio",
"docs:generate": "rm -rf docs && doxygen Doxyfile",
"docs:view": "xdg-open docs/html/index.html || open docs/html/index.html",
"prepare": "husky",
"test:watch": "bunx vitest"
"prepare": "husky"
},
"private": true,
"pnpm": {
Expand Down
Loading