Skip to content

refactor: rename Project to Workspace across entire codebase#7620

Merged
Dhruwang merged 13 commits into
epic/v5from
refactor/rename-project-to-workspace
Mar 31, 2026
Merged

refactor: rename Project to Workspace across entire codebase#7620
Dhruwang merged 13 commits into
epic/v5from
refactor/rename-project-to-workspace

Conversation

@Dhruwang
Copy link
Copy Markdown
Member

Summary

  • Complete rename of the Project concept to Workspace throughout the entire Formbricks codebase to align with the new domain terminology introduced in v5
  • Touches 432 files with 3,310 insertions and 12,197 deletions (net reduction due to consolidating old projects/ modules into workspaces/)
  • Build passes cleanly (all 10 turbopack tasks succeed) and pre-commit hooks (prettier, prisma format) pass

Scope of changes

Database & Schema

  • Prisma model ProjectWorkspace with all relation names updated
  • New migration 20260330000000_rename_project_to_workspace
  • Zod schemas: project-teams.tsworkspace-teams.ts, field names updated

TypeScript Types & Interfaces

  • packages/types/project.tsworkspace.ts (TProjectTWorkspace, ZProjectZWorkspace, etc.)
  • TOrganizationBillingPlanLimits.projects.workspaces
  • All entitlement, license, and billing limit keys renamed
  • Props, form field names, and component interfaces renamed across all modules

Application Code

  • All variable names, function names, and prop names (projectIdworkspaceId, setLocalProjectsetLocalWorkspace, fetchLatestProjectfetchLatestWorkspace, etc.)
  • Import paths and file renames (project-*.tsworkspace-*.ts)
  • API route paths (/project-teams/workspace-teams) and OpenAPI docs
  • React Hook Form field names ("projects""workspaces")

i18n / Locale Files

  • $[projectName]$[workspaceName] across all 13 locale files (~700 occurrences)
  • {projectLimit}{workspaceLimit} interpolation variables
  • Locale keys renamed (license_feature_projectslicense_feature_workspaces)

Tests & Documentation

  • All test files: mock data IDs ("project-123""workspace-123"), variable names, test descriptions
  • Comments and JSDoc updated throughout

Intentionally unchanged

  • Database migration files — these reference historical table names and must not be modified
  • Playwright projects config key — this is Playwright's own API, not ours

Test plan

  • Full production build passes (pnpm build — all 10 tasks)
  • Pre-commit hooks pass (prettier, prisma format)
  • Run full test suite (pnpm test)
  • Verify Prisma migration applies cleanly on a fresh database
  • Smoke test: create workspace, create survey, edit styling, copy survey across workspaces
  • Verify API key permissions with workspace access controls
  • Verify team settings modal with workspace assignments
  • Verify billing/entitlement workspace limits display correctly

🤖 Generated with Claude Code

Complete rename of the Project concept to Workspace throughout the
Formbricks codebase to align with the new domain terminology.

Changes include:
- Prisma schema: model Project → Workspace, all relation names
- TypeScript types, Zod schemas, and interfaces
- Variable names, function names, prop names, and form field names
- Import paths and file renames (project-*.ts → workspace-*.ts)
- API route paths and OpenAPI documentation strings
- Billing, entitlements, and license limit keys (projects → workspaces)
- i18n locale files: $[projectName] → $[workspaceName], keys and values
- All test files: mock data, variable names, test descriptions
- Comments and JSDoc documentation

Migration files are intentionally left unchanged as they reference
historical database table names.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 30, 2026

🚨 PR Size Warning

This PR has approximately 6943 lines of changes (3628 additions, 3315 deletions across 354 files).

Large PRs (>800 lines) are significantly harder to review and increase the chance of merge conflicts. Consider splitting this into smaller, self-contained PRs.

💡 Suggestions:

  • Split by feature or module - Break down into logical, independent pieces
  • Create a sequence of PRs - Each building on the previous one
  • Branch off PR branches - Don't wait for reviews to continue dependent work

📊 What was counted:

  • ✅ Source files, stylesheets, configuration files
  • ❌ Excluded 100 files (tests, locales, locks, generated files)

📚 Guidelines:

  • Ideal: 300-500 lines per PR
  • Warning: 500-800 lines
  • Critical: 800+ lines ⚠️

If this large PR is unavoidable (e.g., migration, dependency update, major refactor), please explain in the PR description why it couldn't be split.

Dhruwang and others added 5 commits March 30, 2026 15:08
…name

Clarified that the index "Project_organizationId_idx" was already removed in a previous migration, ensuring accurate documentation of the database schema changes related to the Project to Workspace rename.
Fixes SurveyProjectOverwrites → SurveyWorkspaceOverwrites and
ProjectConfig → WorkspaceConfig in schema.prisma comments, which
are used by prisma-json-types-generator to map typed overlays.

This resolves lint errors in js-core/widget.ts where workspaceOverwrites
was typed as error/JsonValue instead of TSurveyWorkspaceOverwrites.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Existing Organization rows store the workspace limit under
billing.limits.projects. The code now reads billing.limits.workspaces
after the rename, causing the limit to resolve to Infinity and
bypassing workspace creation enforcement.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
… table

The billing limits are stored in the OrganizationBilling table's limits
column, not as a billing column on the Organization table.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@Dhruwang Dhruwang requested a review from pandeymangg March 30, 2026 10:17
Copy link
Copy Markdown
Contributor

@pandeymangg pandeymangg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

this is on the workspaces/new page when signing up with a new user, should this be called "product"?

also AI review comments:
Image

Also, the workspace-teams v2 api route is added here which is the rename from project-teams to workspace-teams. We need to support this so this is backwards compatible, this should be added as a rewrite in the next config and some code to support transforming the older input of the api to the new input (and output as well) 🙏
Please check the backwards compatibility code that we have for the blocks -> questions transformation in the surveys apis

Dhruwang and others added 2 commits March 30, 2026 17:47
… fix stale Prisma schema comments

- Update onboarding workspace creation page label from "Product name" to
  "Workspace name" across all 14 locale files
- Fix ~8 doc comments in schema.prisma that still referenced "project"
  instead of "workspace"

Co-Authored-By: Claude Opus 4.6 <[email protected]>
… API

- Add URL rewrite in next.config.mjs: /api/v2/.../project-teams → workspace-teams
- Accept `projectId` as a legacy alias for `workspaceId` in all request
  body and query schemas (GET, POST, PUT, DELETE)
- Include `projectId` in all responses alongside `workspaceId` so
  existing integrations continue to work without changes
- Add backwards-compat.ts utility with input normalisation and output
  transformation helpers

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@Dhruwang Dhruwang force-pushed the refactor/rename-project-to-workspace branch from 66aa1da to f008ad9 Compare March 30, 2026 13:39
Dhruwang and others added 2 commits March 31, 2026 10:15
…APIs

- Accept `projectOverwrites` as legacy alias for `workspaceOverwrites`
  in survey create (POST) and update (PUT) request bodies
- Include `projectOverwrites` in all survey GET/POST/PUT responses
  so existing integrations continue to work
- Include `project` alongside `workspace` in client environment state
  response for old SDK consumers
- Add shared survey-backwards-compat.ts utility following the same
  pattern as workspace-teams backwards-compat

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…state tests

- Remove extra teamId/workspaceId fields from updateWorkspaceTeam call
  (already passed as separate args, schema only accepts permission)
- Update environmentState tests to expect backwards-compat fields
  (projectOverwrites in surveys, project alongside workspace)
- Remove stale organization field from test mock data

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@Dhruwang Dhruwang self-assigned this Mar 31, 2026
Copy link
Copy Markdown
Contributor

@pandeymangg pandeymangg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the api changes 🙏
I just a few more smaller comments:

Comment thread apps/web/app/lib/api/api-backwards-compat.ts
Comment thread apps/web/app/api/v1/management/me/route.ts
Comment thread apps/web/modules/api/v2/me/route.ts
…ponses

- Introduce a new api-backwards-compat.ts utility to handle legacy project field mappings.
- Update environment state and survey response structures to include legacy projectId and projectName fields for compatibility with old consumers.
- Refactor imports to utilize the new backwards compatibility utility across relevant API routes.
Dhruwang and others added 2 commits March 31, 2026 15:58
- Replace Array index keys with stable keys in loading skeletons
- Use optional chaining instead of && checks
- Prefer .find() over .filter()[0]
- Use Number.parseInt instead of global parseInt

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Added non-null assertion operator to guarantee otherEnvironment is defined when retrieving action classes.
@sonarqubecloud
Copy link
Copy Markdown

@Dhruwang Dhruwang merged commit a771ae1 into epic/v5 Mar 31, 2026
16 of 18 checks passed
@Dhruwang Dhruwang deleted the refactor/rename-project-to-workspace branch March 31, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants