CloudSyncPro’s Postgres database is hosted on Supabase and consists of nine tables covering user profiles, workspaces, file storage, sharing, activity, and notifications. Types are generated from the live schema usingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/S4nti4goCoder/cloudsyncpro/llms.txt
Use this file to discover all available pages before exploring further.
npm run gen:types and stored in src/types/databaseTypes.ts. Each table is described below with its columns, types, and notable constraints.
Row-level security (RLS) is enabled on all tables. Every query made with the
anonymous key is automatically scoped to the authenticated user by the
policies defined in Supabase. Server-side operations (Edge Functions) use the
SUPABASE_SERVICE_ROLE_KEY to bypass RLS when necessary.Enums
| Enum | Values | Used on |
|---|---|---|
user_role | superadmin, admin, editor, viewer | profiles.role, workspace_members.role, file_shares.shared_role |
file_status | active, archived, deleted | files.status, folders.status |
share_type | user, role, public | file_shares.share_type |
permission_type | view, edit, delete, share | file_shares.permissions |
Tables
profiles
profiles
Extends Supabase Auth users with display information and a platform-wide role. A row is created automatically when a user signs up.
| Column | Type | Notes |
|---|---|---|
id | uuid | Primary key; matches auth.users.id |
email | text | User’s email address |
full_name | text | null | Display name |
avatar_url | text | null | R2 URL of the profile picture |
role | user_role | Platform-wide role; defaults to viewer |
created_at | timestamptz | Row creation timestamp |
updated_at | timestamptz | Last update timestamp |
workspaces
workspaces
A workspace is the top-level container for files, folders, members, and activity. Each workspace has one owner and can have many members with different roles.
| Column | Type | Notes |
|---|---|---|
id | uuid | Primary key |
name | text | Display name of the workspace |
description | text | null | Optional description |
slug | text | URL-safe unique identifier |
owner_id | uuid | FK → profiles.id |
created_at | timestamptz | Row creation timestamp |
updated_at | timestamptz | Last update timestamp |
workspace_members
workspace_members
Join table between workspaces and users. Determines what actions a member can perform within a given workspace.
| Column | Type | Notes |
|---|---|---|
id | uuid | Primary key |
workspace_id | uuid | FK → workspaces.id |
user_id | uuid | FK → profiles.id |
role | user_role | Member’s role in this workspace |
invited_by | uuid | null | FK → profiles.id; null for the owner |
joined_at | timestamptz | Timestamp of when the member joined |
files
files
Stores metadata for every uploaded file. The binary content lives in Cloudflare R2, referenced by
r2_key.| Column | Type | Notes |
|---|---|---|
id | uuid | Primary key |
name | text | Sanitized file name used in the UI |
original_name | text | Original filename at upload time |
workspace_id | uuid | FK → workspaces.id |
folder_id | uuid | null | FK → folders.id; null means workspace root |
uploaded_by | uuid | FK → profiles.id |
size | int8 | File size in bytes |
mime_type | text | MIME type (e.g., image/png) |
extension | text | File extension without the dot |
r2_key | text | Object key in the R2 bucket |
status | file_status | active, archived, or deleted |
version | int4 | Increments on each new version upload |
metadata | jsonb | Arbitrary extra metadata |
created_at | timestamptz | Row creation timestamp |
updated_at | timestamptz | Last update timestamp |
folders
folders
Represents a hierarchical folder within a workspace. Self-referencing via
parent_id to support arbitrary nesting depth.| Column | Type | Notes |
|---|---|---|
id | uuid | Primary key |
name | text | Display name of the folder |
workspace_id | uuid | FK → workspaces.id |
parent_id | uuid | null | FK → folders.id; null means workspace root |
created_by | uuid | FK → profiles.id |
status | file_status | active, archived, or deleted |
metadata | jsonb | Arbitrary extra metadata (e.g., color) |
created_at | timestamptz | Row creation timestamp |
updated_at | timestamptz | Last update timestamp |
file_shares
file_shares
favorites
favorites
Tracks which files or folders a user has marked as a favorite within a workspace.
| Column | Type | Notes |
|---|---|---|
id | uuid | Primary key |
resource_id | uuid | ID of the favorited file or folder |
resource_type | text | file or folder |
user_id | uuid | FK → profiles.id |
workspace_id | uuid | FK → workspaces.id |
created_at | timestamptz | Timestamp when the favorite was added |
activity_logs
activity_logs
Append-only audit log of user actions within a workspace. Supports filtering by action type, date range, and user in the activity timeline UI.
| Column | Type | Notes |
|---|---|---|
id | uuid | Primary key |
workspace_id | uuid | FK → workspaces.id |
user_id | uuid | null | FK → profiles.id; null for system actions |
action | activity_action | Enum of tracked actions (upload, delete, share, etc.) |
resource_type | text | null | file, folder, or other resource type |
resource_id | uuid | null | ID of the affected resource |
resource_name | text | null | Display name of the resource at the time of the action |
metadata | jsonb | Additional context (e.g., file size, mime type) |
ip_address | text | null | IP address of the client |
created_at | timestamptz | Timestamp of the action |
notifications
notifications
Stores in-app notifications delivered to users via Supabase Realtime. Clients subscribe to inserts on this table to receive push notifications without polling.
| Column | Type | Notes |
|---|---|---|
id | uuid | Primary key |
user_id | uuid | FK → profiles.id |
title | text | Short notification heading |
message | text | Notification body text |
type | text | Notification category (e.g., share, mention) |
resource_id | uuid | null | ID of the related resource |
resource_type | text | null | Type of the related resource |
is_read | boolean | Whether the user has read the notification |
created_at | timestamptz | Timestamp when the notification was created |