Why ThingsCode Uses Code Actions Instead of Forms

Why ThingsCode Uses Code Actions Instead of Forms

●1 ●18 ●32
calendar_today ago • schedule4 min read

When building management tooling for a database, the standard instinct is to build a form for every operation: a modal with checkboxes for type flags, a multi-step wizard for field migrations, a dropdown builder for relations, and nested inputs for backups or tokens.

In ThingsCode—the web IDE and studio for ThingsDB—we took a different route. Rather than hiding ThingsDB's query language behind dozens of rigid forms, almost every schema, user, backup, procedure, and module action opens the same Code Action Modal: a focused, pre-filled ThingsDB editor ready to inspect, tweak, and execute.

Here is why we designed it this way, and how it works in practice.

The Problem with Forms for a Programmable Database

While ThingsDB schemas do have clean primitive definitions like int, str, and bool, they also support rich, expressive constructs—such as regular expressions, nested templates, room types, and closures—and its administrative functions accept closures, bitwise flags, or environment-specific arguments:

  • Rich definitions & migration closures: A type property might be a simple 'str', a regex constraint, a nested template definition, or a room. On top of that, adding a property to a type with active instances (mod_type(..., 'add', ...)) or tightening a field definition (mod_type(..., 'mod', ...)) optionally accepts a migration callback closure that runs against every existing instance. A static form cannot express |room| Chat{name: room.chat} or complex nested definitions without turning into a code editor anyway.

  • Forms hide what actually happens: Clicking "Save" in a traditional UI obscures whether a single function ran, which scope it targeted (@thingsdb vs. @collection:stuff), or what side effects occurred. Showing the exact ThingsDB statement makes every administrative action transparent and self-documenting.

  • Copy-pasteable automation: Because the modal shows real ThingsDB code, anything you run in the UI can be copied directly into a deployment script, migration file, or ThingsDB procedure.

Ready-to-Run Templates vs. <PLACEHOLDER> Values

Every action in ThingsCode opens a Monaco editor pre-populated with inline documentation, usage examples, and the exact function call for the context you clicked from.

1. Ready-to-Execute Actions

When an action has sensible defaults—such as triggering an immediate backup, toggling a type flag (idx, hid, wpo), or cleaning up expired tokens—the generated snippet is valid and ready to run as-is:

New Schedule

You can hit Execute immediately for a one-off backup in /tmp, or uncomment and adjust one of the scheduled examples.

2. Explicit <CAPITAL> Placeholders

When user input is required—such as naming a new user, type, enum, or field—ThingsCode marks required arguments in <UPPERCASE_PLACEHOLDERS> and includes optional follow-up steps in comments:

// Create a new user (without password, tokens, or privileges yet)
// Optional next steps:
//   set_password('<USERNAME>', '<PASSWORD>');
//   grant('@:stuff', '<USERNAME>', USER);
new_user('<USERNAME>');

Context-aware actions pre-fill everything they already know. For instance, opening the field menu on an existing type Person to add a new property generates:

Type Details modal on the Fields tab with the Add Field to Person Modal open

Automatic commit(...) Detection

ThingsDB supports commit history per scope, recording changes along with a commit message when enabled. If you forget to include commit(...) in a scope where commit history is active, ThingsDB rejects the change.

ThingsCode checks whether commit history is enabled on the target scope before opening the modal. When it is, ThingsCode automatically prepends commit('<COMMIT_MESSAGE>'); and displays a Commit history enabled badge:

Create New Type

Environment Guardrails: Development vs. Staging & Production

Running code directly against a database is fast during development, but risky when you are connected to a live environment.

Each workspace in ThingsCode is tagged with an environment (development, staging, or production), shown as a color-coded badge in the modal header alongside the target scope (@thingsdb, @node, or @collection:...):

  • Development (green): The Execute button is active immediately for fast iteration.
  • Staging (orange) & Production (red): The Execute button stays disabled until you explicitly toggle Confirm execution on production (or staging).

Code Action Modal in a production workspace

Modifying Actual Collection Data

We didn't stop at schema operations. When exploring your collection, you don't just inspect the types; you also view and modify the actual live things in the database.

Using a Code Action Modal for live data takes full advantage of ThingsDB’s concise syntax. When you edit a property on a thing, we do the heavy lifting of resolving the scope and finding the exact object in context.

Instead of writing a complex UI form with validation for booleans, strings, and numbers, ThingsCode launches a focused edit modal:

Thing Explorer Edit Selection

Modify property

This approach makes it incredibly simple to write natural database mutations:

  • Need to bump a count? You don't need a UI spinbox. Just write .counter += 1;.
  • Want to append an item to a list? Write .tags.push('urgent'); rather than clicking "add item" on a modal list view.
  • Need complex object links? Set an object reference like .owner = thing(42); instantly, rather than relying on a buggy, dropdown UI searching for ID 42.

Your live data is handled with the exact same visual transparency, version control, and production confirmation as your schemas, enums, and modules.

Full Coverage Across Types, Enums, Users, and More

Using a single, consistent execution modal across the entire studio allowed us to cover nearly the full ThingsDB management API without cluttering the interface:

  • Types: new_type, set_type, rename_type, del_type, flag toggles (idx, hid, wpo), field operations (add, mod, ren, del, rel, nro), methods, and row mode configuration.

  • Enums: set_enum, rename_enum, del_enum, default member selection (def), and member/method management (add, mod, ren, del).

  • Users & Access: new_user, rename_user, del_user, set_password, grant / revoke, and token lifecycle management (new_token, del_token, del_expired).

  • Operations: Procedures, scheduled tasks, modules, and backups.

Type Details

Every action stays one click away from the object you are inspecting—while keeping you in complete control of the exact ThingsDB code that runs.


Try It Out

The Code Action Modal is available in the latest version of ThingsCode. Follow the ThingsCode installation guide on GitHub to download and run it against your ThingsDB cluster today.

Want more #opensource & #development deep dives?

Join 6,128+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

AAIF Hits 10 Projects. Its CTO on What to Adopt Now and the Security Gaps Left Open

Tom Smithverified - Oct 23

The Sovereign Vault — A Comprehensive Guide to Protocol-Driven AI

Ken W. Algerverified - Jun 4

Why Email-Only Contact Forms Are Failing in 2026 (And What Developers Should Do Instead)

JayCode - Mar 2

The Esoteric Realms of Code

nevmenandr - Nov 14

StarlingX 13.0 Turns Two Edge Upgrades Into One Reboot. Test the Targets Yourself.

Tom Smithverified - Nov 24
chevron_left
1k Points • 51 Badges
12Posts
6Comments
13Connections
My passion for programming started during childhood and since about 2012 I started committing to the... Show more

Related Jobs

Commenters (This Week)

1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!