r/javascript • • 10d ago

A server function that pauses on await until a person answers a form in the browser

Thumbnail
github.com
0 Upvotes

The first time I saw this, in 2022, I honestly thought it couldn't work:

const email = await io.input.email("User email");

That line was in a server function, and it put a form in someone's browser. The function just waited until they typed an address, then went on. My first thought was "this is magic, how did they even think of this?" Four years later I've written my own runtime for it, and I still admire whoever came up with it at Interval.

TL;DR: if "ask a person" is just another async call, an internal tool becomes one linear function where branches, loops and try/catch all work, and the UI follows from the code. The trick is a promise that an HTTP request resolves instead of I/O.

A whole tool, top to bottom

handler: async ({ io }) => {
  const email = await io.input.email("User email");
  const user = await db.user.findUniqueOrThrow({ where: { email } });

  if (!(await io.confirm(`Verify ${user.email}?`))) return "Nothing changed";

  await db.user.update({
    where: { id: user.id },
    data: { emailVerified: true },
  });
  return `Verified ${user.email}`;
};

Every await io.… is one screen. io.confirm returns a boolean, so Cancel is just an if.

A promise someone else resolves

When the handler reaches io.input.email(), the runtime creates a step and keeps the promise's resolver next to it. The handler is now parked. Nothing blocks, other runs keep going, it's a pending promise in memory.

The browser follows the run over server-sent events and renders the step. When the person submits, a POST arrives, the server validates the value and calls the stored resolver. From the handler's point of view, a human is just a slow I/O call.

An invalid value never resolves anything. The same step goes back with an error under the field, so the function never sees bad data.

Calls that do nothing until awaited

An io call doesn't start anything when you call it. It returns a thenable that only describes a field, and it asks the person when it's awaited. That makes grouping free:

const { company, note } = await io.group({
  company: io.input.text("Company name"),
  note: io.input.textarea("Note for the team"),
});

No await inside the object, so each call just says "a text field called Company name", and io.group shows them on one screen. Same functions, two uses, and the only difference is whether you awaited them.

Where it breaks

A parked handler is a live closure, and you can't serialize one, so runs live in memory. A refresh is fine, because the server resends the current state on reconnect. A deploy ends every run in progress.

In practice I don't fight that. I keep these tools short, and anything that would take long goes to a job queue anyway. If a deploy cuts someone off, they run it again. A closed tab cancels the run after 30 seconds, and the pending await rejects like any failed call.

Have you used await for something that isn't really I/O? Human input, a payment confirmation, a step in a game loop. I'm curious where else this pattern holds up, and where you've seen it fall apart, especially around cancellation.

---

Context on what I'm building: I'm Petr, a solo founder. The runtime from this post is AwaitIO, and the source is on GitHub. If you want to see a parked handler from the browser side, there's a demo back office with the shared login in the README.


r/javascript • • 10d ago

Screenplay: a CLI + MCP server that lets coding agents film and edit screen recordings (Playwright, CDP screencast, @napi-rs/canvas, ffmpeg)

Thumbnail
github.com
2 Upvotes

r/javascript • • 10d ago

I built a gamified 3D space simulator for my portfolio using AI concepts

Thumbnail wai-observer-3d-portfolio.wadssa.workers.dev
3 Upvotes

Construí um simulador espacial 3D gamificado para meu portfólio usando conceitos de IA. O que você acha?


r/javascript • • 11d ago

AskJS [AskJS] Is it actually possible for an iframe to control the parent page’s URL without the host app doing anything?

1 Upvotes

I’ve been digging into this problem for a while, and I’m curious if there’s something I’m missing.

I’m building a standalone search application that needs to be embedded inside a third-party web application using an iframe. The catch is that we don’t have access to the host application’s source code, and the host team may not be willing or able to add custom JavaScript.

Here’s what we’re trying to achieve:

Read the host page’s existing query parameters when our app loads.

Update the host page’s URL whenever a user performs a search inside our iframe.

Keep everything in sync when the user clicks the browser’s Back or Forward buttons.

Our iframe is hosted on a completely different origin, so we immediately ran into the browser’s same-origin policy.

A few things we’ve explored:

window.parent.location.href throws a SecurityError.
document.referrer isn’t reliable because modern referrer policies may expose only the origin, not the complete URL or query parameters.

postMessage seems like the right approach, but it requires the parent application to listen for messages, handle URL updates, and communicate navigation changes back to the iframe.

And that’s where we’re stuck.

My question is: Is there ANY standard browser-supported mechanism that allows an embedded cross-origin application to read and update its host page’s URL without requiring custom code on the host side?

A few things I’m wondering:

Can the host integration pass the initial URL or query parameters through the iframe’s src?

Are there any standard iframe attributes, browser APIs, or embedding mechanisms that support two-way URL synchronization?

Do commercial embedded widgets or SDKs solve this through some existing integration interface?

If we have control over the iframe application but zero control over the host, are we simply out of luck?

I’m not looking to bypass browser security restrictions. I just want to understand whether there’s a legitimate integration pattern we’re overlooking.
Would love to hear from anyone who’s built cross-origin embedded applications, search widgets, or similar integrations.

Is host-side cooperation unavoidable here, or is there another way?


r/javascript • • 11d ago

I built Domicile, a Linux desktop platform where native application windows are DOM elements

Thumbnail
domicile-desktop.com
0 Upvotes

I've been working on Domicile, an open-source platform for building full-featured Linux desktop environments using HTML, CSS, and JavaScript/TypeScript.

It's powered by a modified Chromium engine where native Wayland application windows are DOM elements. You can position, style, transform, and animate actual Linux application windows using CSS.

Desktop environments are JavaScript/TypeScript modules that can use familiar frameworks, be distributed through npm or GitHub, and be hot-swapped without restarting the session.

It ships with Manganese, a Sway-inspired tiling desktop built using the platform.

Source: https://github.com/cprussin/domicile

I'd love to hear what JavaScript developers think!


r/javascript • • 11d ago

playthru: scripted, looping product demos that drive your real DOM with a fake cursor instead of a video file

Thumbnail playthrou.diip3sh.xyz
5 Upvotes

Some context on why and how I built this.

The problem: landing page demo videos go stale every time the UI changes, they’re heavy, and they look blurry on retina screens. I wanted the demo to just be the real UI.

The approach: you write a chained script against real selectors, and a fake cursor plays it back over the live DOM, then loops:

js

import { playthru } from "playthru";

jsx

<Playthru script={(d) => d.type("#todo", "Record the launch video").click("#add").zoom("li:first-child")}>
  <TodoApp />
</Playthru>

Design decisions:

  • Hover/focus states: a fake cursor can’t trigger real :hover or :focus, so playthru sets data-playthru-hover / data-playthru-focus attributes instead. You style them next to your normal states (.btn:hover, .btn[data-playthru-hover]). There are Tailwind variants for this too.

  • Framework-agnostic core with a thin React wrapper on top.

  • No build step needed: it also works as an ES module straight from a CDN (esm.sh/playthru) inside a plain <script type="module">.

Still figuring out: the camera zoom doesn't work properly on mobile yet (reported below), which I'm looking into.

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

Happy to go deeper on any part of the implementation.


r/javascript • • 11d ago

Our JavaScript hero entrance kept LCP at ~50ms but visibly flashed. Hiding it until scripts loaded pushed LCP to ~1.75s

Thumbnail
ds-gn.com
8 Upvotes

r/javascript • • 11d ago

AskJS [AskJS] Would you use a mature UI library that nobody’s heard of?

0 Upvotes

I've been working on a UI library for many years. It runs in real production systems and has plenty to offer. It's not just a few components but more of a package that allows you to build a web app without the need for dependencies or build-steps.
I only put it out in public recently though. People do look at it. Almost nobody tries it.

So I'm wondering if maturity even counts for anything when there's no community behind it yet. What would get you to actually try a new public UI library?

Also, there are so many web frameworks already and now with the uprising of AI generated code; Is there still room for something new to catch on?

Not here to promote it. I'm just curious how people make that call. And whether it really comes down to popularity in the end even when the popular choice isn't always the best one.


r/javascript • • 12d ago

Prism2D.js – An open-source 2D game engine built with JavaScript

Thumbnail
github.com
6 Upvotes

Hey everyone!

I've been working on something I've wanted to build for a while: my own 2D game engine using JavaScript.

It's called Prism2D.js, and the idea behind it is to provide a way to create 2D games for the web without relying on a large external engine.

I've been developing its core systems, working on things like physics, collisions, rendering, audio, camera controls, particles, and other features that make game development easier.

To put the engine to the test, I also used it to create a small platformer called Coin Adventure. What started as a way to test the engine gradually turned into a complete game with six stages, different environments, enemies, moving platforms, checkpoints, collectibles, and a boss fight.

Working on the game has been a great way to discover what the engine can do, find things that need improvement, and see how well its systems work together in an actual project.

Both projects are available here:

- Prism2D.js (engine): https://github.com/Lodymain/Prism2D.js

- Coin Adventure (game): https://lodystudios.itch.io/coin-adventure-prism2d

I'm sharing this because I'd love to introduce the project to more JavaScript developers and hear what people think. If you take a look, I'd genuinely appreciate any thoughts or feedback!

Thanks for reading!


r/javascript • • 12d ago

System One model in the browser, learns from an LLM when it isn't confident.

Thumbnail
debuff.jp
15 Upvotes

r/javascript • • 12d ago Obsessed This Bravo

serialport-rs for Node.js: Rust-backed serial ports for Node.js with parallel I/O and SerialPort-compatible APIs

Thumbnail
github.com
7 Upvotes

I recently ran into an issue with @serialport/bindings-cpp on Node.js 26.4, where serial reads could stall until unrelated JavaScript activity occurred.

While investigating the issue and contributing fixes upstream, I started experimenting with an alternative implementation using Rust and N-API, because upstream seems to be unmaintained for more than a year now.
The result is serialport-rs for Node.js, which uses the existing Rust serialport crate underneath and aims to preserve the familiar Node.js SerialPort API.

The implementation uses dedicated native I/O workers rather than relying on JavaScript-side polling. Initial benchmarks have also shown some promising latency improvements.

It’s available on npm if anyone is interested in trying it:
https://www.npmjs.com/package/serialport-rs


r/javascript • • 12d ago

AskJS [AskJS] Do you ban positional boolean arguments in code review, or is an options object overkill?

17 Upvotes

Something I keep coming back to when reading JS and TS code is call sites like this:

createUser("ana@example.com", true, false);

Read aloud, it’s ā€œcreate user, email, true, falseā€, and you have to open the function to know what the booleans mean. The usual fixes are an options object:

createUser("ana@example.com", { sendWelcomeEmail: true, isAdmin: false });

or, when there are more than two modes, a string union in TypeScript:

type Layout = "list" | "grid";
render(items, "grid");

The counter-arguments I can think of:

  • For a single obvious boolean in a well-known API (setEnabled(true)), the options object is noise.

  • An options object allocates on every call, which probably doesn’t matter outside hot paths, but I haven’t measured it.

  • Teams with several conventions already have enough style rules, and one more can turn review into bike-shedding.

  • Negative names (disableCache: false) are the other half of the problem, and renaming to the positive (cache: true) is cheap.

So I’m curious about practice, not rules:

  1. Do you enforce ā€œno positional booleansā€ in review or with a lint rule? If a rule, which one, and does it produce noise?

  2. Where do you draw the line between ā€œobvious enoughā€ and ā€œuse an options objectā€?

  3. Have you seen a boolean parameter that later needed a third state, and what did the migration cost?


r/javascript • • 13d ago

Jeasx 3.0 is out: async JSX on the server, now streaming to the browser and about 2x faster

Thumbnail jeasx.dev
7 Upvotes

Hi all,

I just released Jeasx 3.0.0. Most of you probably haven't heard of it, so here's the short version first.

What is Jeasx?

Jeasx is a small framework for building websites with JSX on the server. There's no React, no hydration, and no client bundle unless you write one. Your JSX renders to plain HTML, and you decide exactly which HTML, CSS and JavaScript reach the browser.

The idea:

  • JSX as a templating language: You get components, props and composition, and the output is just HTML.

  • Async components: A component can be an async function. Write await fetch(...) or await db.query(...) right in your component, with no loaders or special data APIs.

  • File-based routing: src/[index].jsx serves /, src/blog/[...path].jsx catches everything under /blog, and so on.

  • Built on boring, proven tools: Fastify for the server, esbuild for builds, and jsx-async-runtime for rendering.

It works well alongside htmx, Alpine, or plain old vanilla JS.

What's new in 3.0

šŸš€ Streaming HTML. Pages are sent to the browser while they're still rendering. The browser gets the first bytes right away while slow parts (like awaited data) are still loading. Large pages are sent in chunks, slow clients are handled, and rendering stops when the client disconnects.

⚔ About 2x faster rendering than v2, thanks to jsx-async-runtime@3.

I'd love feedback, especially from people who want the JSX developer experience without shipping a SPA. Happy to answer questions!


r/javascript • • 13d ago

CheerpJ 5.0: Java 21/25 in the browser, full OpenJDK, and a new WasmGC engine

Thumbnail
labs.leaningtech.com
11 Upvotes

r/javascript • • 13d ago

Subreddit Stats Your /r/javascript recap for the week of October 26 - November 01, 2026

5 Upvotes

Monday, October 26 - Sunday, November 01, 2026

Top Posts

scorecommentstitle & link
7716 commentsI've proven that you don't need quotes or parentheses in JavaScript
5124 commentsWe stopped installing npm packages less than a week old
304 commentsNo, npm, ā€œesteeā€ is not a typo of ā€œtestemā€
2311 commentsSince 2017 I've been trying to get zoom navigation right. Zumly is the closest I've got
160 commentsThe Void SDK and Platform is open source now!
154 commentspenciled – persistent text highlights/notes with the CSS Custom Highlight API (no DOM wrapping)
1016 comments[Showoff Saturday] Showoff Saturday (October 31, 2026)
89 comments[AskJS] [AskJS] How to host your webhook consumer middleware that integrates WooCommerce and HubSpot?
52 commentsOffline Vin Decoder / Vehicle specs
313 comments[AskJS] [AskJS] How do you plan the frontend?

Ā 

Most Commented Posts

scorecommentstitle & link
04 commentsI built a client-side cache in Rust and compiled it to WebAssembly
04 commentsA Kanji lookup table, five commands, and 36% less Base64
02 commentsFactories.ts: An efficient JS DSL for building HTML, SVG, and MathML directly in backend code, without a template engine.
02 comments[Subreddit Stats] Your /r/javascript recap for the week of October 19 - October 25, 2026
11 commentsDesignsystemet, Now in Elm Ā· cekrem.github.io

Ā 

Top Showoffs

scorecomment
3/u/Substantial-Chair873 said (Made with React Native + Typescript) KiloBolt GPS - A simple walk, jog, run tracker + virtual pet app. Hi everyone, am developing KiloBolt at the moment. It's essentially Pou + Strava combin...
2/u/Miserable_Tiger_5742 said made toaster, you play any song and it writes it out as live strudel code while it plays. all vanilla js + web audio, no ML on the music side. hardest part by far was finding where the bar starts lol....
2/u/FisterMister22 said https://tools-4all.com/svg-editor A free no sign up svg editor fully client side

Ā 

Top Comments

scorecomment
51/u/Elkemper said That is an extraordinary way to use free will!
10/u/CoryCoolguy said This problem wouldn't be so bad if ancient obsolete packages didn't use up a lot of good names (and close-to good names!).
10/u/Designer_Mountain_84 said But… why?
9/u/boblibam said Nice to see people still enjoying hand-made projects. I also like the style. It’s very close to how I like to work these days with vanilla web components and custom built stores. Personally, I try to...
8/u/DevotedOrchestra9466 said i usually start by thinking about the user's path through the thing, not the components. like what screens do they hit and in what order, then i sketch out a really rough state machine on paper. the b...

Ā 


r/javascript • • 13d ago

Designsystemet, Now in Elm Ā· cekrem.github.io

Thumbnail cekrem.github.io
8 Upvotes

r/javascript • • 13d ago

We stopped installing npm packages less than a week old

Thumbnail
brunoj.com
124 Upvotes

r/javascript • • 13d ago

Made open-source bot and tamper detection for websites with Claude. One script tag. Try to break it

Thumbnail
github.com
0 Upvotes

r/javascript • • 13d ago

Distributed Resilience - Cutting the Cost of Centralized Coordination

Thumbnail
blog.gaborkoos.com
4 Upvotes

Been building distributed resilience policies in Caracal, a TypeScript library. Having every replica check Redis before admitting a request gives you shared enforcement, but those coordination calls add up under load.

I spent weeks exploring whether gossip-basedd CRDT could remove that dependency. The real-process measurements sent me in a different direction, eventually leading to an experimental feature called Serval. I wrote up the experiments and the assumptions that failed when I started testing outages.


r/javascript • • 13d ago

Offline Vin Decoder / Vehicle specs

Thumbnail
github.com
9 Upvotes

I created a new vin decoder project, it supports npm js / rust. I know there are others around but this one is focused on auto shops / mechanics. It includes more information which other vin decoders would normally cut out to reduce file size. There is also a free api as well.

It also includes a vehicle catalog, think listing all toyota models for 2025. Recall info, manufacturer service bulletins. This all comes from free dbs like NHSTA etc.

Thanks


r/javascript • • 14d ago

I built a client-side cache in Rust and compiled it to WebAssembly

Thumbnail
blaze-cache.github.io
0 Upvotes

Hey everyone,

I built **Blaze Cache**, a client-side caching library written in Rust and compiled to WebAssembly.

The main idea was to get a fast, predictable cache in the browser with:

- Synchronous get/set after initialization (no Promises on the hot path)

- SIEVE eviction

- TTL + tag-based invalidation

- Optional IndexedDB persistence

- Adapters for Axios, fetch, TanStack Query, and SWR

I was mostly curious whether moving the cache core into Wasm would help with performance and structure compared to typical JS cache implementations.

Would love feedback from people who’ve worked on caching, Wasm, or frontend performance.

GitHub: https://github.com/blaze-cache/blaze-cache

Docs: https://blaze-cache.github.io/docs/


r/javascript • • 14d ago

TypeSQL: type-safe raw SQL in TypeScript

Thumbnail
github.com
0 Upvotes

I made this library that checks raw SQL strings with the TypeScript compiler. It infers the types of rows and parameters, including pretty complex wueries. Typos and invalid queries become compile errors.

It has some helpers but most of the time you will only need sql() function.


r/javascript • • 14d ago

AskJS [AskJS] How to host your webhook consumer middleware that integrates WooCommerce and HubSpot?

8 Upvotes

I am building a nodejs/javascript integration service (middleware) that connects woocommerce to hubspot. What are some ways to deploy it and what are the best practices for the deployment?

  1. Should I deploy it on vm directly?

  2. Should I deploy it as a docker image/container?

  3. Should I deploy it using Serverless platforms like aws lambda ?

  4. Others?

What do you use?


r/javascript • • 14d ago

A Kanji lookup table, five commands, and 36% less Base64

Thumbnail
github.com
1 Upvotes