Microfrontend Setup (apps/)
Each application within the /apps/ directory represents a distinct business context or microfrontend, following a Microfrontend Architecture.
Benefits of This Microfrontend Approach:
- Independent development and testing cycles per application.
- Allows for separate deployment schedules if needed.
- Promotes team autonomy focused on specific business domains.
- Enforces clear boundaries while maximizing core logic reuse from
packages/core.
apps/radicacion: Handles the document intake process.apps/asignacion: Manages case routing and assignments.
packages/* where applicable (actions, hooks, config). All UI elements must be constructed using components from the mappnext/ds-tw library to ensure visual consistency.
Frontend Folder Layout (Recommended Structure)
Within each Next.js application (apps/*), routes using the App Router can benefit from the following structure, promoting the Container/Presentational Component Pattern and Separation of Concerns.
UI Component Library (mappnext/ds-tw)
- Mandatory Usage: All user interface elements (buttons, inputs, modals, layout structures, etc.) must be imported and used from the external
mappnext/ds-twlibrary. - Consistency: This ensures visual and behavioral consistency across all microfrontends.
- Avoid Custom Styles: Do not write custom CSS or Tailwind classes for elements that have a corresponding component in the design system library, unless absolutely necessary for layout positioning not covered by the library’s components/props.
- Import Path:
import { Button } from 'mappnext/ds-tw/atoms/Button';(Adjust path based on actual library structure).
Shared Hooks (packages/hooks)
- The
packages/hooksdirectory contains reusable React hooks. - Use these hooks for cross-cutting concerns (e.g., form handling, API call state management, debouncing) that can be shared across different frontend applications (
apps/*). - Before creating a new hook within an application, check if a suitable one already exists in
@hooks. - Import using the alias:
import { useFormValidation } from '@hooks/forms';