dagger.js

October 3, 2025 · View on GitHub

dagger.js is a lightweight, zero-boilerplate, pure runtime front-end framework built for developers who value simplicity and performance. It brings a pure HTML + JavaScript development experience with no virtual DOM, no compilation step, and no complex abstractions — just clean, declarative UI.


✨ Features

  • Zero Learning Curve: Use plain HTML and native JavaScript — no JSX, no DSLs, no build tools required.
  • Zero API: dagger.js works in pure declarative mode, modules and directives provide everything you need to build your application.
  • Reactive by Nature: Automatic UI updates when your data changes — no manual DOM updates.
  • Built-in Routing: Simple, declarative routing system with no third-party dependency.
  • Modular by Design: Clear separation of logic and template, with automatic scoped data.
  • Tiny & Fast: Core runtime is just a few KB, with near-native performance.
  • Web Native: Fully compatible with Web Components (such as https://shoelace.style/) and modern browser APIs.

✨ Installation

Simply insert the following script tag (CDN) insides the head section of the entry html page of your application to setup dagger.js:

<script type="module" crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/@peakman/dagger.js@0.9.21/dagger.js" defer></script>

Or install dagger.js via npm:

npm install @peakman/dagger.js

✨ Directive Reference

dagger.js provides a set of pre-defined directives to declaratively render UI elements and bind data to them:

DirectiveDescription
*checkedDynamically toggle the checked state
*classDynamically toggle class names
*focusSet focus on element when true
*textRender plain text
*htmlRender raw HTML
*eachLoop through an array
*existConditional rendering
*valueTwo-way binding for input elements
*selectedDynamically toggle the selected state
*styleDynamically bind style values
*watchRun expression when dependencies change
+eventNameEvent binding, e.g., +click, +keyup
+loadRun before the element is created
+loadedRun after the element is mounted
+unloadRun before the element is removed
+unloadedRun after the element is removed
+sentryRouter guards
@rawRender raw HTML content without parsing
@directiveDynamically adding directives

📘 See full directive documentation →


✨ Module Configuration

dagger.js provides a simple and intuitive way to configure reusable modules for your application:

<script type="dagger/modules">
    {
        "view_module": "#view",
        "script_module": "#script",
        "style_module": "#style"
        ...
    }
</script>

📘 See full module documentation →


✨ Router Configuration

Router is a built-in feature of dagger.js that allows you to easily define routes and handle navigation between them:

<script type="dagger/routers">
    {
        "mode": "hash",
        "prefix": "",
        "default": "/",
        "routing": {
            "path": "",
            "tailable": true,
            "constants": {
                "title": "root title",
                "template": "view1"
            },
            "variables": {
                number: 0
            },
            "modules": ["script", "view1"],
            "children": [{
                "path": "parent1",
                "tailable": true,
                "constants": {
                "title": "parent1 title",
                "template": "view2"
                },
                "modules": "view2"
            }]
        }
        ...
    }
</script>

📘 See full router documentation →


✨ Demos

CSS Mechanical Keyboard

https://github.com/user-attachments/assets/40e1abc5-0e12-454a-801a-faff764457b6

3D Tic Tac Toe

https://github.com/user-attachments/assets/9d6660c8-ce7b-40ef-8dc7-69ba3135bbd8

Tesla

https://github.com/user-attachments/assets/5550650c-d309-4f51-844c-767dea69a842

Cards

https://github.com/user-attachments/assets/57d3a244-3591-4ef5-9edd-fa52488bf5e4

screensaver

https://github.com/user-attachments/assets/26229588-e63e-40a2-9c1e-d13b5bbd96ba

Circular Progress Bar

https://github.com/user-attachments/assets/136c43ad-1144-4d31-a91f-2a5e9c029597

Color Picker

https://github.com/user-attachments/assets/2055c1e5-99b8-4142-aa71-fa567cc8f563

Text Animation

https://github.com/user-attachments/assets/bfd0ef8e-4046-4e00-89ce-b89bb1649529

https://github.com/user-attachments/assets/a88cbbbe-9c23-4579-b9e8-3f62d89b9315

And more demos on how to work with Shoelace components.


✨ Contributing

We welcome all contributions! You can help by:

  • Reporting bugs and issues

  • Submitting pull requests for features or documentation

  • Writing tutorials or sharing your use cases

  • Spreading the word on social media


✨ Support Us

If you like dagger.js, you may:

  • Star us on GitHub

  • Share your projects and demos

  • Join the discussions or rise issues


✨ Resources


✨ License

MIT