Happy House - Ecommerce Docs
Developer Resourcesdocumentation formats

Features and Flows Documentation Format

Detailed Fumadocs MDX format for module features, user flows, business rules, and lifecycle diagrams.

Features and Flows Documentation Format

Use this format for every module and submodule feature page. This doc explains what the module does for users, admins, workers, and systems, and how each flow behaves from start to finish.

Required Source References

SourceRequired Use
Existing Fumadocs module docsUse feature docs such as banners/feature.mdx, search/feature.mdx, and order module feature docs if present.
API docRequired for route names, actors, auth, and response-visible behavior.
Backend docRequired for service behavior, persistence, cache, jobs, and state transitions.
Current codeRequired for exact route, status, permission, and side-effect behavior.

Frontmatter

---
title: MODULE_NAME Features and Flows
description: Complete feature list, actor journeys, state flows, business rules, edge cases, and diagrams for MODULE_NAME.
---

1. Documentation Evidence

Source TypeFiles or DocsWhat Was Extracted
Technical designSibling TDD docState, lifecycle, validation, timing.
APISibling API doc and controllersRoute surface and actors.
BackendSibling backend doc and servicesBusiness behavior and side effects.

2. Feature Summary

FieldValue
ModuleMODULE_NAME
SubmoduleSUBMODULE_NAME or N/A
Primary user valueExplain in one sentence.
ActorsGuest, user, admin, worker, internal system.
Main entry pointsRoutes, jobs, scheduler, admin panel, mobile screen.
Main outputsResponses, results, persisted records, events, notifications.
Related docsAPI, backend, TDD.

3. Actor Matrix

ActorCan DoCannot DoAuth RequirementNotes
GuestAllowed actions.Restricted actions.None or guest identity.Include guest persistence limits.
Logged-in userAllowed actions.Restricted actions.JWT.Include account stats/ownership.
AdminAllowed actions.Restricted actions.Admin JWT + permission.Include mutation and audit behavior.
Worker/systemAsync actions.N/AQueue/internal.Include retry/idempotency.

4. Capability Matrix

List every feature, including minor actions.

CapabilitySurfaceActorRoute/TriggerState ReadState WrittenLinked API Section
Create entityAdminAdminPOST /api/admin/...Existing recordsNew recordAPI section link.
Start sessionPublic/mobileGuest/userPOST /api/.../startExisting contextSessionAPI section link.
Enqueue jobWorkerSystemJob triggerPayloadJob resultAPI/backend section.

5. User-Facing Flows

Repeat for every user-facing flow.

5.x FLOW_NAME

Summary

Explain the flow from the actor's perspective.

Preconditions

  • Required auth state.
  • Required existing data.
  • Required catalog/pricing/session/cache state.
  • Required feature flags or config.

Main Flow

StepActor/SystemActionResultSource
1ActorPerforms action.Request created.API/controller.
2BackendValidates.Accepted/rejected.Service.
3BackendPersists/returns.State changes.Backend doc.

Sequence Diagram

Branches and Edge Cases

BranchConditionBehaviorError/Result
Validation failureInvalid field.Reject request.400.
Missing dataEntity not found.Stop flow.Module error.
Guest branchActor not logged in.Allow limited result.No persistent record for guest actors.
Duplicate actionSame idempotency key/job id.No duplicate side effect.Existing result or no-op.

6. Admin Flows

Repeat for every admin flow:

  • Create.
  • List.
  • Read detail.
  • Update.
  • Reorder.
  • Activate/deactivate.
  • Soft delete.
  • Restore.
  • Export/import.
  • Moderation.
  • Manual retry.

6.x ADMIN_FLOW_NAME

Include route, permission, mutation side effects, cache invalidation, audit/logging, and failure branches.

7. Lifecycle and State Transitions

Document every state machine.

EntityFromEvent/ActionToGuard ConditionSide Effects
EntitydraftActivateactiveRequired fields presentCache invalidation.

Diagram:

9. Data and Side Effects by Flow

FlowDB WritesCache EffectsJobsRealtimeAnalyticsNotifications
Flow nameTablesKeys invalidatedQueue jobsEvent namesEventsEmail/push

10. Error and Recovery Flows

ScenarioTriggerUser/System ExperienceRecoverySource
Rate limitedToo many requests429 responseRetry laterController/guard.
Queue failureRedis/BullMQ errorRequest returns or fails depending codeRetry/DLQ/manualProcessor/service.
Cache failureRedis unavailableDB fallback or warningAutomaticService.

11. Diagrams Required Per Module

Every complete feature/flows doc should include:

  • Actor capability diagram.
  • High-level module flow diagram.
  • Sequence diagram for each major user/admin/system flow.
  • State machine diagram for every lifecycle.
  • Data side-effect diagram for write flows.
  • Error branch diagram for critical flows.

12. Mandatory Feature and Flow Deep-Dive Pack

This section is required for every generated feature/flows doc. The page must cover what the module does, why it does it, how users experience it, how admins operate it, how systems automate it, and what tradeoffs define the behavior.

12.1 Feature Inventory With Minor Behaviors

Every capability must be split into visible and hidden behavior.

FeatureMinor BehaviorActorTriggerUser/System ResultBackend Side EffectSource
Feature nameSmall behaviorGuest/user/admin/systemRoute/job/actionWhat changes for actorDB/cache/job/eventSource path/doc

Rules:

  • Do not group away minor behaviors such as restore, retry, skip, shuffle, filter, sort, empty result, fallback, cache miss, duplicate action, or permission failure.
  • If a user can notice it, an admin can configure it, a job can perform it, or a test asserts it, it must be documented.

12.2 Business Process Diagram Pack

Use diagrams that match the business flow.

DiagramRequired WhenPurpose
User journey mapAlwaysShows actor intent from entry to outcome.
Service blueprintMulti-actor or backend-heavy flowsSeparates user action, API, service, DB, jobs.
Activity diagramEvery major flowShows decisions and branches.
State diagramAny lifecycleShows allowed transitions.
Swimlane diagramMulti-actor flowShows ownership by actor/system.
Sequence diagramAPI-backed flowShows call order.
Data side-effect graphAny mutationShows DB/cache/job/event impacts.
Exception flow diagramCritical failure scenariosShows recovery or terminal result.

Example swimlane-style flow:

Example service blueprint:

12.3 Business Rules and Policy Traceability

Every business rule must have implementation traceability.

RuleBusiness ReasonActor ImpactEnforced InAPI ImpactBackend ImpactTests
Rule textWhy it exists.What actor sees.DTO/service/schemaRoute/responseData/side effectsSpec path

Include:

  • Eligibility rules.
  • Visibility rules.
  • Ownership rules.
  • Ranking/scoring rules.
  • Moderation/safety rules.
  • Catalog and pricing rules.
  • Admin workflow rules.
  • Guest limitations.
  • Lifecycle rules.

12.4 Tradeoffs and Product Rationale

Document why the feature behaves this way.

Product DecisionUser BenefitEngineering BenefitAlternativeTradeoffRisk
DecisionBenefit.Benefit.Alternative.Cost.Risk.

Examples:

  • Guest access allowed but persistence restricted.
  • Public endpoint rate-limited instead of login-only.
  • Async analytics instead of synchronous writes.
  • Page pagination instead of cursor pagination.
  • Fallback content instead of hard failure.
  • Server-authoritative pricing instead of client-supplied values.

12.5 Flow Edge-Case Matrix

Every flow needs edge cases.

FlowEdge CaseTriggerExpected BehaviorUser/System FeedbackSource
Flow nameDuplicate actionSame request twiceIdempotent/no-op/errorExact response/resultCode/test

Cover:

  • Empty state.
  • First use.
  • Last item.
  • Duplicate action.
  • Concurrent action.
  • Expired state.
  • Permission mismatch.
  • Guest limitation.
  • Missing dependency.
  • Cache stale/miss.
  • Queue failure.
  • Unsupported filter or sort option.

12.6 Flow-to-Data Trace

For each flow, show how feature behavior maps to data.

FlowReadsWritesCacheJobs/EventsResponse Fields
Flow nameTables/cacheTables/cacheKeysJobs/eventsVisible fields

12.7 Experience Quality Checklist

  • The doc explains what the actor is trying to accomplish.
  • The doc explains what the backend does that the actor does not see.
  • The doc covers every minor flow and branch.
  • The doc includes user, admin, worker, and system flows where applicable.
  • The doc explains business logic, tradeoffs, and rationale.
  • The doc maps every flow to API routes and backend side effects.
  • The doc includes diagrams appropriate to each flow type.
  • The doc covers all edge cases and failure recovery.

13. Completion Checklist

  • Every feature, minor action, and submodule capability is listed.
  • Every actor has allowed and forbidden behavior.
  • Every major and minor flow includes steps, branches, and diagrams.
  • Every lifecycle has a transition table and state diagram.
  • Every flow links to the API and backend docs.
  • TDD dependencies are called out where they shape behavior.

See Also

  • API doc: /docs/developer/MODULE_SLUG/api
  • Backend doc: /docs/developer/MODULE_SLUG/backend
  • TDD: /docs/developer/MODULE_SLUG/tdd