Development

Debugging, profiling, testing, and tooling to speed up your workflow.

Debugging

Inspect and debug values during development.

  • solidb.debug(data) -> string
    Pretty-prints any value with formatting. Also logs to server tracing.
  • solidb.inspect(value) -> table
    Returns detailed type info: { type, length?, value?, count?, is_array?, keys? }
  • solidb.dump(value) -> string
    Returns JSON-like string representation of any value.

Profiling

Measure and optimize performance.

  • solidb.profile(fn, args?) -> table
    Executes function and returns: { result, duration_ms, duration_us }
  • solidb.benchmark(fn, iterations?) -> table
    Runs function N times (default: 100). Returns: { iterations, total_ms, avg_ms, min_ms, max_ms, std_dev_ms }

Testing

Assertions and mocking for unit tests.

  • solidb.assert(condition, message?) -> true
  • solidb.assert_eq(a, b, message?) -> true
  • solidb.mock(name, initial_data?) -> mock
    Creates a mock collection for testing without touching real data.

    Mock methods:
    • mock:get(key) - Get document by key
    • mock:insert(doc) - Insert document (auto-generates _key)
    • mock:update(key, updates) - Update document
    • mock:delete(key) - Delete document
    • mock:all() - Get all documents as array
    • mock:count() - Get document count
    • mock:reset() - Clear all data

Interactive REPL

SoliDB includes an interactive Lua REPL (Read-Eval-Print Loop) for testing and debugging scripts. Use the CLI or web interface.

CLI REPL

$ solidb-repl
_system> 1 + 1
2

Web REPL

Access from the dashboard sidebar under "Lua REPL".

VSCode Extension

Get autocomplete, snippets, and deploy scripts directly from your editor.

Autocomplete

IntelliSense for solidb APIs

Snippets

30+ code snippets

Deploy

Deploy scripts with one command