Skip to content

πŸ“‚ Spaces

Spaces are Curiositi’s organizational system. They work like folders, letting you group files into logical hierarchies.

Spaces provide hierarchical organization for your files:

  • Support unlimited nesting depth via parentSpaceId
  • Allow files to exist in multiple spaces (many-to-many via filesInSpace table)
  • Scoped to a workspace β€” each space belongs to one workspace
  • Work naturally with semantic search

Create nested structures to organize your content:

Workspace
β”œβ”€β”€ Marketing
β”‚ β”œβ”€β”€ Campaigns
β”‚ β”‚ β”œβ”€β”€ Q1-2025
β”‚ β”‚ └── Q2-2025
β”‚ └── Brand Assets
β”œβ”€β”€ Engineering
β”‚ β”œβ”€β”€ Documentation
β”‚ └── Architecture
└── Finance
β”œβ”€β”€ Reports
└── Contracts

Each space has the following fields (from the database schema):

PropertyTypeDescription
idUUIDUnique identifier (auto-generated)
nametextDisplay name (required)
descriptiontextOptional description
icontextOptional icon (e.g., emoji)
organizationIdtextOwning workspace (required)
parentSpaceIdUUID / nullParent space for nesting
createdAttimestampCreation time
updatedAttimestampLast update time

All space operations use tRPC procedures. Here are the available operations:

// Get all spaces in the current workspace
const allSpaces = trpc.space.get.useQuery();
// Get only root-level spaces (no parent)
const rootSpaces = trpc.space.getRoot.useQuery();
// Get child spaces of a specific space
const children = trpc.space.getChildren.useQuery({
parentSpaceId: "parent-uuid",
});
// Get space by ID
const space = trpc.space.getById.useQuery({ spaceId: "space-uuid" });
// Get space with its full ancestry chain (breadcrumbs)
const spaceWithPath = trpc.space.getWithAncestry.useQuery({
spaceId: "space-uuid",
});
const createMutation = trpc.space.create.useMutation();
// Create a root-level space
await createMutation.mutateAsync({
name: "Marketing",
description: "Marketing team files",
icon: "πŸ“",
});
// Create a nested space
await createMutation.mutateAsync({
name: "Campaigns",
parentSpaceId: "marketing-space-uuid",
});
const updateMutation = trpc.space.update.useMutation();
await updateMutation.mutateAsync({
spaceId: "space-uuid",
input: {
name: "Marketing & Sales",
description: "Updated description",
icon: "πŸ“Š",
},
});
const deleteMutation = trpc.space.delete.useMutation();
await deleteMutation.mutateAsync({ spaceId: "space-uuid" });
// Child spaces are cascade-deleted
// Get files linked to a space
const files = trpc.space.getFiles.useQuery({ spaceId: "space-uuid" });
// Alternative: get files via the filesInSpace junction table
const filesInSpace = trpc.space.getFilesInSpace.useQuery({
spaceId: "space-uuid",
});

Files are linked to spaces through the filesInSpace junction table. This means:

  • A file can exist in multiple spaces without duplication
  • Removing a file from a space doesn’t delete the file itself
  • Deleting a space cascade-deletes the filesInSpace links (but not the files)

3-4 levels of nesting is usually sufficient. AI search reduces the need for deep folder hierarchies.

By Department:

Workspace
β”œβ”€β”€ Marketing
β”œβ”€β”€ Engineering
β”œβ”€β”€ Sales
└── Finance

By Project:

Workspace
β”œβ”€β”€ Active Projects
β”‚ β”œβ”€β”€ Project Alpha
β”‚ └── Project Beta
└── Archive
└── 2024 Projects

By Time Period:

Workspace
β”œβ”€β”€ 2025
β”‚ β”œβ”€β”€ Q1
β”‚ └── Q2
└── 2024
  1. Use consistent naming β€” Pick a convention and stick to it
  2. Don’t over-organize β€” Semantic search makes files findable regardless of location
  3. Use descriptions β€” Add descriptions to spaces so team members understand their purpose
  4. Leverage nesting β€” Use parentSpaceId for natural hierarchies