Implementation handoff

Frontend boundaries that are ready for a Node.js backend.

The UI never calls fetch directly. Typed services isolate transport, while the assessment provider owns only client journey state.

01 · Architecture

Responsibility by layer

LayerResponsibilityLocation
RoutesPage metadata and compositionfrontend/src/app
ComponentsAccessible presentation and interactionfrontend/src/components
ProviderJourney state persisted to session storagecomponents/providers
ServicesAPI / mock switching and endpoint callsfrontend/src/lib/services
TypesShared request and response contractsfrontend/src/types

02 · API contract

Expected REST integration points

MethodPathResponsibility
POST/api/v1/opportunities/analyzeProblem input → workflow inference
POST/api/v1/opportunities/:idEvidence + inference → opportunity result
POST/api/v1/leadsPurpose-limited lead submission
POST/api/v1/opportunities/decision-briefQueue the requested management brief
NEXT_PUBLIC_API_BASE_URL=https://api.example.com # Empty = use isolated, labelled local mocks

03 · UI states

Production behavior is designed in

Default

Clear primary action and an optional example

Invalid

Inline error with the user’s text preserved

Loading

Disabled submission and explicit progress copy

API error

Retryable message without clearing assessment state

Mock

Clearly labelled illustrative output

Success

Confirmation, architect contact and close action

04 · Node.js integration

Swap transport, keep the product UI.

  1. 01

    Implement DTOs that match the interfaces in frontend/src/types.

  2. 02

    Return the same response shapes from the four documented endpoints.

  3. 03

    Set NEXT_PUBLIC_API_BASE_URL; the service layer automatically stops using mocks.

  4. 04

    Add authentication, retention and rate-limiting policies at the API boundary when required.