Gardener is a lightweight web framework built on top of Express and EJS. It enables building web applications without React or heavy frontend frameworks by using a DOM-first approach with reusable components.
Gardener lets you:
- Build UI using plain HTML, CSS, and JavaScript
- Convert DOM elements into reusable components
- Serve lightweight pages with minimal runtime overhead
Modern frameworks introduce significant abstraction and bundle size overhead.
Gardener focuses on:
- Minimal runtime (~300 lines core)
- Direct DOM control
- Simplicity over abstraction
Define a component
{
"t": "div",
"cn": ["flex", "justify-center", "items-center", "target"],
"children": [
{
"t": "span",
"cn": ["text-xl", "font-bold"],
"txt": "Hello World"
},
{
"t": "button",
"txt": "click",
"events": {
"click": () => console.log('button clicked')
}
}
]
}
You don’t need to write JSON manually.
Instead:
- Write standard HTML
- Select an element (id/class)
- Run the parser → generates reusable component
- Lightweight (~300 lines core, bundled with esbuild)
- No frontend framework dependency
- Reusable components (DOM → JSON)
- Server-side rendering via EJS
- Hot reloading
- Image optimization (Sharp + caching)
- Static build support
- One-command page creation
Gardener follows a simple request → render → enhance flow:
- Express handles routing and backend logic
- EJS renders templates into HTML
- Frontend library enhances DOM with:
- component system
- state handling
- dev tooling
- Static Components
- EJS partials
- Require full page reload
- Dynamic Components
- Generated from DOM → JSON
- Reusable and parameterized
Example parameter:
?title?
This creates a dynamic variable "title".
- Uses Sharp for processing
- Cached images served via:
/static/[image_name]_[width]x[height].webp
- Backend watches file changes
- Generates hash updates
- Frontend polls reload endpoint
- Full page reload triggered on change
- TypeScript
- Express
- EJS
- esbuild
- Sharp
npm create gardener
Gardener is designed for:
- Developers who prefer control over abstraction
- Lightweight applications
- Learning how frameworks work internally
- Partial DOM updates (instead of full reload)
- Better state management primitives
- Devtools / debugging layer
Contributions are welcome! Visit the GitHub repository.
MIT License - See LICENSE file for details.
ritishDas
- GitHub: @ritishDas
- Website: gardener.ritish.site
Built with ❤️ for developers who want to move fast without breaking things.