Core Principles
This monorepo follows a clean, scalable architecture designed for server-first development using Next.js App Router, TypeScript, XState, and Yup. It establishes standards for:- Separation of Concerns: Clearly delineating responsibilities across layers (UI, Actions, Machines, Services) following principles of Layered Architecture.
- Microfrontend support: Enabling independent development and deployment of distinct business domain applications using a Microfrontend Architecture approach.
- Code reuse: Maximizing code sharing across applications via centralized packages.
- Server state orchestration: Utilizing typed XState machines (State Pattern) to manage complex server-side business processes, orchestrating calls to the Service Layer.
- Structured Service Layer: Employing a domain-driven structure (Strategy Pattern, Factory Method/Service Locator) for defining service abstractions (interfaces, method DTOs) separately from concrete implementations, invoked by state machines.
Monorepo Structure
The project is organized intoapps (deployable units/microfrontends) and packages (shared code).
Project Root Structure
mappnext/ds-tw library, installed as a dependency.
Commands & Setup
Standard commands executed from the root of the monorepo:Common Development Commands
Shared Package Roles (packages/)
Shared functionality is organized into dedicated packages. UI components come from an external library.
Package aliases (
@core, @hooks, @config) are configured in the root tsconfig.json under paths. These aliases must be used for importing shared code from packages/. UI components must be imported directly from mappnext/ds-tw/*.