Platform
Shared infrastructure that powers your entire application — authentication, configuration, database access, and file storage.
Read this when you need to understand how cross-cutting functionality works in Catalyst.
Useful for developers building features that span multiple surfaces or modules.
What is Platform?
Platform is the shared foundation your app runs on. It provides infrastructure that works the same way regardless of which surface or module uses it — sign in once, access files anywhere, configure features in one place.
Platform code lives in lib/ and provides consistent APIs across your entire application. When you need to check if a user is logged in, upload a file, or read configuration — platform handles it.
Why This Matters
Platform capabilities solve problems that appear everywhere:
Single source of truth
Authentication happens once. Every surface and module uses the same auth system — no duplication, no drift.
Consistent behavior
Same API, everywhere. Whether you're in the App surface or a module, data access patterns work identically.
Easy to update
Change in one place. Update a platform capability and every surface and module benefits immediately.
How Platform Relates to Other Layers
Understanding the layers helps you know where to put code:
Surfaces
Different UIs for different audiences (Web, App, Docs)
Pages, layouts, surface-specific components
Modules
Self-contained domain features
CRM contacts, activity feeds, diagrams
Platform
Shared infrastructure used by surfaces and modules
Auth, config, database, file storage
Packages
Third-party dependencies
Next.js, Tailwind, Supabase, shadcn/ui
Platform Capabilities
What the platform layer provides:
Authentication
Multi-mode auth with demo, password, and Supabase options. Session management and protected routes.
Configuration
Centralized config in lib/config.ts. Feature flags, app metadata, and environment variables.
Database
Supabase integration with client factories, CRUD utilities, and repository pattern for data access.
Storage
Provider-agnostic file storage. Upload files, generate signed URLs, validate uploads.
Platform makes AI agents effective. When an AI needs to add a feature that requires authentication or data access, it doesn't have to figure out patterns from scratch. Platform provides documented, consistent APIs that agents can use immediately.
File Location
All platform code lives in lib/. Each major capability has its own folder with a LIB-*.md documentation file — check there for detailed API reference and examples.
Next Steps
Explore specific platform capabilities: