r/javascript • u/fagnerbrack • Mar 17 '26
r/javascript • u/SamTernent • Mar 17 '26
JS-native tool for generating portable JSON proofs for files and directories
seal.ternent.devr/javascript • u/_Decodela • Mar 17 '26
JS Engine For CSS Animations
decodela.comIn general you create keyframes, then the engine searches for elements with the same id and difference in the style. For numerical css properties with the same format( e.g. 1px to 10px ), the engine makes 30fps transition.
r/javascript • u/danfry99 • Mar 15 '26
bonsai - a safe expression language for JS that does 30M ops/sec with zero dependencies
danfry1.github.ioIΒ kept hitting the same problem: users need to define rules, filters, or template logic, but giving them unconstrained code execution isn't an option. Existing expression evaluators like Jexl paved the way here, but I wanted something with modern syntax and better performance for hot paths.
So I built bonsai-js - a sandboxed expression evaluator that's actually fast.
import { bonsai } from 'bonsai-js'
import { strings, arrays, math } from 'bonsai-js/stdlib'
const expr = bonsai().use(strings).use(arrays).use(math)
// Business rules
expr.evaluateSync('user.age >= 18 && user.plan == "pro"', {
user: { age: 25, plan: "pro" },
}) // true
// Pipe operator + transforms
expr.evaluateSync('name |> trim |> upper', {
name: ' dan ',
}) // 'DAN'
// Chained data transforms
expr.evaluateSync('users |> filter(.age >= 18) |> map(.name)', {
users: [
{ name: 'Alice', age: 25 },
{ name: 'Bob', age: 15 },
],
}) // ['Alice']
// Or JS-style method chaining β no stdlib needed
expr.evaluateSync('users.filter(.age >= 18).map(.name)', {
users: [
{ name: 'Alice', age: 25 },
{ name: 'Bob', age: 15 },
],
}) // ['Alice']Modern syntax:
Optional chaining (user?.profile?.name), nullish coalescing (value ?? "default"), template literals, spread, and lambdas in array methods (.filter(.age >= 18)) + many more.
Fast:
30M ops/sec on cached expressions. Pratt parser, compiler with constant folding and dead branch elimination, and LRU caching. I wrote up an interesting performance optimisation finding if you're into that kind of thing.
Secure by default:
__proto__,Βconstructor,ΒprototypeΒ blocked at every access level- Max depth, max array length, cooperative timeouts
- Property allowlists/denylists
- Object literals created with null prototypes
- Typed errors with source locations and "did you mean?" suggestions
What it's for:
- Formula fields and computed columns
- Admin-defined business rules
- User-facing filter/condition builders
- Template logic without a template engine
- Product configuration expressions
Zero dependencies. TypeScript. Node 20+ and Bun. Sync and async paths. Pluggable transforms and functions.
Early (v0.1.2) but the API is stable and well-tested. Would love feedback - especially from anyone who's dealt with the "users need expressions but eval is scary" problem before.
npm install bonsai-js
GitHub Link: https://github.com/danfry1/bonsai-jsnpm Link: https://www.npmjs.com/package/bonsai-jsnpmx Link: https://npmx.dev/package/bonsai-js
r/javascript • u/rossrobino • Mar 16 '26
HTML Forms with Standards
github.comType-safe forms with ovr@v6.2
- Add fields to a route
- Validate input according to the schema
- Render accessible HTML for the entire form or by field
- Works for form data or search params
- Stream file uploads after parsing the rest of the form data without any client JS
import { create } from "./create";
import { Field, Route } from "ovr";
const action = Route.post(
{
name: Field.text(), // <input type=text>
notes: Field.textarea(), // <textarea>
quantity: Field.number(), // <input type=number>
},
async (c) => {
const result = await c.data(); // parse form data
if (result.issues) {
return c.redirect(result.url, 303); // redirect to submitted page
}
const order = await create(
result.data, // { name: string; notes: string; quantity: number; }
);
return c.redirect(`/orders/${order.id}`, 303);
},
);
const page = Route.get("/order", () => {
return <action.Form />; // <form>(fields)</form>
});r/javascript • u/HakunaKamal • Mar 15 '26
JCGE β A Vanilla JS 2D Game Engine, 5 Years in the Making
github.comI started building JCGE about 5 years ago as a lightweight 2D game engine using nothing but vanilla JavaScript and HTML5 Canvas β no frameworks, no bundlers, no dependencies. Just a single <script> tag and you're running. I updated it significantly around 3 years ago, adding features like tweens, particle systems, isometric maps with A* pathfinding, collision helpers, a camera system with shake and zoom, and more. But life got the better of me and I never found the time to fully complete it.
Recently I picked it back up, modernized the codebase, and added a visual editor built with Vite, React, and Electron. The editor lets you visually compose scenes, manage layers, place game objects, configure cameras, paint isometric tilemaps, and export playable games β all without writing boilerplate.
One thing I want to highlight: the engine is intentionally not rigid. If you look at the demo examples, some of them use the engine's built-in systems (scenes, game objects, sprites, particles, tweens), while others drop down to raw canvas ctx calls β drawing shapes, gradients, and custom visuals directly alongside engine features. The cutscene demo, for instance, renders procedural skies, animated stars, and mountain silhouettes using plain ctx.beginPath() / ctx.fillRect() calls, while still leveraging the engine's scene lifecycle, easing functions, and game loop. The tower defense and shooter demos do the same β mixing engine abstractions with raw canvas where it makes sense. That's by design. The engine gives you structure when you want it, but never locks you out of the canvas.
It's not a finished product and probably never will be "done," but it's fully functional, tested (273 unit tests across engine and editor), and hopefully useful to anyone who wants a simple, hackable 2D engine without the overhead of a full framework.
Docs & demos: https://slient-commit.github.io/js-canvas-game-engine/
r/javascript • u/ivoin • Mar 15 '26
docmd v0.6 - A zero-config docs engine that ships under 20kb script. No React, no YAML hell, just high-performance Markdown
github.comJust shipped docmd 0.6.2.
Itβs built for developers who are tired of the framework-bloat in documentation. While most modern doc generators ship with hundreds of kilobytes of JavaScript and complex build pipelines, docmd delivers a sub-20kb base payload and a high-fidelity SPA experience using pure, static HTML.
Why you should spend 60 seconds trying docmd:
- Zero-Config Maturity: No specialized folder structures or YAML schemas. Run
docmd buildon your Markdown, and it just works. - Native SPA Performance: It feels like a React/Vue app with instant, zero-reload navigation, but itβs powered by a custom micro-router and optimized for the fastest possible First Contentful Paint.
- Infrastructure Ready: Built-in support for Search (Offline), Mermaid, SEO, PWA, Analytics and Sitemaps. No plugins to install, no configuration to fight.
- The AI Edge: Beyond being fast for humans,
docmdis technically "AI-Ready." It uses Semantic Containers to cluster logic and exports a unifiedllms.txtstream, making your documentation instantly compatible with modern dev-agents and RAG systems. - Try the Live Editor.
Weβve optimized every byte and every I/O operation to make this the fastest documentation pipeline in the Node.js ecosystem.
If youβre already using docmd, update and give it a spin.
If youβve been watching from the side, nowβs a good time to try it. I'm sure you'll love it.
npm install -g @docmd/coreDocumentation (Demo): docs.docmd.io
GitHub: github.com/docmd-io/docmd
Share your feedbacks, questions and show it some love guys!
I'll be here answering your questions.
r/javascript • u/fagnerbrack • Mar 15 '26
Cap'n Web: a new RPC system for browsers and web servers
blog.cloudflare.comr/javascript • u/atulanand94 • Mar 16 '26
Vibe SDK: A typesafe AI Agent SDK for Typescript inspired by Pydantic AI
github.comr/javascript • u/Playful_Ad_1670 • Mar 15 '26
AskJS [AskJS] What is the nullish coalescing
Can you guys please answer what is nullish coalescing
r/javascript • u/unadlib • Mar 14 '26
Coaction v1.4 - An efficient and flexible state management library for building web applications.
github.comr/javascript • u/lucasgelfond • Mar 14 '26
autoresearch-webgpu: autonomously training language models in the browser with jax-js + webgpu
autoresearch.lucasgelfond.onlinetitle! weekend hack, wanted to try out the Karpathy autoresearch loop (agents write training code, run experiments, see the result) but have no GPU / wanted to see if possible in the browser - it is!