Skip to content

Corporate

Purpose

The main public corporate site, plus the shared Akshaya Customer Account authentication and account-management surface consumed by other apps.

Source directory

apps/corporate-web/ — src/ (React frontend), worker/ (this app's own Worker code), public/customer-portal/ (portal static assets, including the generated shared.css — see Monorepo "Generated CSS").

Framework

React 18 + TypeScript + Vite.

Commands

npm run dev:corporate       # Vite dev server
npm run build:corporate     # sync:portal-styles -> tsc -b -> vite build -> tsc -p worker/tsconfig.json

Output

apps/corporate-web/dist/ (frontend) - the worker's own compiled output is type-checked, not separately bundled (Wrangler compiles worker/entry.ts at deploy time).

Deployment mechanism

Cloudflare Worker, name akshaya-group-global, Static Assets + run_worker_first for /customer-portal* and /api/customer/*. wrangler deploy --config apps/corporate-web/wrangler.jsonc. Domain: akshayagroupglobal.com (custom_domain: true).

worker/entry.ts is a thin extension wrapper. Existing auth/marketplace routes remain in worker/index.ts; customer-account completeness routes are isolated in worker/customer-account.ts and delegate everything else back to the existing Worker.

Environment variables

None currently read from import.meta.env in this app's source (see Applications overview "Note on environment variables"). The Worker still requires the existing CUSTOMER_SSO_SECRET for Commerce handoff tokens.

akshayagroupglobal.com

Dependencies on shared packages

@akshaya/ui, @akshaya/shared.

Customer Account capabilities

The signed-in customer surface provides:

  • profile name/mobile management
  • account-linked enquiries
  • Commerce order summaries plus customer-owned order detail, line items and immutable checkout address
  • Logistics shipment summaries plus customer-owned tracking history
  • saved delivery addresses with one active default per customer
  • secure password change that revokes every customer session
  • saved freelancers, requirements and invitation management

Saved addresses are deliberately independent of order_address. Editing or archiving a saved address never changes an already-placed order's delivery snapshot.

Payment methods are not stored in the Customer Account while Commerce is COD-only. Card/UPI token storage should only be introduced with a real payment provider/tokenization design; raw payment credentials must never be stored in D1.

Customer Account endpoints

Existing routes remain unchanged:

POST /api/customer/auth/register
POST /api/customer/auth/login
POST /api/customer/auth/logout
GET  /api/customer/auth/session
GET/PATCH /api/customer/me
POST /api/customer/commerce-token
... marketplace shortlist/requirements/invitations routes ...

Customer-account completeness routes:

GET/POST    /api/customer/addresses
PATCH/DELETE /api/customer/addresses/:id
GET         /api/customer/orders/:id
GET         /api/customer/shipments/:id
POST        /api/customer/security/password

Every detail/address query is scoped to the authenticated Customer user_id. State-changing extension routes reuse the existing Corporate customer CSRF origin policy. Password changes require the current password, apply the same PBKDF2 policy as customer authentication, revoke all existing sessions, and require a new sign-in.

  • The central API Worker (api.akshayagroupglobal.com): /api/contact (the corporate contact form), /api/public-config, /api/health.

Troubleshooting

  • /customer-portal* returns a 404 for a real client-side route: check run_worker_first in apps/corporate-web/wrangler.jsonc still lists the path pattern, and that no file under public/ collides with it - see Cloudflare → Troubleshooting.
  • Portal styling looks wrong after a packages/ui change: run npm run sync:portal-styles and commit the regenerated apps/corporate-web/public/customer-portal/shared.css - CI's check:portal-styles-drift step catches this if forgotten.
  • Saved-address APIs return a schema error after deployment: confirm migration 0012_customer_account.sql was applied before Corporate Worker deployment.