Asher Cohen
Back to posts

Data Management in Frontend

Tools like redux taught frontend Devs to normalize their structures, but are we maybe reinventing the wheel?

Here's a thought that's been bothering me: every time we build a rich interactive UI, we're essentially creating a poorly optimized in-memory database. Let me explain.

The Problem We're Solving (Again)

In 1974, SQL was created to handle complex data relationships efficiently. Today, in 2024, every time we build a rich interactive UI like Figma or a local-first app, we're essentially reinventing database patterns - just... not as well.

As noted in a recent SQLSync article: "In any frontend application of sufficient complexity, engineers will necessarily end up building so many data management features that they are essentially creating a domain specific database".

We're talking about:

  • Manual indexing for quick lookups
  • Complex caching strategies
  • State synchronization
  • Relationship management
  • Cache invalidation

The Search for Solutions

I searched a lot for a solution, from ORMs adapted for the browser to custom made SQL-like wrappers. Although they worked, none felt like a standard, just a patchwork.

The WebSQL Story

Turns out the industry tried this idea. Remember WebSQL? Introduced in 2009, it promised SQL in the browser but was literally locked to SQLite 3.6.19. Well, as Chrome announces its final deprecation, it reveals a fascinating paradox in web development.

Chrome's team acknowledges something profound: "People want SQL on the web for a reason." They're right, but instead of baking it into browsers, we're seeing a new approach.

The WebAssembly Revolution

With WebAssembly, projects like DuckDB-Wasm and absurd-sql are leading the way, allowing developers to bring their own database engines.

Think about it:

  • Figma needs instant access to thousands of shapes and layers
  • Game engines track countless entity relationships
  • Collaborative editing tools manage complex state synchronization

We're not just building UIs anymore - we're building distributed databases in the browser, often without realizing it.

The Future: Freedom and Flexibility

The plan is not to be coupled to one engine, but instead widen support for community solutions and a generic foundation. Sounds like a standard to me.

The future isn't about having SQL in the browser - it's about having the freedom to implement the right tools for our needs. With file system access handles and WebAssembly, we're entering an era where frontend developers can finally stop reinventing databases and start using proper, performant solutions designed for their specific use cases.

Full Circle

The irony? We've come full circle. From WebSQL's deprecation to the rise of custom WebAssembly database engines, we're learning that maybe those database engineers from the 70s were onto something after all.

#DatabaseDesign #WebAssembly #JavaScript #FrontendDev #Innovation #SoftwareEngineering