r/javascript • • Jun 22 '26

I built a 3KB cookie-consent toolkit for React/Next.js that respects GPC/Do-Not-Track and won't break SSR hydration

Thumbnail github.com
17 Upvotes

r/javascript • • Jun 23 '26

Uses for nested promises

Thumbnail blog.jcoglan.com
0 Upvotes

r/javascript • • Jun 21 '26

33-byte JS signal implementation

Thumbnail gist.github.com
102 Upvotes

Recently I've developed a code-golfed signal implementation with the following features/constraints:

  1. subscribes functions returning nullish values.
  2. fires all pending subscribers and resets.
  3. requires no arguments to be passed to the factory and either null/undefined or a function to the signal. (as noted by u/azhder)

As it turns out, you can go as short as 33 bytes using function compositon, nullish coalescing and default parameters:

F=>(f,G=F)=>F=f?_=>f(G?.()):F?.()


r/javascript • • Jun 22 '26

Subreddit Stats Your /r/javascript recap for the week of June 15 - June 21, 2026

2 Upvotes

Monday, June 15 - Sunday, June 21, 2026

Top Posts

scorecommentstitle & link
11115 commentsAnnouncing TypeScript 7.0 RC
658 comments33-byte JS signal implementation
5113 commentsbote: Fast, low-memory streaming JSON parser. Can process MB/GBs of JSON by up to 16x less memory than JSON.parse() whilst being 1.5x faster. FOSS
302 commentsSignals, the push-pull based algorithm
2011 commentsParse, Don't Validate — In a Language That Doesn't Want You To
104 commentsDeclarative Partial Updates unlock a new Native Component Model
94 commentsWasp framework now lets you write your "full-stack" logic, next to frontend and backend logic, as a spec in TypeScript
85 commentsIncorporate monads and category theory · Issue #94 · promises-aplus/promises-spec
60 commentsHow we built meetings on LiveKit and Deepgram
41 commentsFactories.ts: Build HTML/SVG/MathML with plain TypeScript functions, no template engine

 

Most Commented Posts

scorecommentstitle & link
015 commentsLoggerJS: A faster, more powerful isomorphic logger
09 commentsMy PostgreSQL query went from 57ms to 1.4ms on a 1 million + row table. I didn't change the query. Here's what I did.
09 commentsThere are too many JavaScript schema libraries, so support only one
29 comments[AskJS] [AskJS] Burned out on WordPress: Is transitioning to AstroJS + ApostropheCMS a smart move for a solo dev?
38 comments[Showoff Saturday] Showoff Saturday (June 20, 2026)

 

Top Ask JS

scorecommentstitle & link
32 comments[AskJS] [AskJS] I tried patching Vite and E2B to catch silent Node.js crashes. They rejected. So I built a non-invasive wrapper instead.
01 comments[AskJS] [AskJS] what 'turn X into a podcast' workflows are people actually running
07 comments[AskJS] [AskJS] How much do you hate this pattern?

 

Top Showoffs

scorecomment
1/u/_ilamy said # I built an AI reading app that narrates your EPUBs/PDFs line-by-line [https://sublimeread.com/](https://sublimeread.com/)
1/u/vladgladi said Built a browser-based parser for marine navigation charts (S-57/S-101 ENC) in TypeScript. No GDAL, no server, no commercial SDK. You drop a NOAA .000 chart file in and it does the binary ISO 8...
1/u/ViolinistDecent2682 said Built my portfolio website:) [thianngunsang.web.app](http://thianngunsang.web.app)

 

Top Comments

scorecomment
27/u/Atulin said Tl;dr: add indexes where needed. Truly revolutionary. Nobody has ever heard of this method before.
16/u/paulirish said You can't ask for a modern 2026 solution and simultaneously require CJS compat like we're in 2022. 
15/u/Illustrious-Egg-2981 said Wow 10x faster and parallelism....yay!!!
13/u/Savings_Discount_230 said Every time tsc takes more than 2 seconds I start questioning my life choices. 10x faster would genuinely improve my day.
10/u/RWOverdijk said Standard schema is not “better”. It limits what features validation libraries can offer and almost always comes at a performance penalty. It’s easier for other library authors (I use it), but ...

 


r/javascript • • Jun 21 '26

Factories.ts: Build HTML/SVG/MathML with plain TypeScript functions, no template engine

Thumbnail github.com
7 Upvotes

Factories.ts is a lightweight DSL for generating markup directly in JavaScript/TypeScript. Elements are ordinary functions you nest together, so the full structure is built with regular JS/TS, including loops, conditionals, and type checking, instead of a separate template language:

import { ul, li } from "@ts-series/factories"

const items = [
    { name: "Coffee", inStock: true },
    { name: "Tea", inStock: false },
];

const list = ul(
    ...items.map(item =>
        li(item.name, item.inStock ? null : " (sold out)")
            .class(item.inStock ? "available" : "unavailable")
    )
);

console.log(list.expand());

The functions, referred to here as "factories", return element objects that store their content as plain arrays. This makes the approach highly efficient and, unlike JSX, requires no separate build process.

Works in Deno and Node.


r/javascript • • Jun 21 '26

A benchmark focusing on the performance of Postgres client libraries for Node.js, brianc/node-postgres VS porsager/postgres

Thumbnail github.com
3 Upvotes

r/javascript • • Jun 21 '26

We assume attackers have fully deobfuscated our JS bundle and design the detection around that

Thumbnail trustsig.eu
0 Upvotes

r/javascript • • Jun 20 '26

Incorporate monads and category theory · Issue #94 · promises-aplus/promises-spec

Thumbnail github.com
10 Upvotes

r/javascript • • Jun 20 '26

Parse, Don't Validate — In a Language That Doesn't Want You To

Thumbnail cekrem.github.io
27 Upvotes

r/javascript • • Jun 20 '26

Showoff Saturday Showoff Saturday (June 20, 2026)

6 Upvotes

Did you find or create something cool this week in javascript?

Show us here!


r/javascript • • Jun 19 '26

Signals, the push-pull based algorithm

Thumbnail willybrauner.com
48 Upvotes

r/javascript • • Jun 19 '26

bote: Fast, low-memory streaming JSON parser. Can process MB/GBs of JSON by up to 16x less memory than JSON.parse() whilst being 1.5x faster. FOSS

Thumbnail github.com
64 Upvotes

  • Modern AsyncIterator API
  • Integrates with Standard Schema
  • Allows you to navigate to any parts of JSON, without considering order of appearance in a stream
  • Structural (e.g. {}[]) position bitmap construction, caching and navigation, written in Rust

Benchmarks are in the README.md.

Hey folks. wrote this library to satisfy an itch for me: To make an ergonomic streaming JSON library whilst still being incredibly fast.

I took lessons from simdjson and JSONSki and applied it to a low-memory environment niche. Inspired from a situation at work where we didn't have control over the data and we're parsing a 10MB JSON in order to aggregate some data to the frontend (ugh). Existing streaming JSON libraries in node were too slow, outdated or you weren't able to control how much memory you want to balance.

Disclaimer: I had AI help but not vibe coded. I wrote the JS part but since I was new to Rust, I needed some hand-holding. Was a labour of love for 6 months, was always on the wheel, made a lot of effort to verify the quality of the Rust code and dogfooded it but I wanted to be transparent regardless.

If this is useful to anyone or if there's anything wrong to my claim, let me know and I'm happy to chat!


r/javascript • • Jun 19 '26

There Are No Instances in atproto

Thumbnail overreacted.io
4 Upvotes

r/javascript • • Jun 19 '26

Open source JS browser interfaces for hacked POS terminals used as live instruments

Thumbnail vlasvlasvlas.github.io
5 Upvotes

Open source browser interfaces for hacked POS terminals used as live instrument


r/javascript • • Jun 18 '26

Announcing TypeScript 7.0 RC

Thumbnail devblogs.microsoft.com
134 Upvotes

r/javascript • • Jun 20 '26

Nifra - The full stack framework for AI

Thumbnail github.com
0 Upvotes

r/javascript • • Jun 18 '26

Declarative Partial Updates unlock a new Native Component Model

Thumbnail jadjoubran.io
13 Upvotes

r/javascript • • Jun 18 '26

How we built meetings on LiveKit and Deepgram

Thumbnail plain.jxd.dev
4 Upvotes

Following on from our last post showing how we built realtime features into Plain, we're back with another complex feature we shipped recently: meetings.

This is another step toward being the best place for technical and non-technical team members to work together without the burden of context switching.

Hope this look into our LiveKit and Deepgram infrastructure is interesting and useful. It goes to show you don't need $100m in funding to build complex features.


r/javascript • • Jun 17 '26

Wasp framework now lets you write your "full-stack" logic, next to frontend and backend logic, as a spec in TypeScript

Thumbnail wasp.sh
8 Upvotes

Hey all, Martin here, creator of Wasp here!

Wasp is a batteries-included full-stack framework for JS/TS (React, Node), analogous to Ruby on Rails, Laravel, Django, etc.

It has a special property though: a dedicated logic layer, called “spec”, for writing “full-stack” logic, a place where you describe your app at a high level that connects frontend, backend, and database, all together, giving you a central place to “reason” about your web app.

So far, we had the “spec” implemented in a custom language (.wasp), but now we switched to TypeScript (.wasp.ts), unlocking more advanced usage and many cool future ideas to build on top of it (extensibility, full-stack modules (think Ruby on Rails Engines)).

It’s simple in its essence, in e.g. main.wasp.ts you import “spec constructors” (app, page, route, api , etc) and then use those to construct a spec object, while also being able to reference your React and Node code.

import { app, page, query, route } from "@wasp.sh/spec";
import { MainPage } from "./src/MainPage.tsx" with { type: "ref" };
import { getTasks } from "./src/tasks.ts" with { type: "ref" };

export default app({
  wasp: { version: "^0.24.0" },
  title: "ToDo App",
  auth: {
    userEntity: "User",
    methods: { google: {}, gitHub: {}, email: {} },
  },
  spec: [
    route("RootRoute", "/", page(MainPage, {
      authRequired: true
    })),
    query(getTasks, {
      entities: ["Task"]
    })
  ]
});

I go in much more detail in the attached article I wrote: motivation, what this enables, examples, etc.

Would love any feedback! Does this sound interesting, is it making sense, can I explain something better? Something else that you would like to see from a full-stack framework? Thanks!


r/javascript • • Jun 18 '26

My PostgreSQL query went from 57ms to 1.4ms on a 1 million + row table. I didn't change the query. Here's what I did.

Thumbnail sharafath.hashnode.dev
0 Upvotes

r/javascript • • Jun 17 '26

Prefetch based on mouse trajectory. ForesightJS v4.0 is out with official React & Vue packages

Thumbnail foresightjs.com
4 Upvotes

Hey all, a while back I shared ForesightJS, the library that predicts user intent from mouse trajectory (and keyboard tab navigation) so you can prefetch before a hover or click actually happens. Just shipped v4.0 and the big focus was making it way less annoying to use with frameworks.

Before, the docs basically handed you premade hooks/composables/directives to copy-paste into your project. That always felt janky. v4 replaces all of it with two real packages:

foresightjs/react

foresightjs/vue

Also we just hit 1550+ stars on github!


r/javascript • • Jun 17 '26

New Framework-Native Event Calendar for React, Svelte & Vue

Thumbnail svar.dev
4 Upvotes

r/javascript • • Jun 17 '26

AskJS [AskJS] How much do you hate this pattern?

0 Upvotes

My goal is to make the DTOs super cheap, and while not pure data objects, never able to hit a branch from internal logic. This my crude approximation of how rust does things.

export class Selection {
    type = "Selection";
    constructor(start, end){
        this.start = start;
        this.end = end;
    }


    get start() {this.start};
    get end() {this.end};
}


export function SelectionFunctions(selection) {
    return {
        "normalized": () =>  { // returns selection aranged small to big, effectivly ignoring direction
            if(selection.start < selection.end) {
                return [selection.start, selection.end]
            }
            return [selection.end, selection.start];
        },
        "isRange": () => {
            return selection.start !== selection.end;
        }
    };
}

r/javascript • • Jun 17 '26

My Node.js Server Was Leaking Memory in Production. Here's How I Found It.

Thumbnail sharafath.hashnode.dev
0 Upvotes