DEV Community

Cover image for LioranDB TypeScript Series #12: Production Patterns, Error Handling and What Comes Next
Swaraj Puppalwar
Swaraj Puppalwar

Posted on

LioranDB TypeScript Series #12: Production Patterns, Error Handling and What Comes Next

LioranDB TypeScript Series #12: Production Patterns, Error Handling and What Comes Next

LioranDB TypeScript Series: Build with a developer-first document database powered by Rust and designed for TypeScript.

We started this series with:

docker run ...
Enter fullscreen mode Exit fullscreen mode

Eleven articles later, we've covered application queries, indexes, authentication, operations, backups, the CLI and managed deployment.

Let's finish with the things that matter when your application stops being a demo.

Understand driver errors

The LioranDB TypeScript driver exports a structured error hierarchy.

General errors include:

LioranDriverError
ApiError
AuthError
NetworkError
TimeoutError
ConfigurationError
SerializationError
Enter fullscreen mode Exit fullscreen mode

Authentication-related errors include:

AuthenticationError
AuthorizationError
PasswordChangeRequiredError
SessionExpiredError
Enter fullscreen mode Exit fullscreen mode

Lifecycle errors include:

ClientClosedError
CursorClosedError
CursorInitializedError
Enter fullscreen mode Exit fullscreen mode

Server-side conditions include errors such as:

ConflictError
DuplicateKeyError
NotFoundError
ServerNotReadyError
ServerOverloadedError
ServerUnavailableError
ValidationError
Enter fullscreen mode Exit fullscreen mode

Use instanceof

Don't parse human-readable error messages.

import {
  DuplicateKeyError,
  TimeoutError,
} from "@liorandb/driver";

try {
  await users.insertOne(user);
} catch (error) {
  if (error instanceof DuplicateKeyError) {
    // Handle duplicate data.
  }

  if (error instanceof TimeoutError) {
    // Apply your timeout/retry policy.
  }

  throw error;
}
Enter fullscreen mode Exit fullscreen mode

The driver also exports error and warning code constants for applications that need structured classification.

Add diagnostics

Attach your application's trace identifier:

client.setDiagnosticHeaders({
  "x-trace-id": traceId,
});
Enter fullscreen mode Exit fullscreen mode

Observe operations:

client.setResponseObserver((event) => {
  console.log({
    transport: event.transport,
    operation: event.operation,
    durationMS: event.durationMS,
    requestId: event.requestId,
  });
});
Enter fullscreen mode Exit fullscreen mode

And surface slow operations:

const client = await LioranDBClient.connect(uri, {
  slowRequestThresholdMS: 200,

  onWarning(warning) {
    console.warn(
      warning.code,
      warning.message
    );
  },
});
Enter fullscreen mode Exit fullscreen mode

Production checklist

Before calling a deployment production-ready:

  • URL-encode credentials inside connection strings.
  • Rotate bootstrap credentials immediately.
  • Use application-specific users and roles.
  • Prefer least-privilege permissions.
  • Use typed collections.
  • Use idempotency keys where retry safety matters.
  • Configure appropriate request timeouts.
  • Poll backup and restore jobs until terminal state.
  • Verify backups.
  • Monitor health, readiness and metrics.
  • Keep database ports private.
  • Put TLS at the public edge.
  • Close clients and cursors cleanly.
  • Handle structured driver errors rather than parsing strings.

Remember: this is pre-alpha

LioranDB V2 launched its pre-alpha on 16 August 2026.

That word matters.

Pre-alpha is where APIs can evolve, edge cases get discovered and real workloads expose assumptions that benchmarks don't.

If you're experimenting with it today, feedback is extremely valuable.

What comes next?

The current target for the LioranDB V2 alpha is:

23 October 2026

Work toward alpha includes areas such as:

  • production hardening
  • larger dataset testing
  • richer aggregation capabilities
  • clustering improvements
  • deployment tooling
  • managed infrastructure
  • developer experience improvements

The direction remains the same:

Build developer infrastructure from India that developers can actually use.

Start building

Install the driver:

npm install @liorandb/driver@2.0.5
Enter fullscreen mode Exit fullscreen mode

Install the CLI:

npm install -g @liorandb/cli@1.0.5
Enter fullscreen mode Exit fullscreen mode

Run the database:

docker pull liorandb/liorandb:pre-alpha
Enter fullscreen mode Exit fullscreen mode

Resources

LioranDB: https://liorandb.com
Documentation: https://docs.liorandb.com
Driver: @liorandb/driver@2.0.5
CLI: @liorandb/cli@1.0.5

LioranDB is created by Swaraj Puppalwar, Founder & CTO at Lioran Developer Solutions.

GitHub: https://github.com/UltronTheAI
Lioran Developer Solutions: https://lioransolutions.com


Previous: Part 11 → Docker Compose, Caddy & TLS

That's the end of the LioranDB TypeScript Series.

Now comes the fun part:

Build something with it, stress it, benchmark it, find the weird edge cases and tell us what you discover.

Pre-alpha gets better when developers actually try to break it. 💗


Enter fullscreen mode Exit fullscreen mode

Top comments (0)