
FCIS — Functional Core, Imperative Shell
OVERVIEW 💡 A pattern that splits your codebase into two hard zones: ZONE LOCATION RULE Functional Core src/core/ Pure functions only. No I/O. No side effects. Imperative Shell src/shell/ All I/O lives here. Calls core to make decisions. 💡 Shell (IMPURE) fetches data, asks the core what to do, then acts on the answer. flowchart TB subgraph SHELL[" src/shell/ - Imperative Shell "] direction TB CLI["CLI commands"] subgraph STEPS[" 5-Step Handler Pattern "] P["1. PARSE"] F["2. FETCH"] C["3. CALL CORE"] A["4. ACT"] O["5. OUTPUT"] P --> F --> C --> A --> O end DB["DB queries"] PRINTER["view.printer"] CLI --> STEPS STEPS --> DB STEPS --> PRINTER end classDef shell fill:#0d47a1,stroke:#1565c0,color:#e3f2fd classDef steps fill:#37474f,stroke:#546e7a,color:#eceff1 class SHELL,CLI,DB,PRINTER shell class P,F,C,A,O steps 💡 (Core PURE) never imports from shell. It calls core with data → gets Result back. flowchart TB subgraph CORE[" src/core/ - Functional Core "] direction TB TYPES["types.ts"] VALID
Continue reading on Dev.to
Opens in a new tab

