Fragmenium
Fragmenium is a fragment execution engine. It executes HTML, CSS, and
JS as fragments.
Each fragment is executed according to the reference.js file, which makes the application more dynamic, maintainable, and reusable.
All fragments are 100% cleanable. When a previous fragment is no longer neededâespecially
JavaScriptâit can be removed completely.
Fragments are written in pure HTML, CSS, and JS. There is no fancy syntax or special rules required to get started.
Fragment Types
There are four main types of fragments, each executed at different times. In addition, there are some special fragment types.
Type: Constant
Constant fragments are executed only once when the page loads.
Type: Common
Common fragments are executed when visiting pages within a specific directory.
Type: Unique
Unique fragments are HTML-specific and represent static parts of the application. They are executed on every navigation.
Type: Specific
Specific fragments are CSS and JS-specific, designed exclusively for particular pages.
Special Fragment Types
Type: Every is a JS-specific fragment that executes every time navigation occurs.
Type: Swap is an HTML-specific fragment that supports reusability with parameters. It is not page-specific; instead, it acts like a variable with parameter functionality.
Architecture
Fragmenium is built on a fragment-based architecture that provides a true Single Page Application (SPA) experience while ensuring reusability, SEO friendly and maintainability.
A Fragmenium application is composed of both static and dynamic fragments:
- Dynamic fragments â These include Constant, Common, and Swap fragments. They
typically represent reusable fragments such as
header,footer,aside, or other code snippets that appear across multiple pages. Dynamic fragments are not strictly required for SEO, but they are essential for simplifying maintenance and handling frequent updates efficiently. - Static fragments â These form the core content of the application. Static fragments are directly tied to SEO and user engagement, as they represent the unique, page-specific information that search engines index and visitors interact with.
This separation of static and dynamic fragments allows Fragmenium to balance performance and flexibility. Static fragments ensure strong search engine visibility, while dynamic fragments reduce code duplication and make updates easier across the entire application.
By combining these two fragment types, Fragmenium delivers a hybrid architecture: developers can build applications that are both SEO-friendly and highly maintainable, without sacrificing the smooth navigation and responsiveness of an SPA.
Comparison
Fragmenium is a fregment-based execution engine that offers a lightweight alternative to popular frameworks like React and Vue. While React and Vue rely on virtual DOMs, build processes, and custom syntax, Fragmenium focuses on simplicity, direct execution, and maintainability.
| Feature | Fragmenium | React / Vue |
|---|---|---|
| Server-side Execution | No server-side execution; runs directly in the browser with pure JS fregments | Often paired with SSR (Server-Side Rendering) for SEO and performance |
| SEO & URLs | Valid URLs and SEO-friendly by default | Requires SSR or extra configuration for SEO-friendly routing |
| Syntax | No new syntax; uses pure HTML, CSS, and JS fregments | Introduces JSX (React) or template syntax (Vue) |
| SPA Experience | Built-in SPA navigation with fregments | SPA achieved through routing libraries |
| Maintainability | Simple fregment cleanup and reusability | Lifecycle management with hooks (React) or directives (Vue) |
| Module Cleanup | Executes JavaScript inside an iframe, making fregments fully cleanable with no residual
state |
Imported modules cannot be removed from source; developers must write manual cleanup functions, and JavaScript is not 100% clean |
| Compatibility | Works alongside existing frameworks or libraries | Primarily standalone ecosystems; integration possible but heavier |
| Build Process | No build step required | Requires bundlers (Webpack, Vite, etc.) |
| Ease of Use | Very easy to start; no tooling overhead | Steeper learning curve with ecosystem tools |
| Size | Ultra lightweight (~10kb) | Much larger (React ~100kb+, Vue ~80kb+) |
| Performance | Efficient and high performance with direct Fragment execution | Optimized via virtual DOM diffing |
| Reusability | Dynamic fregments (Constant, Common, Swap) enable reuse | Reusable components with props/state |
| Cleanup | Pure JS cleanup; fregments removed when no longer needed | Component unmounting handled by framework lifecycle |
In summary, Fragmenium delivers a minimalistic, fregment-driven architecture that provides SPA-like experiences without build steps, heavy syntax, or large bundle sizes. Its iframe-based execution model ensures true cleanup, something React and Vue cannot achieve natively.
Comparison (Visual)
Use Case
Fragmenium is built for developers who want a lightweight, flexible, and costâefficient way to deliver modern web applications. Its fregment-based architecture makes it simple to adopt and powerful enough to handle both small and large projects.
Where Fragmenium Shines
- Small projects â Stand up quickly with no build step, no new syntax, and instant SPAâlike navigation.
- Large projects â Scales more smoothly than expected because fregments can be reused, cleaned, and maintained without heavy tooling.
- SEOâfriendly sites â Static fregments ensure valid URLs and strong search engine visibility without requiring SSR.
- Cost saving â Nothing needs to execute on the server; all fregments run directly in the browser, reducing infrastructure costs.
- Plugin & library compatibility â Fragmenium doesnât need its own ecosystem. It can use almost any existing JavaScript plugin or framework, as long as it avoids static imports. This opens up a âsea of codeâ already available to developers.
- Rapid prototyping â With only ~10kb of core code and no special syntax, developers can learn.
- Clean lifecycle â JavaScript execution inside iframes ensures pure cleanup, avoiding residual state issues common in React/Vue.
Limitations
- Native app development â Fragmenium is webâonly. React Native and Vue Native extend to mobile platforms, which Fragmenium does not target.
- Community size â Fragmenium is super simple to understand, so it doesnât require a massive community or ecosystem. However, this also means fewer readyâmade patterns compared to React/Vue.
In summary, Fragmenium shines when projects need to be lightweight, costâeffective, and easy to maintain. It leverages the existing JavaScript ecosystem without requiring its own, making it both practical and powerful for modern web development.