API Overview
Welcome to the Lesan API Reference. This section provides comprehensive documentation for every public API, module, and type in the Lesan framework.
Server API
The Server API is responsible for handling HTTP requests, serving static files, providing the interactive playground, and routing client requests to the appropriate action handlers.
Models & ODM
The Models & ODM (Object Document Mapper) system is the heart of Lesan's data layer. It provides type-safe schema definitions, automatic bi-directional relationships, and a rich set of MongoDB operations with built-in projection support.
Queries & Projections
Lesan's query system combines the power of MongoDB with client-driven projections โ the client decides exactly what data to fetch, reducing over-fetching and under-fetching without the complexity of GraphQL.
Type System
Lesan provides end-to-end type safety through automatic TypeScript type generation. Your schemas, actions, and API client are all fully typed based on your actual code.
Cross-Platform Support
Lesan is designed to run seamlessly across Node.js, Bun, and Deno โ the three major JavaScript runtimes. This is achieved through a clean Platform Abstraction Layer (PAL) that isolates runtime-specific APIs behind consistent interfaces.
Utilities & Helpers
Lesan ships a set of small utilities and helper functions that you use while building models, actions, and request validators โ error handling, validation helpers, schema introspection, and projection generation.