Skip to main content

Naming Conventions

Strict adherence to these naming conventions is required for code consistency and predictability across the monorepo.
Artifact TypeSuffix/Prefix ConventionExampleStandard Location Example
Yup SchemaSchema suffixuserSchemapackages/core/validation/userSchema.ts
Schema Type (Input)Input suffixCreateUserInputpackages/core/validation/userSchema.ts
Base Entity TypeNoun (Singular)Userpackages/core/types/entities/User.ts
XState MachineMachine suffixuserCreationMachinepackages/core/machines/userCreationMachine.ts
Machine Context TypeMachineContext suffixUserCreationMachineContextpackages/core/types/machines/user/UserCreationMachineTypes.ts
Machine Event TypeMachineEvent suffixUserCreationMachineEventpackages/core/types/machines/user/UserCreationMachineTypes.ts
Service InterfaceService suffixUserServicepackages/core/services/user/domain/UserService.ts
Service Impl Class[ImplName]Service suffixDefaultUserServicepackages/core/services/user/implementations/DefaultUserService.ts
Service Method DTOs[MethodName]Input/OutputCreateUserMethodInputpackages/core/services/user/domain/UserTypes.ts
Server ActionAction suffixcreateUserActionpackages/core/actions/userActions.ts
Container Comp.Container suffixUserFormContainer.tsxapps/[appName]/app/.../containers/
Page Componentpage.tsx (exact name)page.tsxapps/[appName]/app/.../[pageName]/page.tsx

Developer Checklist

Before submitting a Pull Request for review, developers must verify the following:
  • Input Validation: Is input data validated using a shared Yup schema (@core/validation) within the Server Action before starting the machine? (See Backend Guide)
  • Action Logic: Does the Server Action instantiate the correct XState machine (@core/machines), pass validated input and resolved service to context, send the initial event, and await its completion? (See Core Workflow)
  • Machine Orchestration: Does the XState machine orchestrate the business logic flow?
  • Machine-Service DTO Mapping: Does the XState machine correctly construct the Service Input DTO before calling the service method? Does it correctly process the Service Output DTO and update its context? (See Core Workflow & Backend Guide)
  • Service Invocation: Does the XState machine invoke methods on appropriate Service implementations (@core/services/[domain]/implementations/) obtained via context?
  • Service Resolution: Is the correct service implementation resolved (via Factory/Locator) and made available to the machine (e.g., via context)? (See Backend Guide)
  • State Modeling: Are complex stateful workflows correctly modeled within the XState machine (State Pattern)?
  • Service Logic: Are discrete business operations implemented within Service classes (Strategy Pattern)?
  • Service Contracts: Are Service Interfaces defined in @core/services/[domain]/domain/[Domain]Service.ts? Are specific Service Method Input/Output DTOs defined in @core/services/[domain]/domain/[Domain]Types.ts and decoupled from validation/entity types? (See Backend Guide)
  • Typing: Are XState machine Context/Event types defined in @core/types/machines/[domain]/? Are base entity types defined in @core/types/entities/? (See Backend Guide)
  • UI Library: Are UI elements properly used from mappnext/ds-tw? (See Frontend Guide)
  • Frontend Structure: Are presentational components (components/) clearly separated from container logic (page.tsx or containers/) (Container/Presentational Pattern)? Is the chosen frontend structure appropriate for the complexity? (See Frontend Guide)
  • Code Reuse: Have shared packages (@core, @hooks, @config) been checked before writing new code? (See Overview)
  • Build: Does the project build successfully (pnpm build)?
  • Documentation: Are docs/comments updated where necessary (explaining complex ‘why’, not ‘what’)?
  • Commits: Do all commits follow the Conventional Commits format?
Pull Requests failing these checks may be rejected. Pay special attention to the correct Action -> Machine -> Service flow (including DTO mapping in the machine), commit message compliance, UI library usage, adherence to architectural patterns, and separation of concerns.