Skip to content

Platform

Purpose

Explain the Cloudflare primitives this repository actually uses, and how they compose.

The three Cloudflare primitives in use

Primitive Used for Count
Worker Static Assets Serving each app's built dist/ (React/Vite output) directly from a Worker, no separate CDN/Pages product 7 (one per app)
Worker (dynamic) The API backend, plus two apps' own Worker-side routes workers/api (dedicated) + corporate-web, software-web, admin-web (own worker/ code, built alongside their frontend)
D1 Relational data - freelancer network, customer portal accounts, requirements/shortlists 1 database, akshaya-group-global
R2 Object storage 1 bucket, akshaya-group-global-files

There is no Cloudflare Pages project involved in the application deployment (only this documentation portal itself will use Pages - see Deployment). Every app is a Worker with Static Assets, which is why wrangler deploy (not a Pages-specific command) deploys all of them.

Why some apps have their own Worker code, not just static assets

Three apps' wrangler.jsonc declare run_worker_first:

App run_worker_first What it protects
corporate-web ["/customer-portal*", "/api/customer/*"] A cross-app customer portal/SSO-style flow (@akshaya/ui's customerPortalHref/isSafeReturnPath) - these paths run the app's own Worker code before falling back to static assets
software-web ["/freelancer-portal*", "/api/freelancer/*"] The freelancer marketplace's own portal/API surface
admin-web true (every path) The entire admin app routes through its Worker first - no path is served as a plain static file without the Worker seeing it first

Every other app (logistics-web, commerce-web, embroidery-web, investors-web) is pure Static Assets - no run_worker_first, no worker/ directory, nothing but the built dist/.

D1/R2 bindings are not exclusive to the central API Worker

From workers/api/wrangler.jsonc:

"d1_databases": [{ "binding": "DB", "database_name": "akshaya-group-global", ... }],
"r2_buckets": [{ "binding": "FILES", "bucket_name": "akshaya-group-global-files" }],
"send_email": [{ "name": "NOTIFY_EMAIL", "destination_address": "<NOTIFICATION_EMAIL>", ... }]
Three bindings on the API Worker: DB (D1), FILES (R2), NOTIFY_EMAIL (Cloudflare Email Workers). The same DB/FILES bindings are also declared directly in corporate-web's, software-web's, and admin-web's own wrangler.jsonc - each of those three apps' own Worker code (the run_worker_first routes) reads/writes the same D1 database and R2 bucket directly, independent of the central API Worker. logistics-web/commerce-web/embroidery-web/ investors-web have neither binding - they call the central API over HTTP for anything data-backed. Full detail: Cloudflare → Workers, Cloudflare → D1.

Observability

workers/api/wrangler.jsonc has "observability": { "enabled": true, "head_sampling_rate": 1 } - Cloudflare's built-in Workers Logs/tracing, 100% sampled. No third-party APM/monitoring service is configured anywhere in this repository - see Operations → Monitoring for what that means in practice.