| # Workspace |
|
|
| ## Overview |
|
|
| pnpm workspace monorepo using TypeScript. Each package manages its own dependencies. |
|
|
| ## Stack |
|
|
| - **Monorepo tool**: pnpm workspaces |
| - **Node.js version**: 24 |
| - **Package manager**: pnpm |
| - **TypeScript version**: 5.9 |
| - **API framework**: Express 5 |
| - **Database**: PostgreSQL + Drizzle ORM |
| - **Validation**: Zod (`zod/v4`), `drizzle-zod` |
| - **API codegen**: Orval (from OpenAPI spec) |
| - **Build**: esbuild (CJS bundle) |
|
|
| ## Key Commands |
|
|
| - `pnpm run typecheck` — full typecheck across all packages |
| - `pnpm run build` — typecheck + build all packages |
| - `pnpm --filter @workspace/api-spec run codegen` — regenerate API hooks and Zod schemas from OpenAPI spec |
| - `pnpm --filter @workspace/db run push` — push DB schema changes (dev only) |
| - `pnpm --filter @workspace/api-server run dev` — run API server locally |
|
|
| See the `pnpm-workspace` skill for workspace structure, TypeScript setup, and package details. |
|
|
| ## FB Group Publisher PRO (artifacts/fb-publisher) |
|
|
| Arabic RTL web port of the Chrome extension. Architecture: |
| - **Web app** (this artifact): hosts UI, auth, subscriptions, saved lists, all main logic. |
| - **Bridge extension** (`public/extension/`): tiny Chrome extension installed by users; injects a content script on the web app that exposes Facebook cookies and tab scripting via `window.postMessage` (sources: `fbpub-web` ↔ `fbpub-bridge`). |
| - **Auth**: Clerk (mandatory). Express uses `clerkMiddleware` + a proxy from web `/api` to api-server. |
| - **Payments**: PayPal Sandbox subscription, $2.50 every 2 months with 1‑month free trial. Plan auto-created on first subscribe and IDs cached in `app_config` table. |
| - **DB tables**: `users`, `subscriptions`, `saved_lists`, `app_config` (drizzle). |
| - **Pages**: Landing, Sign-in/up, InstallExtension, Subscription, SubscriptionReturn, Publisher. |
|
|
| ## Chrome Extension — حماية الكود |
|
|
| - **الكود المصدري الأصلي** محفوظ في: `artifacts/fb-publisher/public/extension/src/background.source.js` (مُستبعد من Git) |
| - **الكود الموزّع** في `background.js` مُشفّر دائماً باستخدام javascript-obfuscator |
| - **لتعديل الكود**: عدّل `src/background.source.js` ثم شغّل `pnpm run obfuscate-extension` |
| - **السكريبت**: `scripts/obfuscate-extension.cjs` — يشفّر الكود ويبني ZIP تلقائياً |
| - **التبعية**: `javascript-obfuscator` مثبتة في الجذر (workspace root) |
|
|