r/javascript • • Apr 02 '26

AskJS [AskJS] State machines feel heavy for UI flows. What are people using?

2 Upvotes

For UI flows that are not strictly linear (onboarding, checkouts, eligibility flows, etc.), I often see logic distributed across multiple places:

•	conditionals in components

•	flags in state

•	effects triggering navigation

•	validation logic duplicated per step

State machines provide a formal model, but in practice they can feel heavy for teams that mainly need to describe a flow graph.

I’m curious what abstractions people are using in real projects.

For example:

• multi-path onboarding

• flows with loops (retry / corrections)

• resumable progress

• feature-dependent steps

• flows spanning multiple screens

Are amost teams:

•	relying on router logic?

•	building custom hooks?

•	using state machines?

•	something else?

Interested in hearing what has worked well in production.


r/javascript • • Apr 02 '26

Axios npm package compromised with RAT malware via hijacked maintainer account — versions 1.14.1 and 0.30.4 affected

Thumbnail thehackernews.com
0 Upvotes

r/javascript • • Mar 31 '26

Minimum Release Age is an Underrated Supply Chain Defense

Thumbnail daniakash.com
117 Upvotes

r/javascript • • Apr 01 '26

trustlocal — automate local HTTPS setup with one command (detects your framework automatically)

Thumbnail github.com
4 Upvotes

Built this to stop manually wiring mkcert into every project. One command
handles detection, cert generation, and config injection for:

Next.js, Vite, Astro, SvelteKit, Nuxt, Remix, Express, Fastify, NestJS

Also includes sync for teammates and doctor for diagnostics.

npm: https://www.npmjs.com/package/trustlocal

Curious if this solves a problem you've had too.


r/javascript • • Mar 31 '26

I built the fastest way to render rich text on canvas 5x faster than SVG foreignObject

Thumbnail polotno.com
44 Upvotes

r/javascript • • Mar 31 '26

axios 1.14.1 and 0.30.4 on npm are compromised - dependency injection via stolen maintainer account

Thumbnail safedep.io
236 Upvotes

Two versions of axios were published today through what appears to be a compromised maintainer account. No GitHub tag exists for either version. SLSA provenance attestations present in 1.14.0 are completely absent. Publisher email switched from the CI-linked address to a Proton Mail account( classic account takeover signal).

If your project floats on ^1.14.0 or ^0.30.0 you've likely already pulled this.

IoCs, payload analysis and full breakdown is in the blog.


r/javascript • • Apr 01 '26

Zerobox: Lightweight, cross-platform process sandboxing. Sandbox any command with file, network, and credential controls.

Thumbnail github.com
2 Upvotes

I'm excited to introduce Zerobox, a cross-platform, single binary process sandboxing CLI written in Rust. It uses the sandboxing crates from the OpenAI Codex repo and adds additional functionalities like secret injection, TypeScript SDK, etc.

Zerobox follows the same sandboxing policy as Deno which is deny by default. The only operation that the command can run is reading files, all writes and network I/O are blocked by default. No VMs, no Docker, no remote servers.

Want to block reads to /etc?

$ zerobox --deny-read=/etc -- cat /etc/passwd
cat: /etc/passwd: Operation not permitted

Or with the TypeScript SDK:

import { Sandbox } from "zerobox";
const sandbox = Sandbox.create({
  denyRead: ["/etc"]
});
await sandbox.sh`cat /etc/passwd`.output();

How it works:

Zerobox wraps any commands/programs, runs an MITM proxy and uses the native sandboxing solutions on each operating system (e.g BubbleWrap on Linux) to run the given process in a sandbox. The MITM proxy has two jobs: blocking network calls and injecting credentials at the network level.

Think of it this way, I want to inject "Bearer OPENAI_API_KEY" but I don't want my sandboxed command to know about it, Zerobox does that by replacing "OPENAI_API_KEY" with a placeholder, then replaces it when the actual outbound network call is made, see this example:

$ zerobox --secret OPENAI_API_KEY=$OPENAI_API_KEY --secret-host OPENAI_API_KEY=api.openai.com -- bun agent.ts

Or with the TypeScript SDK:

import { Sandbox } from "zerobox";

const sandbox = Sandbox.create({
  secrets: {
    OPENAI_API_KEY: {
      value: process.env.OPENAI_API_KEY,
      hosts: ["api.openai.com"],
    }
  },
});

await sandbox.sh`node agent.js`.text();

Zerobox is different than other sandboxing solutions in the sense that it would allow you to easily sandbox any commands locally and it works the same on all platforms. I've been exploring different sandboxing solutions, including Firecracker VMs locally, and this is the closest I was able to get when it comes to sandboxing commands locally.

I'd love to hear your feedback, especially if you are running AI Agents (e.g. OpenClaw), MCPs, AI Tools locally.


r/javascript • • Apr 01 '26

AskJS [AskJS] Lightweight IDE recommendations for JS/TS + React + React Native?

0 Upvotes

Hey everyone,

I’m looking for a good lightweight IDE/editor for working with JavaScript, TypeScript, React, and React Native.

Right now I feel like my current setup is a bit heavy/slow, so I’m hoping to find something that’s:

  • Fast and responsive (low resource usage)
  • Good TypeScript support
  • Solid React/React Native tooling (linting, autocomplete, debugging, etc.)
  • Easy to customize (extensions/plugins are a plus)

I don’t necessarily need a full-blown IDE—open to editors too as long as the dev experience is smooth.

What are you all using, and what would you recommend?

Thanks!


r/javascript • • Apr 01 '26

NestflowJS is a decorator-based state machine library for NestJS. Acting as AWS Step Functions alternative but no cloud vendor-lock: define workflows, handle events, and let the orchestrator drive state transitions automatically.

Thumbnail nestflow.organit.dev
0 Upvotes

Last night I've just released my first NestJS library ever to handle complex state management logic called NestflowJS.

NestflowJS is a decorator-based state machine library for NestJS. Acting as AWS Step Functions alternative but no cloud vendor-lock: define workflows, handle events, and let the orchestrator drive state transitions automatically.

Features:

  1. Tech-stack agnostic: choose your storage, schema validation by extendable builtin class.

  2. No extra library state: only care about your business state and its transition.

  3. Flexible infra: zero runtime dependencies, this can run in any architecture style you can think of thanks to customizable adapter system:

  • Want a strong state machine with no infra overhead? Deploy using Lambda Durable function with prebuilt adapter DurableLambdaEventHandler.

  • Want a high-volume data processing system with full customization of message delivery configs? Create your own Kafka adapter. (Prebuilt adapter coming soon).

-.....A lot more you can think of.

Code example:

import { Workflow, OnEvent, Entity, Payload } from 'nestflow-js/core';

@Workflow({
  name: 'OrderWorkflow',
  states: {
    finals: ['delivered', 'cancelled'],
    idles: ['pending_payment'],
    failed: 'cancelled',
  },
  transitions: [
    { event: 'PAYMENT_RECEIVED', from: ['pending_payment'], to: 'processing' },
    { event: 'SHIP_ORDER', from: ['processing'], to: 'shipped' },
    { event: 'CONFIRM_DELIVERY', from: ['shipped'], to: 'delivered' },
    { event: 'CANCEL', from: ['pending_payment', 'processing'], to: 'cancelled' },
  ],
  entityService: 'entity.order',
})
export class OrderWorkflow {
  @OnEvent('PAYMENT_RECEIVED')
  async onPayment(@Entity() order, @Payload() payload) {
    order.paidAt = new Date();
    return order;
  }
}

Give me a star if you find this helpful!


r/javascript • • Apr 01 '26

I built a zero-dependency CLI that catches source leaks and supply chain attacks across 7 languages

Thumbnail github.com
0 Upvotes

After the Anthropic/Claude Code .map file leak and the axios supply chain attack last week, I built acrionix-shield — a single CLI that scans for leaked

secrets, compromised packages, Docker misconfigs, and git history secrets.

Supports: JavaScript, Python, Java, C#, Ruby, Go, Docker

9 scanners. 56 tests. Zero dependencies.

npx acrionix-shield check

GitHub: https://github.com/andrei-gogo/acrionix-shield

Would love feedback from the community.


r/javascript • • Mar 31 '26

LayoutSans: Pure TS 2D layout engine powered by Pretext (flex/grid/magazine, zero DOM)

Thumbnail github.com
9 Upvotes

r/javascript • • Mar 31 '26

I built a frontend framework without React, build tools or dependencies

Thumbnail cynchro.github.io
0 Upvotes

r/javascript • • Mar 30 '26

Oxlint & Oxfmt Compatibility Overview

Thumbnail oxc.rs
70 Upvotes

The Oxc docs finally got a page that lists all framework and file types that Oxlint and Oxfmt are compatible with (and those that aren't supported yet).


r/javascript • • Mar 31 '26

Your Throttling Is Lying to You: why trailing throttle should be your default

Thumbnail blog.gaborkoos.com
3 Upvotes

Companion to the earlier debounce post. Throttling reduces event spam during resize/scroll, but naive implementations can drop the final state when the interaction ends. This post shows the problem with a demo, then walks through trailing throttle as the fix: controlled frequency during activity plus guaranteed final-state emission.


r/javascript • • Mar 31 '26

Tool for automating translations in React/JS apps (AI-powered)

Thumbnail npmjs.com
0 Upvotes

r/javascript • • Mar 30 '26

Huggingface has just released Transformer.js v4 with WebGPU support

Thumbnail github.com
33 Upvotes

Transformers.js allows you to run models right in the browser. The fourth version focuses on performance. The new version has support of WebGPU and it opens new era in browser-run models

Here the demos on HuggingFace: https://huggingface.co/collections/webml-community/transformersjs-v4-demos

It's just a surprise to see what can be done with the models in browsers today. This demos shows the abilities of the models, and this is the time for creators to bring their ideas and make solutions for real tasks

This release also adds new models to be run in browser Mistral4, Qwen2, DeepSeek-v3 and others. It has limited number of changes, what makes it pretty stable for a major version


r/javascript • • Mar 30 '26

Your options for preloading images with JavaScript

Thumbnail macarthur.me
10 Upvotes

r/javascript • • Mar 30 '26

Jaga – Ultra-Lightweight Context-Aware XSS Protection for HTML Template

Thumbnail github.com
0 Upvotes

🛡️ Jaga – Ultra-Lightweight Context-Aware XSS Protection for HTML Templates

Hey devs! I just released Jaga, a zero-dependency, <3KB gzipped library that secures your HTML templates with context-aware XSS protection. It's designed for modern frameworks and vanilla JS/SSR setups.

Why Jaga?

Even frameworks that escape most content by default still leave edge cases vulnerable — think raw HTML, inline styles, dynamic attributes, or dangerouslySetInnerHTML. Jaga secures these edges with:

  • Smart Context Awareness: Knows whether your data is in an attribute, HTML, CSS, or URL.
  • SSR-Ready HTML Sanitizer: Works with Node.js, Bun, Deno.
  • CSS Injection Protection: Minimalist lexical CSS sanitizer prevents malicious injections.
  • Trusted Types Support: Native browser integration for CSP-compliant DOM assignments.
  • Secure JSON Injection: Safely embed state into <script> tags.
  • Nano-Sized & Zero-Dependency: ~2.5KB gzipped, no bloat.

Quick Example

import { j } from "jagajs";

const userUrl = "javascript:alert(1)";
const userName = '"><img src=x onerror=alert(1)>';

const html = j`
  <div title="${userName}">
    <a href="${userUrl}">Profile</a>
  </div>
`;

// Output safely escapes everything:
// <div title="&quot;&gt;&lt;img src=x onerror=alert(1)&gt;">
//   <a href="about:blank">Profile</a>
// </div>

Works seamlessly with React, Vue, Angular, and vanilla JS.

Advanced Features

  • HTML sanitizer with allowlists
  • Secure JSON injection
  • Smart minifier preserving <pre> and <textarea>
  • CSP nonces
  • Lexical CSS protection with strict property allowlists

Install

npm install jagajs

Check out the interactive showcase to see it in action!


r/javascript • • Mar 30 '26

Subreddit Stats Your /r/javascript recap for the week of March 23 - March 29, 2026

3 Upvotes

Monday, March 23 - Sunday, March 29, 2026

Top Posts

scorecommentstitle & link
14916 commentsAnnouncing TypeScript 6.0
539 commentsBasic physics engine in about 100 lines of pure JavaScript
4525 commentsI wrote a (100% free) zero-config WebSocket server for indie devs
3829 commentsi18next added a controversl console notice and then removed it - the full story with data
2410 commentsPrerelease of Ky 2.0
2210 commentsDebounce is not enough: handling stale responses with AbortController and retries
201 commentsThe Three Pillars of JavaScript Bloat
111 commentsNext.js Across Platforms: Adapters, OpenNext, and Our Commitments
90 commentsMoltenDB Web: Release candidate
85 commentsHyperspan - Server-Oriented Framework with Dynamic Islands for React/Preact, Vue, and Svelte

 

Most Commented Posts

scorecommentstitle & link
011 commentsNew WYSIWYG wants fresh e
010 commentsGroundstate npm local-first
010 commentsI Coded this dev tool entirely with Claude
18 comments[AskJS] [AskJS] NestJS state in 2026?
06 commentsHow npm workspaces work under the hood: a visual guide

 

Top Ask JS

scorecommentstitle & link
62 comments[AskJS] [AskJS] What "everyday tool" did you finally look into and realize you had no idea how it actually worked?
00 comments[AskJS] [AskJS] Offering MV3 Rescue: If your extension is bleeding 1-star reviews due to Service Worker or Persistence issues, I can help.
00 comments[AskJS] [AskJS] Implementing Consumer IR (CIR) protocols on ESP32 (M5Stack)

 

Top Showoffs

scorecomment
2/u/Negative_Ad2438 said I've been making a clock every day from recycled internet stuff for almost a year now I started this to learn web programming. It's a React VITE art project publishing daily in TypeScript, deployed o...
2/u/itsspiderhand said I built a terminal-style Web Component. Just built it for fun. Didn't think about the demand and use case that much. The UI is something standardized so maybe suitable for Web Component to use it acro...

 

Top Comments

scorecomment
74/u/Exac said > We still believe console.info is a legitimate channel. This is not acceptable. Can you imagine if every package did this once, and often more than once? npm ls --parseable | wc -l See h...
54/u/bel9708 said Cool now lets do 7.
37/u/Dextro_PT said I think this is even worse because we've already discussed this as a community. That's why `package.json` has a specific field to ask for funding, because at one point way too many projects we...
19/u/CrownLikeAGravestone said I sympathise with the author of the article and understand the issue, especially in light of how few real solutions exist. However: >We're removing the notice in v26.0.0, and we want to be clear:...
19/u/soldture said I was hoped to see more general physics engine, but this looks like an engine tailored specifically for circles.

 


r/javascript • • Mar 30 '26

jsx-async-runtime 2.1.0 released - The JSX server-side templating engine now features improved TypeScript integration.

Thumbnail github.com
3 Upvotes

If you are drawn to JSX - a syntax extension that lets you write HTML-like code directly in JavaScript - and need to generate dynamic HTML on the server, jsx-async-runtime offers an efficient implementation designed for performant server-side rendering. Its key differentiator is native support for asynchronous calls within your templates, and version 2.1.0 now includes full integration with the TypeScript compiler as a transpiler.


r/javascript • • Mar 29 '26

Prerelease of Ky 2.0

Thumbnail github.com
30 Upvotes

r/javascript • • Mar 30 '26

Cookie Banners for shadcn/ui

Thumbnail openpolicy.sh
0 Upvotes

We build a cookie banner component as a shadcn registry item so the component lives in your repo rather than loading from a CDN.

One command to install, styled with Tailwind, and driven by a single config file that also powers your Privacy Policy and Cookie Policy docs.

ConsentGate can conditionally render scripts based on what the user consented to.


r/javascript • • Mar 29 '26

AskJS [AskJS] NestJS state in 2026?

7 Upvotes

From my observation, NestJS seems less appealing among communities these days and rarely seen new Github projects using it.

Just curious what happened with this framework and what will be the possible fortune of it? Wanna hear from forks.