Skip to content

Introduction

In traditional enterprise systems, business logic is scattered, duplicated, and fragile. You write validation in one language for the UI, then rewrite it in another for the server, hoping the two never drift apart. This is a primary source of bugs, security vulnerabilities, and wasted engineering effort.

Simple's Record Behaviors make this entire class of problems obsolete.

Record Behaviors are the living, breathing logic of your application. By attaching simple, powerful JavaScript scripts to your tables, you define how your data should behave in any context. This logic is compiled to a secure WebAssembly (WASM) module and executed by our high-performance Logic Runtime, guaranteeing that your business rules are enforced consistently, everywhere, every time.

What You Can Build

With Record Behaviors, you move beyond static forms and build dynamic, intelligent applications.

  • ⚡ Real-Time Calculated Fields: Instantly compute totals, scores, or any derived value as users interact with forms.
  • 🔒 Bulletproof Data Integrity: Implement complex, multi-field business rules (e.g., end_date must be after start_date) that are guaranteed to be enforced on the server before any data is saved.
  • 🧠 Intelligent, Dynamic Forms: Conditionally show, hide, require, or make fields read-only to create guided, intuitive workflows that adapt to user input in real-time.
  • ✨ Consistent Default Values: Ensure new records are always created in a valid, consistent state, whether they are initiated from the UI, an API call, or an automated process.
  • 🔗 Data-Driven Logic: Fetch related data from anywhere in your database using secure, read-only GraphQL queries to make intelligent, context-aware decisions.
  • 🤖 AI-Powered Automation: Call the native $ai API to summarize text, extract structured data from uploaded documents, and integrate intelligence directly into your business logic.

The Simple Advantage: A Modern Architecture

Our approach is fundamentally different from legacy platforms. It's built on a foundation of security, performance, and developer experience.

The Secure WASM Sandbox

All your code executes within a secure, memory-isolated WebAssembly sandbox. Your logic has no default capabilities; it cannot access the network, filesystem, or arbitrary system resources. It can only interact with the platform through the secure, explicitly provided SDK APIs. This makes your application secure by design.

Write Once, Run Anywhere

This is the cornerstone of the Simple Platform. You write your logic once, and our platform executes the exact same compiled WASM module in two places: on the client for a fast, responsive UI, and on the server for authoritative validation.

Record Behavior Introduction

The result: It is architecturally impossible for your client-side validation to diverge from your server-side rules. You eliminate an entire class of bugs while maximizing code reuse.

The Ergonomic API

We provide a clean, modern, and self-documenting API. Your script receives a single object argument, allowing you to destructure only the tools you need.

javascript
// The modern, self-documenting signature
export default async ({ $ai, $db, $form, $user }) => {
  // Your logic here...
  const status = $form('status').value()
}

No more guessing the order of arguments. It's an ergonomic experience designed for modern development.

Next Steps

Dive deeper into building with Record Behaviors: