albertonline.org docs
Packages

AI & content

AI chat/generation, image and video pipelines, CMS, commerce, feature flags, and analytics — the content layer shared across apps.

These packages give apps everything content- and AI-adjacent: streaming chat and structured generation, image/video pipelines, CMS-backed blog content, commerce, feature flags, and analytics — each a small typed surface wrapping a DB table, a WASM tool, or a third-party SDK.

@repo/ai

Effect v4 services for streaming AI chat (tool-aware AiChat), structured form generation (AiFormGenerator), and prompt-to-plan generation (AiPlanGenerator), plus the language-model provider layers and the SSE wire protocol shared by the web app's chat routes. Chat picks a named toolkit per request (none, weather, docs, plans, trips); the plans/trips toolkits manage the caller's kanban board and only run owner-scoped when both AgentPlanRepo and Session are present in context.

  • AiChat, AiFormGenerator, AiPlanGenerator — the core services
  • AnthropicLive, GeminiLive, GlmLiveLanguageModel provider layers (Claude, Gemini, GLM-5.2)
  • layerForModel(model) — maps "claude" | "glm" | <else> to the composed route layer
  • toSseResponse + ./protocol — the SSE streaming wire format
  • ./client — browser chat atoms (makeChatAtoms) for @effect/atom-react

@repo/images

Drizzle-backed CRUD for user-generated images and their derived 3D models, used by the web app's image/3D-model generation features. Wraps @repo/db's image and model3d tables behind small typed functions and tagged error classes; server-only.

  • getImagesByUserId, getImageById, createImage, deleteImage — image records
  • getModelsByUserId, getModelByImageId, createModel, updateModel — 3D model records
  • ImageCreateError, ImageDeleteError, ModelCreateError, ModelUpdateError — tagged errors
  • ImageRecord, NewImageRecord, Model3DRecord, ModelWithImage, NewModel3DRecord — inferred row types

@repo/media-tools

Backend-free, browser-side video tooling — an Effect v4 service wrapping @ffmpeg/ffmpeg (WebAssembly) for in-browser video editing, reusable by any browser app without a server. A cheap DOM path (probe duration/dimensions, capture a poster frame — no wasm cost) is split from a lazy WASM path (trim, transcode) that loads the ffmpeg core once and serializes operations on a one-permit TxSemaphore.

  • probeVideo (./media-metadata), capturePoster (./capture-poster) — DOM-only helpers, no wasm
  • MediaToolsService (./media-tools-service) — .trim (-c copy) and .transcode (H.264 presets)
  • TRANSCODE_PRESETS (./presets)
  • MediaLoadError, MediaExecError, MediaProbeError, MediaFileTooLarge — tagged errors (./media-errors)

@repo/seo

Thin Next.js SEO helpers: a createMetadata builder that merges page-level metadata with app-wide defaults (via defu), plus a JSON-escaping helper for safely inlining schema-dts JSON-LD structured data in a <script> tag.

  • createMetadata (metadata.ts) — merges a partial Metadata with defaults
  • escapeJsonForHtml (escape-json.ts) — escapes </script>-breaking sequences before inlining JSON-LD

@repo/cms

BaseHub-backed content client for the blog and legal pages, exposing typed fragment queries and React components for rendering BaseHub rich text. Falls back to empty results (with a one-time stderr warning) instead of throwing when BASEHUB_TOKEN is missing.

  • bloggetPosts, getLatestPost, getPost(slug) + PostMeta/Post types
  • legalgetPosts, getLatestPost, getPost(slug) + LegalPostMeta/LegalPost types
  • components/body.tsx, code-block.tsx, feed.tsx, image.tsx, toc.tsx, toolbar.tsx for rendering BaseHub rich text
  • keys.ts — the @t3-oss/env-nextjs env schema (BASEHUB_TOKEN)

@repo/commerce

Commerce domain logic — carts, orders, products, shipping, addresses — in front of Stripe, consumed by it-f-store. Pure calculation/mapping helpers (cart totals, product/cart metadata) are split from the provider-calling functions so the math is unit-testable without a live Stripe context.

  • cartGet, cartCreate, cartAdd, cartAddOptimistic, cartChangeQuantity, cartSetQuantity, cartCount — cart operations
  • cartSaveBillingAddress, cartSaveShipping, cartSaveTax — cart metadata
  • calculateCartTotalNetWithoutShipping, calculateCartTotalPossiblyWithTax — pure total calculations
  • productBrowse, productGet, productGetById, productGetVariants — product catalog
  • orderGet, accountGet, fileGet, shippingBrowse, getAddressSchemaEffect, provider — orders, account, shipping, address schema, and the configured commerce provider
  • ./currencies — currency helpers as a separate entry point

@repo/feature-flags

A flags (Vercel) SDK wrapper (createFlag) providing typed, named feature flags, plus a Vercel Toolbar integration for toggling them in-browser during development.

  • showBetaFeature, showAiFormGenerator, showAiV2, show3DModelGeneration, showAiFeatures — the flags defined at the root entry point
  • getFlags (./access) — reads flag state from a NextRequest
  • Toolbar (./ui) — the Vercel Toolbar overlay component
  • createFlag (./lib/create-flag) — the underlying flag factory

@repo/memory

Removed. @repo/memory was a small supermemory-backed KV/client wrapper with zero consumers anywhere in the workspace, and was deleted wholesale in a dead-code sweep — it no longer exists under packages/.

@repo/memory is listed here only because it still names this group; there is nothing left to import.

@repo/analytics

PostHog wrapper shared by every app for client and server analytics, plus EU/US region-aware ingest-rewrite config Next.js uses to proxy PostHog calls through the app's own domain.

  • analytics (root, client) — the posthog-js instance
  • analytics, captureServerEvent, captureServerException, flushServerAnalytics, setServerAnalyticsAppName, withAppProperty (./server) — the server-side posthog-node client
  • AnalyticsProvider (./provider) — client provider component
  • initializeAnalytics (./instrumentation-client) — client bootstrap for Next.js instrumentation
  • Region, resolveRegion, posthogUiHost, posthogIngestRewrites (./region) — EU/US region resolution and reverse-proxy rewrites

See the packages overview and the architecture guide.

On this page