# B2B Storefront AI Agent Instructions (`apps/b2b`) > **Tech Stack:** Nuxt 4, Vue 3, Nitro Server, Tailwind CSS, Pinia > **Role:** Wholesale B2B E-Commerce Marketplace (SSR / Universal Rendering) --- ## 1. Nuxt 4 Architecture & Boundaries 1. **Universal / Server-Side Rendering (SSR)**: Nuxt 4 uses Nitro engine. Server routes and server-side fetching run in a Node.js runtime environment where `window` and `localStorage` do not exist. Always check for client-side environment before accessing browser globals (`import.meta.client` or `process.client`). 2. **Memory Constraints**: - Production Nitro server must run with `NODE_OPTIONS="--max-old-space-size=256 --enable-source-maps=false"`. - Prevent memory leaks in pinia stores and long-lived server singletons. 3. **API Proxying**: - In production containers, `NUXT_API_PROXY_TARGET: http://backend:8080` allows the server to proxy API requests internally without leaving the container network. - For client-side requests, `NUXT_PUBLIC_API_BASE_URL` is used. --- ## 2. Shared Packages Integration - Import routes from `@keluargamart/contracts/routes`. - Import permissions from `@keluargamart/permissions`. - Import business formatters from `@keluargamart/utils` (`formatRupiah`, `formatDate`). - Do NOT re-implement custom money parsing or currency formatting. --- ## 3. Testing & Validation - Run B2B test suite: `pnpm --filter @keluargamart/b2b test`. - All 20 test files and 170 unit tests must pass cleanly. - Verify production compilation: `pnpm --filter @keluargamart/b2b build` (produces `.output/`).