Services Overview

98 service files in backend/src/services/ with matching interfaces in backend/src/interfaces/. Each service encapsulates business logic for a domain entity, injected into routes via the DI container.

DI Container

Services are created and wired in backend/src/services/create-services.ts, then attached to the Hono context as c.var.services. See Dependency Injection.

Key Services by Domain

Core Business

ServiceFilePurpose
BuildingsServicebuildings-service.tsBuilding CRUD, geometry, metadata
ProjectServiceproject-service.tsProjects lifecycle, phases
ScenarioServicescenario-service.tsScenarios comparison
BuildingComponentServicebuilding-component-service.tsBuilding Components management
MeasureServicemeasure-service.tsMeasures per scenario

CRM

ServiceFilePurpose
ContactServicecontact-service.tsContacts CRUD, claiming
CompanyServicecompany-service.tsCompanies management
LeadServicelead-service.tsLeads pipeline

Finance

ServiceFilePurpose
QuoteServicequote-service.tsQuotes CRUD
QuoteFinanceServicequote-finance-service.tsFinancial Calculations for quotes
InvoiceServiceinvoice-service.tsInvoices generation
CatalogServicecatalog-service.tsProducts catalog
FundingCalculatorServicefunding-calculator-service.tsFunding Applications calculations

Documents & Files

ServiceFilePurpose
DocumentRequestServicedocument-request-service.tsDocuments request workflow
DocumentObtainingServicedocument-obtaining/Document Obtaining collection
FileServicefile-service.tsFiles upload/storage
PdfExportServicepdf-export-service.tsPDF Templates generation

Auth & Users

ServiceFilePurpose
AuthServiceauth-service.tsAuthentication, 2FA, password reset
UserServiceuser-service.tsUsers management
PortalServiceportal-service.tsPortal token operations

Automation & Scheduling

ServiceFilePurpose
WorkflowStateMachineworkflow-state-machine.tsWorkflows state transitions
TaskServicetask-service.tsTask management
AppointmentServiceappointment-service.tsAppointments scheduling
FormServiceform-service.tsForms submission

External Integrations

ServiceFile(s)Purpose
HubSpot suitehubspot/ (14 files)HubSpot Integration sync
EntraServiceentra/Azure Entra SSO
NotificationServicenotification-service.tsNotifications dispatch
FeedbackServicefeedback-service.tsFeedback System
AuditLogServiceaudit-log-service.tsAudit Logs
DepartmentServicedepartment-service.tsDepartments

Interface Pattern

Each service has a matching interface in backend/src/interfaces/:

backend/src/interfaces/buildings-service.interface.ts
backend/src/services/buildings-service.ts

The interface defines the contract; the service implements it. Routes depend on interfaces, not implementations.