Projects

A renovation project associated with a building. Projects track the full lifecycle from initial contact through funding payout, with phase management, Gantt visualization, and role-based access.

HubSpot Deal = R1 Project: projects mirrors the HubSpot Deal object (objectTypeId 0-3, dealConfig in services/hubspot/sync-engine/entity-configs.ts). There is no deals table — deals sync directly into projects. hubspotId is the vendor identifier used only for sync round-tripping; internal cross-table references always join on projects.id (UUID PK).

Source Files

LayerPath
Schemabackend/src/db/schema.ts (projects)
Routesbackend/src/routes/projects.ts
Servicebackend/src/services/project-service.ts
Pagesfrontend/src/pages/ProjectDetail.tsx
Queriesfrontend/src/lib/queries/projectQueries.ts

Database Tables

TablePurpose
projectsMain entity — name, phase, timeline, budget, HubSpot Deal mirror
project_parametersBuilding characteristics per project (current vs. target state, one row per project)
project_phase_historyAudit trail of phase transitions (from/to, changed_by, timestamp)
project_rolesRBAC Authorization — maps Contacts to projects with roles

Key Fields

FieldTypeNotes
namevarchar(200)Project name
buildingIduuid FKParent building (cascade delete)
userIduuid FKCreator user — nullable, set null on delete (I#1724)
currentPhaseenumSee phase lifecycle below
phaseChangedAt / phaseChangedBytimestamp/uuidWhen/by whom the current phase was entered
selectedScenarioIduuidThe chosen scenario for execution
totalBudgetrealOverall budget estimate (HubSpot deal “amount”)
startDate, plannedEndDate, actualEndDatetimestampTimeline tracking
engagementTypeenumenergy_consulting (EnergieBeratung, RENEWA-direct), internal_contractor (Provi-KOP), external_contractor (Nicht-Provi-KOP)
handoverReadybooleanReady for Auftragsübergabe to workflow packages
customerScorerealHubSpot customer score 0-100, snapshotted onto workflow packages at handover (I#1866)
hubspotIdvarchar(100)HubSpot Deal ID (unique) — sync round-trip only
hubspotPipeline, hubspotPipelineStagevarcharDeal pipeline mirror
recordOwnerContactIduuid FKRead-only sync mirror of the HubSpot deal owner, resolved to a contact via hubspot_owners; sync layer is the sole writer
hubspotProperties, hubspotSchemaVersion, lastSyncedAtvariousRaw property bag + sync metadata
archived, archivedAt, deletedAt, archiveReason, mergedIntoHubspotIdvariousHubSpot archive/merge status + soft delete

Deal-property mirror columns (sync-written): lead/sales process (leadSource, leadSourceDetail, leadCreatedAt, firstAppointmentAt, matchingAt, welcomeAt, collectiveAppointmentAt, offerDate, offerPresentationAt, offerValue, desiredStartDate) and building/technical (crafts, craftLabels, ownershipType, heritageProtected, efficiencyStandard, hubspotBudget, manufacturer, commissionRate, dealAmount).

HubSpot-Tracked Relationships

Roles like customer, contractor, owner, invoice_recipient on a project are not FK columns — they are polymorphic rows in hubspot_associations, read via getAssociationsByRenewaName(role, ...). Spec: docs/superpowers/specs/2026-05-08-hubspot-association-infrastructure-design.md.

Phase Lifecycle

Managed by projectPhaseEnum, transitions tracked in project_phase_history:

initial_contact -> consultation -> offer_sales -> funding_application
    -> execution -> results_presentation -> funding_completion -> funding_payout

Each transition records fromPhase, toPhase, changedBy, and optionally selectedScenarioId.

Relationships

Project *──1 Building
Project 1──* Scenarios
Project 1──* Funding Applications
Project 1──* Quotes
Project 1──* Invoices
Project 1──* Project Roles ──* Contacts
Project 1──0..1 Project Parameters
Project *──1 Users (creator, nullable)
Project ──> HubSpot-tracked roles via hubspot_associations

Frontend Components

ComponentPurpose
ProjectFormCreate/edit project details
ProjectGanttViewGantt chart timeline visualization
ProjectOverviewCardSummary card with phase, budget, dates
ProjectRoleManagerAssign Contacts to project roles
PhaseHistoryTimeline of phase transitions
PhaseProgressBarVisual progress through phases
PhaseTransitionControlsButtons/dialogs to advance phases

Features

  • Phase management with transition controls and audit history
  • Gantt chart visualization of project timeline
  • Scenario selection — pick the winning scenario for execution
  • Role management via project_roles and RBAC Authorization (verifyProjectAccess())
  • Financial tracking through linked Quotes, Invoices, Funding Applications

Buildings | Scenarios | Funding Applications | Quotes | Invoices | Contacts | RBAC Authorization | Scenario Planning | Financial Calculations | HubSpot Integration