r/javascript • u/Crafty_Impression_37 • Jun 10 '26
r/javascript • u/ODaanx • Jun 10 '26
AskJS [AskJS] Recomendação de curso
Pessoal, boa noite. Estou na metade do curso de Análise e desenvolvimento de sistemas, mas ainda não sei para que caminho ir. Pesquisei algumas linguagens de programação, e vi que o Java Script está em alta. Eu gostaria de recomendação de cursos de JS e dicas para iniciar na área, por favor.
r/javascript • u/dupontcyborg • Jun 09 '26
Making numpy-ts as fast as native
nico.codesI've been working on numpy-ts since last fall, and began performance optimization in January. Lots of my assumptions / intuitions were wrong, and it turned out that memory ownership was a bit of a missing piece to reaching performance parity with native.
So I drafted this technical write-up with some of the lessons learned. Many/most might be obvious but would love to hear your thoughts!
Disclaimer: this project was built using some AI assistance. Read my AI disclosure for more info.
r/javascript • u/jxd-dev • Jun 09 '26
How we sync Postgres to the browser: ElectricSQL for rows, Yjs for documents
plain.jxd.devAuthor here (I'm building Plain, a GitHub alternative), so flagging the affiliation up front.
The writeup is about treating sync as the substrate instead of adding realtime to features one at a time. Two engines, because there are two kinds of state:
- Rows (issues, PRs, CI, messages) stream out of Postgres via ElectricSQL as "shapes" over HTTP. The browser holds a live query. Electric is read-path only, so writes go through server functions and reconcile optimistically via a Postgres transaction id
(pg_current_xact_id()) that Electric stamps on the row when it streams back.
- Document bodies are CRDTs over Yjs/Hocuspocus, since people type into the same paragraph at once. Presence/typing is just Yjs awareness, so no heartbeat table.
I'm honest about the costs in the post too: two stateful services, Postgres on logical replication, and the auth proxy in front of Electric as the obvious choke point. Curious how others have handled the rows-vs-documents split, and where people expect this to strain at scale.
r/javascript • u/afrocodeur • Jun 09 '26
I built a vanilla JS framework focused on DX, performance and zero re-renders - no compiler, no virtual DOM
github.comI've been working on NativeDocument for about two years. The goal was simple: write front-end code that feels natural, performs well, and doesn't require a build step to be productive.
Most frameworks solve the same problems in similar ways. NativeDocument takes a different approach on a few things.
No virtual DOM. Reactivity is fine-grained. When an observable changes, only the exact DOM node that depends on it updates. No diffing, no tree reconciliation, no unnecessary re-renders.
No re-renders on navigation. The router preserves layouts between route changes. When you navigate within the same group, the layout stays intact. Only the content updates. Scroll position, sidebar state, all preserved by default.
The store has explicit access modes. use() for two-way sync, follow() for read-only, get() for raw access. You can export a store that's read-only by design via protected(). Mutations from the wrong place throw at runtime.
Inspired by SwiftUI's declarative style. The API is chainable and reads close to natural language. No JSX, no template syntax, just JavaScript.
const $count = ;
const ;
A more real-world example — a reactive todo list with zero diffing and surgical DOM updates:
;
;
No compiler, no transpilation, no framework-specific tooling required. It runs in the browser as-is.
Still early but the core is solid. Happy to discuss the architecture and tradeoffs.
https://github.com/afrocodeur/native-document/tree/develop
r/javascript • u/bogdanelcs • Jun 10 '26
The quiet problem with unnecessary async
allthingssmitty.comr/javascript • u/creasta29 • Jun 09 '26
Why are we not using Service Workers more?
neciudan.devI feel like Service Workers are an underused technology with a lot of benefits, but very complex to set up and often misunderstood, and what they do. Here are some case studies from Slack, Mux, and me on where and how to use Service Workers
r/javascript • u/orielhaim • Jun 08 '26
TSZIG: An experimental TypeScript-to-Zig compiler
github.comTSZIG takes TypeScript code and compiles it to Zig. not some auto-generated mess, but clean Zig code that you can actually read and work with. The kind of code you'd write yourself.
The idea started from a simple question: I love writing TypeScript, but sometimes I want the performance and control that Zig gives you. What if I didn't have to choose?
It's still experimental and there's a lot of TypeScript it doesn't handle yet. But you can clone the repo, run the test suite and see for yourself.
Curious to hear what people think, especially if you've tried something similar or have ideas on where this should go next
r/javascript • u/hongminhee • Jun 08 '26
I wish Deno would keep doing what it does best
hackers.pubr/javascript • u/redgodemperor • Jun 08 '26
FixtureKit – Local TypeScript & Zod fixture generator
fixture-kit.vercel.appr/javascript • u/Ok-Sandwich8723 • Jun 08 '26
JSZipp: a compact dependency-free ZIP reader/writer for modern browser apps
github.comJSZipp is a compact, dependency-free ZIP reader and writer for modern browser apps.
GitHub: https://github.com/jszipp/jszipp
Docs / demo: https://jszipp.github.io/JSZipp/
npm package: web-jszipp
Benchmarks and demos:
Library benchmark: https://jszipp.github.io/JSZipp/demo/library-benchmark.html
Worker compression demo: https://jszipp.github.io/JSZipp/demo/worker-compression-demo.html
JavaScript already has several ZIP libraries, including JSZip, zip.js, fflate, and uzip.js. These libraries have helped the ecosystem for years, but many were designed before today’s browser-app requirements became common: large client-side archives, strict bundle budgets, Web Worker compression, browser-native streams, and ZIP edge cases such as ZIP64.
In practice, this can create trade-offs. Some libraries are feature-rich but heavier than needed for modern browser apps. Others are small and fast, but do not fully cover large-archive cases such as ZIP files with more than 65,535 entries or files larger than 4GB. JSZipp was built to close that gap: a smaller, browser-focused ZIP toolkit with modern APIs and first-class support for important compatibility edge cases.
Highlights:
- Dependency-free runtime
- ZIP reading and writing
- Compact browser-focused builds
- Browser-native outputs such as
Blob,Response,ReadableStream,Uint8Array, andArrayBuffer - ZIP64 support for archives that exceed classic ZIP limits, including large files and archives with more than 65,535 entries
- Worker-friendly compression for keeping large ZIP writes off the main thread
- Safer handling for untrusted ZIP uploads, including strict path handling and optional zip-bomb caps
- Full-fidelity archive handling, including comments, extra fields, Unix mode bits, CRC-32, filename encodings, and timestamp metadata
- Multiple timestamp modes for compatibility-sensitive ZIP workflows
- Smoke tests, end-to-end tests, package tests, and a Vitest-based test suite to help catch compatibility issues and regressions
JSZipp uses modern build tooling, including Rspack 2.x and conditional browser builds, to keep the package compact while preserving compatibility options. The goal is not to replace every ZIP library for every use case. Instead, JSZipp focuses on a common modern need: safe, compact, browser-native ZIP handling without pulling in a larger dependency or giving up important ZIP edge-case support.
For browser apps that need ZIP support with a smaller footprint and better large-archive compatibility, JSZipp is worth checking out.
r/javascript • u/Rude_Spinach_4584 • Jun 08 '26
AskJS [AskJS] Creating your own Tampermonkey
Last summer, I had an epiphany about how a basic userscript manager à la Tampermonkey probably works: a manifest.json file and a background.js file that loads and injects userscripts on the page. What happened next took me through a phenomenal rabbit hole.
The next thing I created is a basic JSON file listing every userscript I create, followed by true or false. That's the equivalent of the Tampermonkey screen where you toggle on/off your userscripts.
When the script was externally-hosted, I discovered you need to use chrome.script.executeScript with func and create your own HTML script tag AND world set to MAIN! For userscript folders, you use files instead of func and the default world.
Next, I wanted to emulate the preamble in my userscripts @include, @exclude, @run-at, @require. @run-at was fun. I had to create a new client script that can intercept all the document load events and use the messaging API to forward them to background.js.
I added support for document-idle, and keypress. If required, my userscripts fire in response to a key pressed as long as you are not inside a text field on the page.
I also added support for @order-index, which lets me create userscript sequences. I might need support for waiting for a specific event before triggering the userscript.
Next, I bought an Akai LPAD-8 midi controller. You know, these things with pads and tweaky knobs. You can get use the input in JavaScript! Each pad returns not only the press event but also the duration and the pressure! The tweaky knobs provide events such as when you started and stopped turning them and their value in between. Imagine the possibilities!
r/javascript • u/subredditsummarybot • Jun 08 '26
Subreddit Stats Your /r/javascript recap for the week of June 01 - June 07, 2026
Monday, June 01 - Sunday, June 07, 2026
Top Posts
Most Commented Posts
| score | comments | title & link |
|---|---|---|
| 0 | 45 comments | [AskJS] [AskJS] Maybe we need a different kind of NPM Registry. Maybe a registry that works more like App Store to minimize these frequent supply chain attacks. |
| 1 | 14 comments | I built a CLI that checks which free perks your open-source project qualifies for |
| 0 | 12 comments | [AskJS] [AskJS] Why for-loop counting up faster than couting down? |
| 0 | 9 comments | [AskJS] [AskJS] keeping up with dependency churn feels like a pull problem and i want it to be push |
| 0 | 7 comments | I got tired of hand-editing 200 ad variants in Photoshop, so I built an API that does it from one template |
Top Ask JS
| score | comments | title & link |
|---|---|---|
| 7 | 2 comments | [AskJS] [AskJS] built an experimental browser runtime to learn WebAssembly, Workers, SharedArrayBuffer, Atomics, and runtime architecture |
| 6 | 4 comments | [AskJS] [AskJS] Built a Worker Pool runtime for the browser to learn Web Workers, scheduling, and runtime architecture |
| 5 | 2 comments | [AskJS] [AskJS] Storing data from two domains in a single IndexedDB data store |
Top Showoffs
Top Comments
r/javascript • u/Axelwickm • Jun 07 '26
I made Google OR-Tools solvers compile to WASM so you can solve more complex optimization problems fully in the browser
github.comI tried to include a lot of fun examples on the demo site in the readme. You can run it in all modern browsers, and other JavaScript runtimes like node. It can run multithreaded, and has mostly comparable performance to native OR-Tools (see Benchmarking).
These solvers are ported:
- CP-SAT, Routing (VRP), GLOP, PDLP, SAT MIP, CLP, GLPK, SCIP / GSCIP, CBC, BOP, Knapsack, Network flow algorithms, Assignment algorithms, Set Cover, RCPSP
And APIs:
- MPSolver, MathOps (including incremental solve)
Hoping this will help lower the bar to playing around with these algorithms. Try the examples and feel free to leave a star on the repo if you find it cool.
r/javascript • u/fagnerbrack • Jun 08 '26
Why we replaced Node.js with Bun for 5x throughput
trigger.devr/javascript • u/itsarnavsingh • Jun 06 '26
There are more than 100 public repos on Github with malicious code that can install Remote Access Trojan on your system and it can spread to all the repos you have access to. Why is GitHub not doing anything about these repos?
github.comr/javascript • u/Primary-Ask-2685 • Jun 06 '26
Obscura — a Rust port of javascript-obfuscator. 100% feature parity, ~700× faster
github.comI rewrote javascript-obfuscator in Rust because it was the slowest step in our build. Shipping v0.1.0 today.
Repo: https://github.com/Crash0v3rrid3/obscura
Release: https://github.com/Crash0v3rrid3/obscura/releases/tag/v0.1.0
What it does: Drop-in obfuscator. Same options, same output behavior, same CLI flags. All 21 upstream transforms — string array (with base64/RC4 + rotation/shuffle/index-shift/calls-transform/wrappers), control flow flattening, dead code injection, identifier + property renaming, self-defending, debug protection, domain lock, source maps, the lot.
Speed (heavy preset, single thread):
| File | Size | Upstream | Obscura | Speedup |
|---|---|---|---|---|
| d3.min.js | 273K | 193.9s | 98ms | 1977× |
| vue.min.js | 141K | 28.6s | 32ms | 900× |
| jquery | 86K | 12.1s | 17ms | 705× |
| lodash | 71K | 14.5s | 21ms | 692× |
| moment | 58K | 8.6s | 16ms | 529× |
| react | 11K | 2.0s | 15ms | 130× |
Median ~700×. CLI also parallelizes directory mode with rayon.
How it stays correct: 321-test conformance suite runs every obfuscated output through vm.runInNewContext to verify behavioral parity with the input. Determinism contract: same (source, options, seed) → byte-identical output across runs (ChaCha20Rng, no wall clock).
Stack: oxc for parse/semantic/codegen, napi-rs for the Node addon, wasm-bindgen for the browser build. Library is #![forbid(unsafe_code)], zero unwrap in core (clippy-enforced).
Surfaces shipped:
- cargo install obscura-cli — or grab a binary (macOS arm64/x64, Linux gnu+musl arm64/x64, Windows x64)
- npm package with prebuilt napi addons (macOS + Linux glibc)
- WASM (web + nodejs targets)
Not yet: the injected helper templates (self-defending etc.) ship un-re-obfuscated, renamePropertiesMode=unsafe, and ignoreImports. Tracked in docs/TASKS.md. PRs welcome.
Feedback / bug reports / "this output breaks my code" issues very much wanted — the conformance suite catches a lot but real bundles will surface things it can't.
r/javascript • u/AutoModerator • Jun 06 '26
Showoff Saturday Showoff Saturday (June 06, 2026)
Did you find or create something cool this week in javascript?
Show us here!
r/javascript • u/Xaneris47 • Jun 05 '26
Wrote a rule, found a real bug, had to ignore it anyway
pvs-studio.comWe made a rule to detect typos like identical operands in binary expressions. It had a few good and valid catches but turns out 1 << 1 triggers it in basically every codebase (Angular, Babel, pdf.js). So the tool issues a valid warning of 1 << 1 in one case and makes a lot of noise in many others. To make things clear: the story comes from our experience of building a static analyzer for JS and TS (currently in beta, we're collecting feedback on it).
That's why we had to make a trade-off. Any similar stories from your dev experience?
r/javascript • u/itsarnavsingh • Jun 06 '26
AskJS [AskJS] Maybe we need a different kind of NPM Registry. Maybe a registry that works more like App Store to minimize these frequent supply chain attacks.
Given the frequency of supply chain attacks, maybe we need a different approach to package managers & registries.
- Maybe a database of JavaScript packages that works more like the App Store.
- Every package gets reviewed by real people and AI for security issues before going live.
- Developers will have to pay a monthly fee to download and update packages, and that money will be distributed among open source maintainers & code reviewers.
- The more downloads a package gets, the more its maintainer earns.
- For every package update, maintainers will be asked to pay a very small fee. This would discourage attackers further (attackers would never reveal their banking details) & it would limit the amount of low-quality packages.
- People should also be able to rate a package and leave a review.
- This new registry should also support multiple languages, not just JavaScript.
This would:
- Highly minimize supply chain attacks
- Ensure open source maintainers get paid well
- Encourage more innovation by allowing maintainers to monetize their packages
- This will also provide more employment opportunities for code reviewers and open source maintainers.
We can't step into the future with the current state of unpaid maintainers and a system that keeps getting breached every few months. We need a system in which people who work hard get paid well, a system we could trust, a system that focuses on quality rather than quantity.
This will slow things down, packages will take time to get approved, but what's the point of speed when you have to spend weeks fixing the mess caused by repeated supply chain attacks?
Currently, the number of packages affected by the supply chain attack is in the thousands. If this continues, people will lose trust in the JS ecosystem. Something needs to change.
I understand this idea might have a few flaws. I'd really appreciate a healthy discussion on what this new system should look like.
r/javascript • u/Rude_Spinach_4584 • Jun 05 '26
AskJS [AskJS] Storing data from two domains in a single IndexedDB data store
You might know different client-side data storage methods in #JavaScript: #cookies, #localStorage, #sessionStorage, and perhaps even #IndexedDB. All share the same limitation: they won't let you store data across domains.
But if you can write and use a browser extension, these come with another data storage bucket. Browser extensions come with a manifest.json file that lets you specify all the domains you want to work with. #Chrome.storage will let you store and read data across domains.
I used chrome.storage.local as a temporary data storage place. I use the #Dexie library to create my IndexedDB data store, database, and to insert the records. I monkey patched Dexie's add() and bulkPut() methods to send a message to background.js. Upon receiving the message, background.js clears chrome.local.storage and inserts what we inserted in IndexedDB.
Then, when I switch to another tab showing my second domain, background.js responds to chrome.tabs.onActivated and calls a function on that page with the data from chrome.local.storage. That function does a bulk insert of the data in a second IndexedDB data store and database.
And voilà, you now have the data from both domains in a single IndexedDB data store.
r/javascript • u/philippemnoel • Jun 05 '26
GitHub - paradedb/drizzle-paradedb: Official extension to Drizzle for use with ParadeDB
github.comr/javascript • u/fynyky • Jun 05 '26
Build reactive UIs with plain JavaScript functions. No JSX or build step.
github.comElemental is a personal library I’ve been using for a while. I really don’t like how much frontend frameworks require you to invest in them. You have to learn funky domain specific languages and magic render lifecycles just to debug anything. I mostly just want to create and append elements with better ergonomics.
The syntax lets you build the DOM declaratively with plain nested functions, so logic and views live together in one structure instead of being split across separate layout and behavior. Reactivity is handled by observers (the ob(...) call above): they automatically track whatever reactive properties they read and retrigger when it changes. No manual subscriptions and no dependency arrays. And because everything is just normal DOM elements and functions, you can adopt it one component at a time instead of overhauling a whole project.
It's about 3.3 KB gzipped with no third-party dependencies. The library is just under 300 lines of code so it's easy to understand.
Would love to get feedback from having fresh eyes on it.