Skip to main content
On this pageOverview

Model

Overview

The Model represents your entire application state in a single, immutable data structure. In Foldkit, the Model is defined using Effect Schema, which provides runtime validation, type inference, and a single source of truth for your application state.

In the counter example, the model is simply a number.

import { Schema } from 'effect'

// MODEL - The shape of your application state
// In this case, our state is just a number representing the count

const Model = Schema.Number
type Model = typeof Model.Type

One state tree, not many

Think of the Model as combining useState, useContext, and your Redux store into one typed structure. Instead of state scattered across components, everything lives here.