Back to Lowdefy

Lowdefy Monorepo Overview

code-docs/Overview.md

5.2.010.0 KB
Original Source

Lowdefy Monorepo Overview

A configuration-driven web framework built on Next.js. Write YAML, get React apps.

What Lowdefy Is

Lowdefy lets developers build web applications using YAML/JSON configuration instead of code. Users define:

  • Pages with layouts and UI components (blocks)
  • Connections to databases and APIs
  • Requests that query those connections
  • Actions triggered by user events
  • Operators for dynamic logic within config

The framework compiles this config into a Next.js application at build time.

Architecture at a Glance

┌─────────────────────────────────────────────────────────────────────┐
│                          User's YAML Config                          │
│    (lowdefy.yaml, pages/*.yaml, connections, requests, etc.)        │
└─────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
┌─────────────────────────────────────────────────────────────────────┐
│                         @lowdefy/build                               │
│  - Parses YAML/JSON                                                  │
│  - Validates against schema                                          │
│  - Resolves _ref imports                                             │
│  - Evaluates build-time operators                                    │
│  - Generates build artifacts                                         │
└─────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
┌─────────────────────────────────────────────────────────────────────┐
│                     Next.js Server (runtime)                         │
│  ┌─────────────────────┐    ┌────────────────────────────────────┐  │
│  │   @lowdefy/api      │    │         @lowdefy/client            │  │
│  │  - API routes       │    │  - React rendering                 │  │
│  │  - Request exec     │    │  - Block mounting                  │  │
│  │  - Connection mgmt  │    │  - Event handling                  │  │
│  │  - Auth context     │    │  - @lowdefy/engine (state)         │  │
│  └─────────────────────┘    │  - @lowdefy/layout (grid)          │  │
│                              └────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
                          Browser / End User

Core Packages

PackageRoleKey Responsibility
lowdefy (cli)Entry pointCommands: init, dev, build, start
@lowdefy/buildCompilerYAML → build artifacts
@lowdefy/apiServerAPI routes, request execution
@lowdefy/clientClientReact rendering, page context
@lowdefy/engineRuntimeState management, actions
@lowdefy/layoutLayoutGrid system, block positioning
@lowdefy/operatorsLogicOperator parsing and evaluation

Plugin System

Lowdefy is extensible via npm packages. Everything the user sees or interacts with comes from plugins.

Plugin Types

TypeWhat It DoesExamples
BlocksUI componentsButton, TextInput, Table, Chart
ConnectionsData source configsMongoDB, PostgreSQL, REST API
OperatorsLogic functions_if, _get, _sum, _date
ActionsEvent handlersSetState, Request, Navigate
Auth ProvidersAuthenticationGoogle, Auth0, Credentials

Default Plugins

These ship with Lowdefy and don't need explicit installation:

  • @lowdefy/blocks-antd - Primary UI components (Ant Design based)
  • @lowdefy/blocks-basic - HTML primitives
  • @lowdefy/operators-js - Core JavaScript operators
  • @lowdefy/actions-core - Standard actions

See Plugin System Architecture for internals.

Key Concepts

Build vs Runtime

PhaseWhenWhat Happens
Buildlowdefy buildConfig parsed, validated, compiled to artifacts
RuntimeUser visits pageArtifacts loaded, operators evaluated, requests executed

This separation is why Lowdefy apps are fast - heavy YAML parsing happens once at deploy time.

Operators

Operators are functions prefixed with _ that make config dynamic:

yaml
# Static value
title: Welcome

# Dynamic value using operator
title:
  _if:
    test:
      _eq:
        - _state: user.role
        - admin
    then: Admin Dashboard
    else: User Dashboard

Operators can run at:

  • Build time (in @lowdefy/build) - for config composition
  • Runtime client (in @lowdefy/engine) - for UI reactivity
  • Runtime server (in @lowdefy/api) - for request logic

State Management

Each page has isolated state managed by @lowdefy/engine:

  • state - Form values and user input
  • urlQuery - URL query parameters
  • input - Data passed when navigating to page
  • _request - Cached request responses
  • _global - Shared across pages (sparingly used)

Requests

Requests are server-side data operations:

  1. Client triggers request via action
  2. @lowdefy/client sends to API route
  3. @lowdefy/api executes against connection
  4. Response returned and cached in state

Server Variants

ServerUse Case
serverProduction Next.js server for deployments
server-devLocal development server with hot reload

File Structure

lowdefy/
├── packages/
│   ├── api/              # Server-side API
│   ├── build/            # Config compiler
│   ├── cli/              # CLI tool
│   ├── client/           # React client
│   ├── engine/           # State management
│   ├── layout/           # Grid layout
│   ├── operators/        # Operator framework
│   ├── plugins/          # Plugin packages
│   │   ├── actions/
│   │   ├── blocks/
│   │   ├── connections/
│   │   ├── operators/
│   │   └── plugins/
│   ├── servers/          # Server implementations
│   └── utils/            # Shared utilities
├── packages/docs/        # docs.lowdefy.com content
└── packages/website/     # lowdefy.com content

Where to Go Next

Architecture Deep Dives

Plugin Documentation

  • Blocks - UI components (Ant Design, AG Grid, Charts)
  • Connections - Data sources (MongoDB, SQL, REST)
  • Operators - Logic functions (JS, MQL, Moment)
  • Actions - Event handlers (Core, PDF)
  • Plugins - Auth and utilities (NextAuth, AWS, CSV)

Servers

Utilities

Core Packages