Shipflash logoDocs

Infrastructure Boundaries

Shared infrastructure belongs in lib only when more than one feature depends on it.

On this page

Auth

Session reads, guards, RBAC helpers, profile lookup, and role checks live under lib/auth and nearby server boundaries.

Learn more

Supabase

Client creation, service-role access, generated database types, and storage helpers stay behind server-safe helpers.

Learn more

SEO

Metadata builders, schema output, canonical URLs, and public settings are grouped so public routes stay small.

Learn more

Utilities

Only broadly reused helpers such as class merging, currency, colors, dates, and serialization belong in lib utilities.

Learn more

lib folder map

FolderUse
lib/apiShared API helpers used by route handlers.
lib/auditAudit log helpers for important admin and system actions.
lib/authSession reads, route guards, RBAC, roles, and profile lookup.
lib/content-blocksShared content block rendering and parsing helpers.
lib/csv.tsSpreadsheet-safe CSV serialization and formula-injection sanitization.
lib/dashboardCross-feature admin dashboard view-model orchestration.
lib/datetimeDate and time formatting helpers.
lib/identityEmail normalization, validations, and privacy masking/redaction primitives.
lib/image-preview.tsSafe image preview protocol source validation.
lib/localizationLocale parsing, defaults, and server-safe localization helpers.
lib/navigationDashboard navigation and search metadata.
lib/observeRuntime logging and observation helpers.
lib/securityRate limits, security helpers, and request safety utilities.
lib/seoMetadata, JSON-LD, canonical URL, and structured data helpers.
lib/supabaseSupabase browser/server clients, generated types, proxy helpers, and PostgREST helpers.
lib/trackingUTM and attribution helpers.
lib/uploadsUpload media type checks and storage-related helpers.
lib/utilsSmall shared utilities such as currency, colors, and storage helpers.