How mjcet-acm/main-codebase works
1. Monorepo orchestration layer
- This repo is an Nx + pnpm monorepo. Nx is the task runner/build orchestrator across apps and shared packages, while pnpm manages workspace dependencies.
- The root also contains GitHub Actions workflows that deploy individual apps independently.
2. Three primary application boundaries
- apps/web: the public ACM MJCET website.
- apps/admin: an internal admin portal.
- apps/cf-server: a Cloudflare Worker backend API.
- These are separate deployable units with their own configs, build settings, and runtime targets.
3. Public website frontend (apps/web)
- Built with Next.js App Router and deployed to Cloudflare Workers via OpenNext.
- It is mostly a content/marketing site with pages such as home, about, blogs, events, team, contact, join, profile, and a test page.
- The site uses a component-heavy UI structure, including reusable sections, animation components, blog presentation components, and Tailwind-based styling.
4. Content and presentation data in the web app
- The web app relies on local public assets and JSON files like execom.json and team.json.
- That indicates a hybrid content model: some content is bundled into the frontend as static data, while page shells and interactions are rendered by Next.js.
5. Admin portal (apps/admin)
- Also a Next.js app deployed to Cloudflare Workers.
- It includes authentication flow handling (app/auth/callback) and user/settings-related UI components.
- The presence of a Supabase client and useUser hook suggests the admin boundary is identity-driven and likely depends on Supabase for session/user state.
6. Backend API worker (apps/cf-server)
- This is the main server-side API layer, implemented as a Cloudflare Worker using Hono-style routing/controller structure.
- Routes are split by domain: blog and user.auth.
- Controllers separate concerns further into blog CRUD and profile/auth logic, which is a clean API boundary for the frontend apps to consume.
7. Persistence layer
- The backend uses Cloudflare D1 as its database, with Drizzle ORM/schema files under apps/cf-server/src/db.
- The database domain appears to cover profiles and blogs, with migrations checked into drizzle/.
- This means API state is stored at the edge rather than in an external traditional server.
8. Backend request flow
- Requests enter apps/cf-server through route modules.
- Routes dispatch into controllers, which perform validation and database access.
- There is a shared email validation helper, indicating some request-level validation before persistence or auth actions.
9. Shared libraries
- packages/api-endpoints centralizes endpoint definitions or constants, likely used to avoid hardcoding API URLs across apps.
- packages/portfolio-components contains reusable UI/portfolio primitives, especially hero and achievement components, for consumption by apps that need consistent design blocks.
- These packages reduce duplication and form the shared layer of the architecture.
10. Deployment model
- All three apps are configured for Cloudflare Workers deployment, with separate Wrangler/OpenNext configs.
- GitHub Actions workflows exist for deploying the admin app, web app, and backend worker independently.
- The deployment unit is therefore per app, not per monorepo.
11. Runtime and technology boundaries
- Frontends: Next.js + React + Tailwind CSS + TypeScript.
- Backend: Cloudflare Workers + Hono + D1 + Drizzle.
- Authentication and identity: Supabase is used on the admin side, while backend auth/profile routes suggest a separate app-facing auth flow.
12. Architecture summary for a diagram
- Draw the repo as a monorepo root with three deployable apps and two shared packages.
- Show web and admin as independent Next.js edge apps.
- Show cf-server as the API worker with routes/controllers feeding D1 through Drizzle.
- Show shared packages feeding the apps for endpoint constants and reusable UI components.
Main entry points: web Web app · admin Admin app · cf-server API worker · nx.json Nx
Components 19
Monorepo
Nx + pnpm workspace orchestration and repo-wide config.
Deployable apps
Three independently deployed application boundaries.
- Web app · Public ACM MJCET website deployed to Cloudflare Workers.
apps/web - Admin app · Internal admin portal with auth and settings flows.
apps/admin - API worker · Backend API with route/controller structure and D1 persistence.
apps/cf-server - Web pages · Content pages for marketing, blogs, events, team, and profile.
apps/web/app - Web UI · Reusable sections, animations, blog UI, and shared presentation pieces.
apps/web/components - Static content · Bundled JSON data and public assets used by the site.
apps/web/public - Admin auth · Callback page and user/session handling for the portal.
apps/admin/app/auth/callback/page.tsx - Admin UI · Auth and settings UI plus user-state hooks and Supabase client.
apps/admin/components - API routes · Domain routing for blog and user/auth endpoints.
apps/cf-server/src/routes - Controllers · Blog CRUD and profile/auth handlers behind the API routes.
apps/cf-server/src/controllers - D1 schema · Database schema, Drizzle access, and migration state for profiles and blogs.
apps/cf-server/src/db - Validation · Request-level email validation used by the API worker.
apps/cf-server/src/helpers/validate-email.ts
Shared packages
Reusable libraries consumed across apps.
- API endpoints · Central endpoint definitions and constants for app-to-API calls.
packages/api-endpoints/src/lib/api-endpoints.ts - Portfolio UI · Reusable hero and achievement components shared across portfolio surfaces.
packages/portfolio-components/src/lib/portfolio-components.tsx
CI / deploy
Repository automation and deployment workflows.
- Deploy web · Workflow for independently deploying the public site.
.github/workflows/deploy-web-to-workers.yml - Deploy admin · Workflow for independently deploying the admin portal.
.github/workflows/deploy-admin-to-workers.yml - Deploy API · Workflow for independently deploying the backend worker.
.github/workflows/deploy-cf-backend-worker.yml
Connections 22
- Nx → Web app: orchestrates · Nx coordinates builds and tasks for the web app.
- Nx → Admin app: orchestrates · Nx coordinates builds and tasks for the admin app.
- Nx → API worker: orchestrates · Nx coordinates builds and tasks for the API worker.
- pnpm → Web app: links deps · pnpm links workspace dependencies into the web app.
- pnpm → Admin app: links deps · pnpm links workspace dependencies into the admin app.
- pnpm → API worker: links deps · pnpm links workspace dependencies into the API worker.
- Web app → Web pages: renders · The web app serves its App Router page tree.
- Web app → Web UI: composes · The web app composes reusable UI and section components.
- Web app → Static content: loads content · The web app reads bundled JSON data and public assets.
- Web app → Portfolio UI: uses · The web app reuses shared portfolio presentation components.
- Admin app → Admin auth: handles · The admin app manages authentication callback flow.
- Admin app → Admin UI: composes · The admin app uses auth/settings components and hooks.
- Admin app → API endpoints: calls · The admin app uses shared endpoint definitions for backend access.
- Admin app → API worker: consumes API · The admin portal talks to the backend worker for identity and data.
- API worker → API routes: exposes · The worker exposes domain routes for blog and auth/user APIs.
- API routes → Controllers: dispatches to · Routes delegate requests to domain controllers.
- Controllers → D1 schema: persists via · Controllers read and write through the D1/Drizzle data layer.
- Controllers → Validation: validates · API handlers validate inputs before persistence or auth actions.
- D1 schema → API endpoints: shares contracts · Shared endpoint/data contracts help align frontend and backend boundaries.
- Deploy web → Web app: deploys · Workflow deploys the public website independently.
- Deploy admin → Admin app: deploys · Workflow deploys the admin portal independently.
- Deploy API → API worker: deploys · Workflow deploys the backend worker independently.