This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Assembly Profile Manager — a Next.js 14 (App Router) application that lets clients view and edit their profile fields through an Assembly (formerly Copilot) portal. Built with TypeScript, MUI v5, Prisma ORM, and deployed on Vercel with PostgreSQL.
yarn dev # Start dev server at localhost:3000
yarn build # Production build
yarn lint:check # ESLint check on src/ and test/
yarn lint:fix # ESLint with auto-fix
yarn prettier:check # Prettier format check
yarn prettier:fix # Prettier auto-formatAfter changing prisma/schema.prisma:
npx prisma generate # Regenerate Prisma client (also runs on postinstall)
npx prisma db push # Push schema changes to databaseNo test suite is configured.
- Portal embeds this app with a token query parameter (JWT from Copilot/Assembly)
- Server component (
app/page.tsx) validates the token viaCopilotAPI, fetches client/company/workspace data, and passes it to client components - Client components use
AppContext(React Context) for UI state andSWRfor client-side data fetching from internal API routes - API routes (
app/api/) act as a backend: they call Copilot SDK for external data and Prisma for local DB (settings, field access permissions, profile update history)
src/utils/copilotApiUtils.ts—CopilotAPIclass wrappingcopilot-node-sdk. All Copilot API interactions go through this.src/context/index.tsx—AppContextholds global state: sidebar visibility, search, custom field access (read-only + mutable copies), settings, token, workspace.src/lib/db.ts— Prisma singleton pattern for serverless.src/types/common.ts— Core types with Zod schemas for API response validation.
Three models in prisma/schema.prisma:
CustomFieldAccess— per-portal field-level VIEW/EDIT permissionsClientProfileUpdates— audit log of profile changes (stores full custom fields + changed fields as JSONB)Setting— per-portal JSON configuration
Uses relationMode = "prisma" for serverless compatibility. Connection string uses POSTGRES_PRISMA_URL_WITH_POOL.
Settings and custom field access are stored as two copies in context: a read-only version (for diffing/reset) and a mutable version (for in-progress edits). See customFieldAccess vs mutableCustomFieldAccess and settings vs mutableSettings in AppContext.
- Path alias:
@/*maps to./src/* - Prettier: single quotes, trailing commas, 125 char line width
- ESLint: extends
next/core-web-vitals,react-hooks/exhaustive-depsis disabled - Pre-commit hooks: Husky runs
lint:fixandprettier:fixon staged.ts/.tsxfiles - Styling: MUI
sxprop and@emotion/styled— no CSS modules or Tailwind - Branding: "Assembly" (not "Copilot") in user-facing text; SDK references still use
copilot-node-sdk
Copy .env.example to .env.local. Required variables:
COPILOT_API_KEY— from the Assembly/Copilot dashboardCOPILOT_ENV—localfor test tokens,productionfor real tokensPOSTGRES_PRISMA_URLand related DB vars — PostgreSQL connection stringsVERCEL_URL/VERCEL_ENV— set tolocalhost:3000/developmentlocally