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
Sponsored
orbit.dopler.app
Sponsored
orbit.dopler.app
Sponsored
Aveiro
aveiro.app
TrademarkTrademark
OrbitSupa Social by Dopler
© Dopler. All rights reserved.
Built with Aveiro

Shared Packages

Deep dive into the nine shared packages that power the Supa Hub monorepo.
Updated 11d ago
Architecture Overview
All shared packages live under packages/ and are referenced by apps via workspace:* in their package.json.

api-handlers

@supa-hub/api-handlers — The largest shared package. Contains all business logic for API routes, organized into three directories:
Directory
Handlers
src/admin/getDeletedPosts, getHiddenPosts, getSuspendedPosts, getDeletedSpaces, getHiddenSpaces, getSuspendedSpaces, getRoles, getSiteConfig, updateSiteConfig, getUsers, updateUserRole
src/hub/getSpaces, createSpace, updateSpace, getPost, createPost, updatePost, getComments, createComment, updateComment, deleteComment, getReactions, toggleReaction, toggleCommentReaction, getMemberships, createMembership, updateMembership, deleteMembership, getForYouPosts, getGlobalPosts, getSpacePosts, trackView, uploadFile, followUser, unfollowUser, getFollowStatus, getUserStats, getFollowers, getFollowing
src/other/getProfile, updateProfile, getRules, updateRules, getNotifications, markNotificationsRead, streamNotifications, getUnreadCount, getLeaderboard, handleFeed, fetchOG, proxyOG, getPublicProfile, searchPublicProfiles, searchUsers, getLegalDocs, updateLegalDocs, getContent, updateContent
Every handler receives a NextRequest and returns a NextResponse. API routes in the apps are thin one-line wrappers. All mutation handlers authenticate via authenticateRequest() which validates the session cookie and returns { id, slug, roleRank }.

sb

@supa-hub/sb — Supabase client factory. Provides four entry points:
Export
Purpose
client.tsBrowser-side Supabase client (uses anon key + cookie-based auth)
server.tsServer-side client for reading auth state from cookies
admin.tsService-role client that bypasses RLS (used by api-handlers)
middleware.tsSession refresh helper used in Next.js middleware
The server-entry.ts re-exports both createServerClient and createAdminClient for convenience.

configs

@supa-hub/configs — Shared validation rules and feed configuration. Validation rules (validation.js):
Field
Min
Max
Username320
Handle320
Bio—250
Space name520
Space handle520
Space description20250
Post title5200
Post content02500
Carousel images110
Hot ranking config (hotConfig):
  • wReacts: 3 — weight for reactions
  • wViews: 1 — weight for views
  • halfLifeHours: 72 — 3-day decay

feed

@supa-hub/feed — Implements the hot-ranking algorithm used by the "For You" and global feeds. Computes a score based on reactions, views, and time decay using the weights from configs.

providers

@supa-hub/providers — React context providers:
  • useUser() — Returns { slug, roleRank, roleId, loading, profile } for the current authenticated user
  • Wraps Supabase auth state and profile fetching

hooks

@supa-hub/hooks — Shared React hooks used across apps:
  • useMentions() — @mention autocomplete for comment inputs
  • useNotifications() — Notification fetching, realtime updates, mark-as-read, infinite scroll
  • useFollow() — Optimistic follow/unfollow toggle with rollback

components

@supa-hub/components — Shared React components used by both hub and auth apps:
  • PostCard / PostCardSkeleton — Post display in feeds
  • Feed — Paginated post list
  • ProfileWidget — Lazy-loading user hover card with follow button
  • SpaceWidget — Lazy-loading space hover card with join button
  • Comment / Comments — Threaded comment system with reactions and mentions
  • NotificationItem / NotificationList — Notification UI with infinite scroll
  • SafeMDX — Secure MDX rendering (blocks JS execution)
  • MentionSuggestions — Autocomplete dropdown for @mentions
  • Table — Data table component

types

@supa-hub/types — Shared TypeScript type definitions for posts, notifications, and other data models.

utils

@supa-hub/utils — General utilities:
  • time — Relative date formatting (formatShortRelativeTime)
  • renderMentions — Converts @[name](slug) patterns to clickable links