Modules
HeartCo Starter ships with a modular architecture. Each module can be enabled/disabled via the
NEXT_PUBLIC_TIERenvironment variable.
Module overview
| Module | Description | Tier | Status | Router | Key models |
|---|---|---|---|---|---|
| Core (auth) | Authentication, sessions, OAuth | All | core | auth.ts | User, Account, Session |
| Core (RBAC) | Role-based access control, permission matrix | All | core | permissions.ts | Role, Permission |
| Core (billing) | Stripe subscriptions, freemium limits | All | core | freemium.ts | Subscription, Plan |
| Core (multi-tenant) | Organizations, teams, invites | All | core | organization.ts | Organization, Team |
| Core (notifications) | In-app + push notifications | All | core | notifications.ts | Notification |
| Core (email) | Transactional emails via Resend | All | core | admin-email.ts | EmailTemplate |
| Core (onboarding) | User onboarding flow | All | core | onboarding.ts | OnboardingProgress |
| CRM | Contacts, deals, Kanban pipeline | Pro+ | example | crm.ts | Contact, Deal, Pipeline |
| Invoicing | Quotes, invoices, payments, credit notes | Pro+ | example | facturation.ts, devis.ts | Invoice, Quote, Payment |
| AI Content | Social media content generation | Pro+ | example | social-content.ts | AiContent, SocialPost |
| Copilot | AI assistant (chatbot + business copilot) | Pro+ | example | copilote.ts | ChatbotConversation |
| HR | Employee profiles, contracts, leaves, timesheets | Pro+ | example | rh.ts, employee-profiles.ts | EmployeeProfile, LeaveRequest |
| Projects | Project management, tasks, work orders | Pro+ | example | projets.ts | Project, WorkOrder |
| Calendar | Events, appointments, sync | Pro+ | example | calendars.ts | CalendarEvent, Appointment |
| Chat | Internal messaging, conversations | Pro+ | example | conversations.ts | Conversation, Message |
| Marketing | Campaigns, sequences, email marketing | Pro+ | example | marketing.ts | Campaign, Sequence |
| Analytics | Dashboard KPIs, stats | Pro+ | example | analytics.ts | — |
| Stock | Inventory management | Pro+ | example | stock.ts | StockItem, StockMovement |
| Blog | CMS with AI generation | Pro+ | example | blog.ts | BlogArticle, BlogCategory |
| E-Invoicing | Factur-X / Iopole integration | Pro+ | example | facturx.ts, iopole.ts | IopoleLog |
| Bank | Bridge API banking integration | Pro+ | example | bank.ts | BankTransaction |
| Tickets | Customer support tickets | Pro+ | example | tickets.ts | Ticket |
| Portal | Client portal, document sharing | Pro+ | example | portal.ts | Portal, PortalDocument |
| Marketplace | Add-on marketplace | Pro+ | example | marketplace.ts | MarketplaceAddon |
| Automation | Workflow automation engine | Pro+ | example | automation.ts | Automation |
| Realtime | Pusher-based real-time notifications | Pro+ | example | — | — |
| Mobile | Expo app, offline-first, push | Pro+ | example | push-tokens.ts | PushToken |
| Reporting | Report generation with templates | Pro+ | example | reports.ts | Report, ReportTemplate |
| Signatures | Electronic signatures | Pro+ | example | signatures.ts | Signature |
| _template | Module scaffold for new modules | All | template | router.ts | — |
How to enable/disable modules
Configuration
Module activation is controlled by the NEXT_PUBLIC_TIER environment variable.
File: src/lib/config/tiers.ts
// src/lib/config/tiers.ts
export const TIER_CONFIG = {
starter: { crm: false, invoicing: false, hr: false, ... },
pro: { crm: true, invoicing: true, hr: false, ... },
team: { crm: true, invoicing: true, hr: true, ... },
};
export const activeTierModules = TIER_CONFIG[process.env.NEXT_PUBLIC_TIER || 'starter'];Environment setup
In your .env.local:
NEXT_PUBLIC_TIER=pro # or 'starter', 'team'At build/runtime, only routers and Prisma models for enabled modules are imported.
How to add a new module
See Adding a module for a step-by-step guide.
Minimal checklist:
- Create
src/server/api/routers/<module-name>.ts - Register in
src/server/api/root.ts - Add models to
prisma/schema.prisma(withorganizationId) - Add tier config to
src/lib/config/tiers.ts - Add to permission matrix (
src/lib/permissions/matrix.ts) - Create components in
src/components/<module-name>/
Module ideas you can build
- Inventory & Warehouse — Stock levels, bins, transfers, barcodes
- Booking & Appointments — Calendars, availability, auto-confirmation
- Helpdesk & KB — Support tickets, knowledge articles, FAQs
- E-commerce — Products, cart, checkout, order tracking
- Learning Management (LMS) — Courses, lessons, certifications, quizzes
- Fleet Management — Vehicles, routes, fuel, maintenance logs
- Property Management — Tenants, leases, maintenance requests, billing
- Document Management — File storage, versioning, permissions