Overview
Terra’s workspace system lets you organize forms into logical groups—by program, department, or any structure that fits your workflow. Each workspace can have its own custom domain, branding, and analytics configuration.Workspaces are organization-wide. All team members see the same workspace structure.
Creating Folders
- Navigate to the Forms page
- Click the + button in the folder sidebar
- Enter a folder name (e.g., “Housing Connector”)
- Choose a color for visual identification
- Click Create Folder

Moving Forms to Folders
Drag and Drop
The fastest way to organize forms:- Hover over a form row to reveal the drag handle (⋮⋮)
- Drag the form to the target folder in the sidebar
- Drop to complete the move
Bulk Organization
For large-scale reorganization, consider:- Creating folders first based on your program structure
- Filtering by “Uncategorized” to see unorganized forms
- Dragging related forms to their folders in batches
Folder Views
All Forms
Shows every form in your workspace regardless of folder. Use this view to see your complete form inventory.Uncategorized
Forms that haven’t been assigned to any folder. New forms start here by default.Custom Folders
Click any folder to filter the view to only forms in that folder. The form count badge updates in real-time.Managing Folders
Rename a Folder
- Hover over the folder in the sidebar
- Click the ⋯ menu
- Select Rename
- Update the name and/or color
- Click Save Changes
Delete a Folder
- Hover over the folder in the sidebar
- Click the ⋯ menu
- Select Delete
- Confirm deletion
Folder Colors
Choose from 8 colors to visually distinguish folders:| Color | Hex | Suggested Use |
|---|---|---|
| Indigo | #6366F1 | Default / General |
| Blue | #3B82F6 | Active programs |
| Emerald | #10B981 | Approved / Complete |
| Amber | #F59E0B | Needs attention |
| Rose | #F43F5E | Urgent / Priority |
| Purple | #A855F7 | Special programs |
| Slate | #64748B | Archive / Inactive |
| Cyan | #06B6D4 | Pilot programs |
Best Practices
Organize by Program
Organize by Program
Create one folder per program (e.g., “Housing Connector”, “Emergency Rental Assistance”, “Utility Assistance”). This maps to how most government teams think about their work.
Use Consistent Naming
Use Consistent Naming
Establish naming conventions early. Consider prefixes like department codes (e.g., “HSD - Housing”, “HSD - Utilities”) for large organizations.
Archive Inactive Programs
Archive Inactive Programs
Create an “Archive” or “Inactive” folder for programs that are no longer accepting applications but need to be preserved for record-keeping.
Limit Folder Depth
Limit Folder Depth
Terra uses a flat folder structure (no nested folders) intentionally. This keeps navigation simple and prevents organizational complexity.
Custom Code Injection
Workspaces support custom code injection for analytics, support widgets, and other third-party integrations. Code added to a workspace is automatically injected into all public form pages within that workspace.Use Cases
| Integration | Injection Point | Example |
|---|---|---|
| Fathom Analytics | Head | <script src="https://cdn.usefathom.com/script.js" data-site="XXXXX" defer></script> |
| Google Analytics | Head | GA4 script tag |
| Intercom | Body | Intercom messenger widget |
| Crisp Chat | Body | Crisp chat widget |
| Custom meta tags | Head | OG tags, viewport settings |
Configuration
- Navigate to the Forms page
- Click on a workspace in the sidebar
- Scroll to the Custom Code section in the workspace settings panel
- Add code to the appropriate field:
- Head Code: Injected into
<head>— use for analytics, meta tags, preload scripts - Body Code: Injected before
</body>— use for chat widgets, scripts needing DOM access
- Head Code: Injected into
- Click Save Custom Code
Script Loading Strategies
Terra uses Next.js Script component with optimized loading strategies:| Injection Point | Strategy | When it Loads |
|---|---|---|
| Head Code | afterInteractive | After page becomes interactive |
| Body Code | lazyOnload | After all resources loaded |
Example: Fathom Analytics
Example: Intercom Widget
Technical Reference
Database Schema
Server Actions
| Action | Description | Parameters |
|---|---|---|
getWorkspaces() | Fetch all workspaces with form counts | — |
createWorkspace(name, color) | Create a new workspace | name: string, color?: string |
updateWorkspace(id, updates) | Update workspace settings | id: string, updates: { name?, color?, custom_head_code?, custom_body_code?, root_redirect? } |
deleteWorkspace(id) | Delete workspace (unlinks forms) | id: string |
moveFormToWorkspace(formId, workspaceId) | Move form to workspace | formId: string, workspaceId: string | null |
getWorkspaceCustomCode(workspaceId) | Fetch custom code for a workspace | workspaceId: string |
Component Architecture
Drag and Drop
Terra uses@dnd-kit/core for drag-and-drop:
- Draggable: Form rows in the table (
useDraggable) - Droppable: Folder items in the sidebar (
useDroppable) - Sensors: Mouse (8px activation) and Touch (200ms delay)
Troubleshooting
Drag handle not visible
Drag handle not visible
The drag handle appears on hover. Ensure you’re hovering over the form row, not just the form name link.
Form count not updating
Form count not updating
Folder counts update optimistically. If counts seem wrong, refresh the page to sync with the database.
Can't delete folder
Can't delete folder
Ensure you have appropriate permissions. The delete action unlinks all forms first, which requires write access to the forms table.