Orbit Docs
Get Started
Deployment
Architecture
Architecture Overview
Shared Packages
Database
Database Schema
Triggers & Functions
Features
Spaces
Posts
Comments
Follows
Notifications
Feeds
Roles
Roles & Permissions
Api
Admin Api
Users
Roles
Site Configuration
Content Moderation โ€” Posts
Content Moderation โ€” Spaces
Hub Api
Spaces
Posts
Comments
Reactions
Memberships
Follows
Feeds
Uploads
Views
Other Api
Profile
Public Profiles
Notifications
Leaderboard
About
OG Metadata
User Search
Sponsored
Aveiro
aveiro.app
TrademarkTrademark
Ctrl k
Search...
Sign up
Orbit Docs
Get Started
Deployment
Architecture
Architecture Overview
Shared Packages
Database
Database Schema
Triggers & Functions
Features
Spaces
Posts
Comments
Follows
Notifications
Feeds
Roles
Roles & Permissions
Api
Admin Api
Users
Roles
Site Configuration
Content Moderation โ€” Posts
Content Moderation โ€” Spaces
Hub Api
Spaces
Posts
Comments
Reactions
Memberships
Follows
Feeds
Uploads
Views
Other Api
Profile
Public Profiles
Notifications
Leaderboard
About
OG Metadata
User Search

Database Schema

All tables, enums, and relationships in the Supa Hub database.
Updated 11d ago
Triggers & Functions
Sponsored
orbit.dopler.app
Sponsored
orbit.dopler.app
Sponsored
Aveiro
aveiro.app
TrademarkTrademark
OrbitSupa Social by Dopler
ยฉ Dopler. All rights reserved.
Built with Aveiro
The entire schema is defined in setup.sql at the repository root. It is idempotent and safe to run multiple times.

Enums

Enum
Values
hub_post_status_enumvisible, hidden, suspended, deleted
hub_space_status_enumvisible, hidden, suspended, deleted
hub_attachment_type_enumimage, youtube, link, carousel
hub_aspect_ratio_enum16/9, 1/1, 3/4
hub_space_role_enumadmin, moderator, member, guest, suspended, banned
notification_typecomment_on_post, reply, milestone, space_role, mention, new_follower, follower_post

Auth Tables

profiles

Linked 1:1 with Supabase auth.users. Auto-created on signup via trigger.
Column
Type
Notes
iduuid PKReferences auth.users(id)
usernametext UNIQUEDisplay name
full_nametextFrom OAuth provider
avatar_urltextProfile picture URL
biotextShort bio (max 250 chars)
slugtext UNIQUEURL handle (e.g. /u/john)
cover_urltextProfile cover image
sitesjsonbArray of social links
created_attimestamptz

roles

Global role definitions with numeric ranks.
Column
Type
Notes
idtext PKRole name
rankintNumeric rank for permission checks
descriptiontextHuman-readable description
Seed data:
id
rank
description
admin100Site administrator
moderator80Content moderation
member50Regular user
suspended20Signed-in but limited
banned0No access

user_global_roles

Maps users to their global role. One role per user.
Column
Type
Notes
user_iduuid PKReferences auth.users(id)
role_idtextReferences roles(id)
assigned_attimestamptz

Hub Tables

hub_spaces

Community spaces that contain posts.
Column
Type
Notes
iduuid PK
creator_iduuidReferences profiles(id)
slugtext UNIQUEURL handle, case-insensitive unique index
nametextDisplay name
descriptiontext
covertextCover image URL
avatartextSpace avatar URL
statushub_space_status_enumDefault visible
accessintegerMinimum rank to view (0 = public)
created_attimestamptz

hub_space_members

Space membership with per-space roles.
Column
Type
Notes
space_iduuidPK (composite)
user_iduuidPK (composite)
role_idhub_space_role_enumDefault member

hub_posts

Posts within spaces. Slugs are auto-generated from titles via a trigger.
Column
Type
Notes
iduuid PK
space_iduuidReferences hub_spaces(id)
author_iduuidReferences profiles(id)
slugtext UNIQUEAuto-generated, case-insensitive
titletext
contenttext
attachment_typehub_attachment_type_enumNullable
attachment_urltextPrimary attachment URL
attachment_alttextAlt text for images
attachment_aspect_ratiohub_aspect_ratio_enum
attachment_urlstext[]Carousel image URLs (max 10)
viewsintegerDefault 0, non-negative constraint
pinnedbooleanDefault false
statushub_post_status_enumDefault visible
accessintegerMinimum rank to view
tagstext[]
created_attimestamptz
updated_attimestamptz

hub_post_reactions

Emoji reactions on posts. One reaction per user per post โ€” the PRIMARY KEY (post_id, user_id) enforces this constraint. The emoji must be one of the site-configured reaction emojis (stored in hub_site_config under the reaction_emojis key).
Column
Type
Notes
post_iduuid PKReferences hub_posts(id)
user_iduuid PKReferences profiles(id)
emojitextMust be in the configured reaction set (default: ๐Ÿ‘ โค๏ธ ๐Ÿ˜‚ ๐Ÿ˜ฎ ๐Ÿ˜ข)
created_attimestamptz

hub_comments

Threaded comments on posts. Supports replies via reply_to_comment_id.
Column
Type
Notes
iduuid PK
post_iduuid
contenttext
user_iduuid
reply_to_comment_iduuidNullable, self-referencing
visibilitybooleanSoft-delete flag
created_attimestamptz
updated_attimestamptz

hub_comment_reactions

Heart reactions on comments. One per user per comment.
Column
Type
Notes
iduuid PK
comment_iduuid
user_iduuid
typetextCurrently heart
created_attimestamptz

hub_comment_mentions

Tracks @mentions in comments. Auto-populated by a trigger that parses comment content.
Column
Type
Notes
iduuid PK
comment_iduuid
mentioned_user_iduuid
created_attimestamptz

hub_user_follows

User-to-user follow relationships. Powers follower counts, profile widgets, and follow notifications.
Column
Type
Notes
follower_iduuidPK (composite). References profiles(id)
following_iduuidPK (composite). References profiles(id)
created_attimestamptz
A self-follow constraint (follower_id <> following_id) prevents users from following themselves. Indexes on both columns for efficient lookups. RLS enabled with read-only access for authenticated users.

Configuration Tables

hub_site_rules

Singleton table storing site-wide markdown rules.
Column
Type
Notes
idboolean PKAlways true (singleton)
markdowntextMarkdown content

hub_site_config

Key-value store for global site settings. Extensible.
Column
Type
Notes
keytext PKConfig key name
valuejsonbConfig value
updated_attimestamptz
Current keys:
Key
Default
Description
space_creation_min_rank80Minimum role rank to create spaces

Notification Tables

hub_notifications

Base notification events.
Column
Type
Notes
iduuid PK
typenotification_type
actor_iduuidUser who triggered the notification
resource_typetextpost, comment, space, profile
resource_iduuid
contextjsonbExtra data (slugs, titles, etc.)
created_attimestamptz

hub_notification_recipients

Maps notifications to recipient users.
Column
Type
Notes
notification_iduuid
user_iduuid
read_attimestamptzNull until read
delivered_attimestamptz

hub_post_milestones

Tracks which view/reaction milestones have been achieved per post to avoid duplicate notifications.
Column
Type
Notes
post_iduuidPK (composite)
milestone_typetextviews or reactions
milestone_valueintegerPK (composite)
achieved_attimestamptz

Row Level Security

All auth tables (profiles, roles, user_global_roles) have RLS enabled with no policies, meaning only the service role client can access them. All data access goes through the API handlers using the admin client. The hub_user_follows table has RLS enabled with read-only access for authenticated users โ€” mutations are handled exclusively through API routes.