DEV Community

Cover image for A Framework Is More Than Its Renderer
Saiful Siam
Saiful Siam

Posted on

A Framework Is More Than Its Renderer

Software frameworks are often identified by what they render. React renders interfaces, Vue builds reactive user interfaces, and other frameworks have their own rendering mechanisms.

But is a renderer really what defines a framework?

I don't think so.

A renderer is an important part of a framework, especially in UI development, but it is not the entire framework. To understand why, let's first understand what a framework actually is.

1. What Is a Framework?

Let's use a house as an example to understand the difference between a library and a framework.

Imagine you go to a market and buy doors, windows, grills, roofing materials, and other construction materials. You bring everything home and build a house according to your own design. You have complete control over the architecture and how everything is connected.

This is similar to using a Library.

Now imagine you purchase a ready-made apartment. Its architecture, room layout, plumbing system, and electrical connections are already established.

You cannot simply put a kitchen sink in the middle of your bedroom. Instead, you arrange your furniture and appliances according to the existing structure and available connections.

This is similar to using a Framework.

In software engineering, this concept is closely related to Inversion of Control (IoC). With a library, your application generally controls when and how the library is used. With a framework, the framework provides the overall structure and often controls the execution flow, while your code fills in the required functionality.

The framework provides the structure; you bring it to life.

So, What Actually Separates a Framework from a Library?

A framework is an overall structure for building applications. Libraries provide reusable functionality that applications or frameworks can use.

A framework may use multiple libraries internally, just as a house requires different construction materials. However, a framework is not simply a collection of libraries. Its architecture, conventions, APIs, and control flow work together to establish a development model.

2. Is a Framework Defined by Its Renderer?

No.

A renderer is one component, particularly in UI frameworks, responsible for presenting elements on a screen or producing a particular output.

But a framework's identity is shaped by much more:

  • Architecture and design principles
  • Control flow and Inversion of Control
  • Component models and lifecycle management
  • State and data management
  • Reactivity
  • Public APIs and conventions
  • Runtime integration

Think of a renderer as a paintbrush. The framework is the entire system that determines how the work is organized, controlled, and executed.

Changing the renderer does not necessarily mean changing the framework itself. This becomes particularly interesting when a framework supports multiple rendering environments.

3. Understanding Runtime, Runtime Engine, and Framework

These three concepts are related, but they have different responsibilities.

Runtime Engine

The underlying engine responsible for executing code. For example, QuickJS is a JavaScript engine that can execute JavaScript code.

Runtime

The broader execution environment. It can include the runtime engine, built-in APIs, memory management, I/O facilities, and system interfaces required to run applications.

Framework

Provides the architecture, APIs, abstractions, and conventions developers use to build applications.

A framework can operate within a runtime, and that runtime can use a particular JavaScript engine. However, the framework and the engine are not the same thing. QuickJS does not become LeveloJS simply because LeveloJS uses QuickJS.

4. The Philosophy Behind LeveloJS

LeveloJS is built around a few important principles:

  • Simplicity
  • Performance
  • Minimal unnecessary abstraction
  • Fine-grained reactivity
  • A clean developer experience
  • Direct interaction with the underlying platform

One of the important architectural decisions in LeveloJS is that it does not use a Virtual DOM. Instead, it focuses on direct DOM interaction in the Web environment and fine-grained reactivity.

When reactive code is prepared and executed, dependencies between reactive functions are established through an ownership-based reactive system. You can think of this as a chain of reactive dependencies. When a particular piece of data changes, the framework can identify the affected reactive computations and update only the corresponding parts of the interface, without repeatedly comparing an entire virtual representation of the UI.

Developer Experience

Performance is not the only consideration. LeveloJS also aims to provide a familiar and straightforward development experience:

  • JSX for writing components.
  • Built-in APIs such as state(), effect(), and cleanup mechanisms.
  • A familiar component-based development model.
  • A small bundle size to help websites load efficiently, including under limited network conditions.

LeveloJS is designed around the Single Page Application (SPA) model. The goal is not to introduce unnecessary complexity but to give developers a clean way to build applications.

5. One Framework, Multiple Rendering Environments

This is where things become particularly interesting.

The main idea behind LeveloJS is to support different rendering environments while maintaining the same framework experience. When building a website, the framework uses the browser environment. When building a native Windows application, it uses a separate native execution and rendering environment.

The important part is that the framework's core reactive concepts and application source code can remain consistent, while the runtime and renderer differ across platforms.

How Is This Different from Other Approaches?

Consider SolidJS, Vue, React Native, and Flutter.

SolidJS and Vue primarily target browser-based UI development. React Native takes another approach by providing its own component model, with elements such as <View> and <Text>, and React Native for Windows integrates with Microsoft's Windows UI infrastructure. Flutter follows a different architecture, using its own widget system and rendering approach.

These technologies have different architectural decisions and trade-offs. LeveloJS explores another direction.

Instead of requiring developers to learn a separate set of UI component tags for native Windows development, LeveloJS aims to retain familiar JSX elements such as:

<div>
  <h2>Hello World</h2>
  <p>Built with LeveloJS</p>
</div>
Enter fullscreen mode Exit fullscreen mode

The idea is to use the same source-level UI structure while changing how it is executed and rendered depending on the target platform.

For Windows Native, LeveloJS is being developed around a native rendering pipeline rather than relying on a browser engine or an additional browser-based UI layer. This aims to provide a more direct route to native rendering without extra abstraction or UI-component bridges.

How Can the Same Framework Work on Two Platforms?

The answer is architectural separation.

LeveloJS keeps the Web and Native execution environments separate. The Web environment uses the browser's JavaScript execution capabilities and DOM rendering. The Windows Native environment uses a separate native runtime and rendering implementation. Both can work with the same framework-level concepts.

To coordinate these environments, I am developing a CLI called Levelo-CLI. Its purpose is to handle the platform-specific connections and prepare applications for their respective targets.

I am also working on a new API called launch. It identifies the execution environment and directs the application to the appropriate runtime: the Web execution path in a browser, or the corresponding native path in a supported native environment.

The API has not been officially released yet, but its implementation can currently be explored in the repository:

LeveloJS launch.ts

6. Engineering Beyond the Browser

Building a Web framework and building a native rendering environment are two very different challenges.

When I initially developed the Web framework, I had access to an already-established browser environment that provided many things I did not have to build myself. I developed the minimal Web framework MVP using Acode and Termux on my Android device, while working from my village.

When I started exploring native Windows rendering, the situation changed significantly. I wanted to avoid relying on a browser engine while still providing a JavaScript-based development experience. Finding a suitable architecture was not easy.

Starting with Win32

I started experimenting directly with the Windows Win32 API, aiming to first prove that I could create a native rendering environment before connecting it to JavaScript.

However, Win32 is a relatively old and low-level API. Implementing everything directly through it requires considerable amounts of code and adds complexity.

While researching alternatives, I looked at how Flutter handles rendering. I found that Flutter uses platform integration alongside its own rendering engine rather than depending entirely on native UI components for drawing. This led me to explore Skia.

Choosing Skia

I decided to experiment with Skia as the graphics rendering engine. After working through the integration, I was able to move forward with the native rendering approach.

But another major problem remained: how would I execute JavaScript inside this native environment?

Why QuickJS?

Building a JavaScript virtual machine myself would require a substantial amount of work. I also considered larger engines such as V8 and Hermes, but I wanted to keep the native implementation relatively lightweight.

Eventually, I chose QuickJS, an embeddable JavaScript engine that suits this experimental native environment.

Adding Layout Calculation with Taffy

Rendering is not only about drawing pixels. A UI system also needs to calculate positions, dimensions, spacing, and layout relationships. For this, I chose Taffy.

Taffy handles layout, Skia handles drawing, QuickJS executes JavaScript, and Win32 provides the underlying Windows integration.

The current Windows implementation, called Levelo-Windows, is still experimental and under active testing. I am taking a careful approach because the goal is not simply to make it work, but to keep the architecture as lightweight as reasonably possible.

7. Current State and Future Direction

LeveloJS is currently going through a significant architectural development phase. The main experiment is to make the same application source code work across multiple platforms using separate runtime and rendering implementations. The Web runtime and renderer are being connected to the framework, while the Windows Native environment is being developed separately.

Because of these changes, the main LeveloJS package has not received a new release for approximately one to two months. This is intentional development work rather than a lack of progress. I hope to make the next release directly usable once the ongoing work reaches a suitable stage.

Meanwhile, the existing create-levelo-app CLI and its generated project templates remain available through npm. The native implementation and the new launch() API are still under development.

There is still plenty of work ahead. However, the direction is clear: maintain a consistent framework experience while allowing different platforms to use the execution and rendering mechanisms best suited to them.

8. About LeveloJS

LeveloJS is an independent JavaScript framework developed under Motion Mind X, the evolved identity of the original Motion Mind brand. It has been developed under this organization from the beginning.

I am the Founder and Lead Developer of LeveloJS, responsible for its architectural direction and development. Architectural decisions are reviewed under the project's direction before being incorporated into its codebase.

Get Involved

LeveloJS is an open-source project, and contributions are welcome. If you find the architecture interesting, you are welcome to explore the repository.

GitHub logo levelojs / LeveloJS

A lightweight JavaScript framework with zero runtime overhead, targeting the real DOM on the web and a WebView-free native engine. Maintained by Motion Mind X.

Levelo JS logo

Levelo JS

A lightweight JavaScript framework with zero runtime overhead, targeting the real DOM on the web and a WebView-free native engine

npm version MIT license Documentation

A project by Motion Mind X


What is Levelo JS?

Levelo JS is a lightweight JavaScript framework with zero runtime overhead, targeting the real DOM on the web and a WebView-free native engine.

The same source code can target:

  • Web: real DOM output, tiny runtime, fast startup.
  • Native (Windows, early preview): the same JSX is rendered without a WebView, using QuickJS, Taffy (layout) and Skia (drawing). Android is planned.

Features

  • Real DOM rendering, no virtual DOM
  • Fine-grained reactivity: state, effect, computed, batch
  • Lifecycle helpers: mount, cleanup
  • Built-in style and dynamic head management
  • Built-in routing with Pages and Page
  • Custom Babel JSX transform that compiles to direct h() calls
  • One import path for every platform: import { ... } from "levelojs"
  • TypeScript support
…

If you like the project, consider giving it a star. It would mean a lot and help motivate further development.

A framework does not have to be defined by a single renderer. It can have one core philosophy, one consistent development experience, and multiple ways of bringing applications to life.

That is the direction I am exploring with LeveloJS, and this journey is still ongoing.

In-Sha-Allah, there is much more to come.

Top comments (0)