Modules
Self-contained feature units that keep domain logic isolated, organized, and removable.
Read this when you're adding a new feature, removing an existing one, or understanding how domain code is organized.
Useful for developers working on feature-specific functionality.
What Are Modules?
Modules are self-contained feature packages. Each module owns its components, hooks, services, types, and even database migrations. This isolation means you can add, modify, or remove a feature without touching unrelated code.
Unlike surfaces (which separate UI by audience) or platform (which provides shared capabilities), modules encapsulate domain logic — the specific features that make your application unique.
Why This Matters
Modules solve common problems in growing codebases:
Clear boundaries
No accidental coupling. Modules can't import from other modules, preventing the tangled dependencies that slow teams down.
Everything in one place
Co-located code. Components, hooks, services, and migrations live together. Find what you need without hunting across folders.
Clean removal
Delete the folder, run cleanup SQL. Modules include their own removal scripts. No orphaned code, no broken imports.
Available Modules
Catalyst includes these production-ready modules:
Activity
Activity feeds and notifications. Track user actions, broadcast updates via Supabase realtime.
AI
AI provider management and chatbot. Multi-provider support with Vercel AI SDK.
CRM
Contact and deal management. Full CRUD with notes, status tracking, and activity integration.
Diagrams
Canvas-based diagram editor. Create flow diagrams with nodes, connections, and AI-assisted generation.
Feedback
User feedback collection and management. Drawer widget, element selection, admin triage.
Projects
Project tracking with tasks and milestones. Integrated with Activity for notes and audit trails.
Module Structure
modules/
├── MODULES.md # Architecture docs
└── <module>/
├── MODULE-<NAME>.md # Module-specific docs (e.g., MODULE-CRM.md)
├── index.ts # Public API
├── components/ # UI components
├── hooks/ # React hooks
├── services/ # Business logic
├── server/ # Server-only code
├── types/ # TypeScript types
├── constants.ts # Module constants
└── supabase/
├── migrations/ # Database migrations
├── seeders/ # Test data
└── cleanup.sql # Removal scriptImport Rules
Allowed
modules/*→components/*modules/*→lib/*modules/*→ same moduleapp/*→modules/*(via public API)
Forbidden
modules/*→ othermodules/*- Client components →
server/* - External → module internals
Always import from the module's index.ts, never reach into internal files directly.
Modules are meant to be removed. The isolation isn't just for organization — it's so you can delete a feature cleanly when requirements change. Each module includes a cleanup.sql script that removes its database objects.
Adding & Removing Modules
Adding a Module
- Create
modules/your-module/ - Add MODULE-NAME.md with documentation
- Create index.ts with public exports
- Add components, hooks, services
- Create migrations if using database
Removing a Module
- Run
supabase/cleanup.sql - Delete the module directory
- Remove any app routes that import it
- Update navigation if needed
Next Steps
Explore the available modules: