r/javascript • • Apr 22 '26

CORS Isn't a Bug - It's Your API Trying to Warn You (And You Ignored It)

Thumbnail stackdevlife.com
0 Upvotes

I wasted hour debugging CORS.

Turns out the API was correct.


r/javascript • • Apr 21 '26

Universal Deploy — deploy Vite apps anywhere

Thumbnail vike.dev
6 Upvotes

r/javascript • • Apr 21 '26

Temporal API Cheatsheet

Thumbnail learnjavascript.online
26 Upvotes

Quick comparison with the Date API, highlighting some of the main improvements.


r/javascript • • Apr 22 '26

AskJS [AskJS] CORS errors wasted hours of my time until I finally understood whats actually happening

0 Upvotes

I used to think CORS was just some annoying backend issue.

Every time I saw: “blocked by CORS policy”

I’d just:

  • add origin: "*"
  • or disable it somehow

It worked… until it didn’t.

Recently ran into a case where:

  • API worked in Postman
  • Failed in browser
  • Broke again when cookies were involved

Turns out I completely misunderstood how CORS actually works (especially preflight + credentials).

Big realization:

CORS isn’t the problem — it’s the browser trying to protect users.

Do you whitelist origins manually or use some dynamic approach?


r/javascript • • Apr 21 '26

Javascript Quiz

Thumbnail techyall.com
1 Upvotes

Test your javascript knowledge

https://techyall.com/quiz/javascript


r/javascript • • Apr 21 '26

Truss v2: Emotion to StyleX to Vite

Thumbnail draconianoverlord.com
5 Upvotes

Hi all! Just sharing a write-up about our homegrown CSS-in-JS library, that is a blend of Tachyons, Tailwinds, and StyleX -- we had been using Emotion for a long time, but just made the switch to a build-time Vite plugin.


r/javascript • • Apr 21 '26

AskJS [AskJS] What YouTube channels actually helped you get JavaScript?

0 Upvotes

Been trying to pick up JavaScript properly for a while now, and honestly the amount of tutorials out there is overwhelming. I'll start a video, and halfway through realize the style just isn't clicking for me.

I'm hoping to find some recommendations from real people, not just search algorithms. Specifically, are there any channels or specific crash courses that stood out to you as being particularly clear for core concepts (closures, async, etc.) or good for project-based learning?

I've seen names like Traversy Media, Web Dev Simplified, and The Net Ninja come up in old threads , but curious if there's anything newer or slightly under the radar that you'd swear by. Not looking for "best" objectively, just what worked for your brain.

Appreciate any direction! Just trying to spend less time searching and more time learning.


r/javascript • • Apr 20 '26

I built WebBlackbox – a "flight recorder" for web apps that captures 57 event types (network, console, DOM, storage, screenshots) and lets you replay sessions with time-travel debugging

Thumbnail github.com
3 Upvotes

r/javascript • • Apr 21 '26

Decompiling a JavaScript + Three.js + Vue game back to source code from a single webpack file

Thumbnail github.com
0 Upvotes

I’ve been working on a side project called jsunpack, a tool that tries to reconstruct readable source code from bundled/obfuscated JavaScript.

Recently I tested it on a real-world webpack bundle (a Three.js + Vue 2 tower defense game), and the results were… surprisingly good.

Example

  • Original: a single bundled file
  • Output: reconstructed project structure with modules, components, and logic

👉 Demo project:
https://github.com/zhongguagua/jsunpack-example

👉 Live demo:
https://bastion-3d-threejs.vercel.app/

What it managed to recover

Some highlights from this case:

  • ~90.7% file mapping coverage
  • ~93% variable/function naming recovery
  • ~88% overall reconstruction quality

Interesting parts:

  • Event system (pub/sub) restored almost perfectly (on/off/emit/once)
  • Factory patterns (EnemyFactory, TowerFactory) fully reconstructed
  • Wave configuration (20 levels) recovered with correct data
  • Core game engine (~900 lines) preserved with working logic:

    • chain lightning targeting
    • splash damage formula
    • economic system (refund logic)

It also rebuilt a pretty clean modular structure from a single bundle:

  • components
  • core systems
  • entities (enemies/towers)
  • managers
  • configs

Limitations

Still far from perfect:

  • Some imports missing (e.g. three)
  • A few files not extracted (~4 files)
  • Occasional parameter order issues
  • Geometry misidentification (Three.js)
  • Colors converted to decimal (readable but ugly)

🤔 Why I built this

Most existing tools:

  • prettify code
  • or partially deobfuscate

But they don’t reconstruct architecture + semantics

I wanted to see how far we can push:

Looking for feedback

Curious what people think:

  • Is this useful in real workflows?
  • Reverse engineering / debugging / security analysis?
  • Or just a fun experiment?

Happy to hear any thoughts


r/javascript • • Apr 20 '26

Free tool to check for NPM package typosquatting

Thumbnail spoofchecker.com
2 Upvotes

I checked lodash and found 2 registered variants that looked suspicious. This one https://socket.dev/npm/package/loadsh/overview/0.0.4 has 6k weekly downloads as well.


r/javascript • • Apr 20 '26

Subreddit Stats Your /r/javascript recap for the week of April 13 - April 19, 2026

8 Upvotes

Monday, April 13 - Sunday, April 19, 2026

Top Posts

scorecommentstitle & link
11844 commentstiks – Procedural UI sounds in 2KB, zero audio files, pure Web Audio synthesis
9326 commentsI built LiquidGlass, a JS lib to render pixel perfect iOS Liquid Glass effect on the web (with WebGL)!
202 commentsBrowserPod 2.0: in-browser WebAssembly sandboxes. Run git, bash, node, python...
1317 commentsElectron IPC design feels fundamentally flawed. Am I wrong?
127 commentsdiagrams-js - Cloud architecture diagrams as code
123 commentsCustom .af video format for WebCodecs: frame-accurate playback without <video>
121 commentsTrustlock: a dependency admission controller that enforces npm trust signals as policy
115 commentsScratchpad for JavaScript and TypeScript. Open-source alternative to RunJS
1011 comments[AskJS] [AskJS] What are some of the best opensource Javascript projects that you have seen?
90 commentsJust shipped docmd 0.7.0 : zero-config docs with native i18n

 

Most Commented Posts

scorecommentstitle & link
021 commentsThe native scrollIntoView({ behavior: 'smooth' }) has no callback. You can't know when it finishes. This tiny wrapper returns a Promise that resolves when the scroll is done.
014 comments[AskJS] [AskJS] Is this how api works?
014 comments[AskJS] [AskJS] What are the real architectural limits of using console.log + %c as a pixel renderer, and how would you push past them?
610 commentsWas hitting duplicate API calls when the same async function got triggered multiple times.
410 comments[Showoff Saturday] Showoff Saturday (April 18, 2026)

 

Top Ask JS

scorecommentstitle & link
17 comments[AskJS] [AskJS] Built a Canva-like editor with full Polotno compatibility (open source)
07 comments[AskJS] [AskJS] Cuanto puedo cobrar este proyecto?
010 comments[AskJS] [AskJS] Are npm supply chain attacks making you rethink dependency trust?

 

Top Showoffs

scorecomment
2/u/andrew_zol said Cleverbrush Framework — a full-stack TypeScript framework where one schema definition gives you types, validation, API contracts, OpenAPI docs, forms, object mapping, DI, and a typed client. Zero code...
2/u/CelebrationWitty2348 said been working on this little script that scrapes match fixtures and sends me notifications before my team plays - way better than relying on the official app which is honestly garbage. took me forever ...
1/u/Beneficial-Cow-7408 said Built 20+ live interactive wallpapers from scratch as a Canvas API playground - here's how they work Solo dev here. At some point while building my AI platform I decided it needed animated wallpapers...

 

Top Comments

scorecomment
50/u/hyrumwhite said The scrollend event is baseline available now.  Could just do something like  ``` const scrollIntoView = (el) => {   return new Promise((resolve) => {     el.scrollInt...
35/u/Aidircot said GitHub account created in 2026, word "hacker" in username... and this user created browser! AI bs
32/u/mcc0unt said Demo page worked for me (safari on iOS). Besides it being impressive, I still hate Liquid Glass design. But nice work though!
29/u/Emergency_Activity38 said I built tiks because every native app has satisfying interaction sounds but web apps have been silent for 30 years. Instead of shipping MP3s or base64 audio, tiks generates 10 UI sounds (click, t...
23/u/swish82 said Just download them. [Google tracks stuff](https://www.lifewire.com/now-you-can-block-web-fonts-you-probably-didnt-know-are-tracking-you-7377851) using their font sharing. Use https:...

 


r/javascript • • Apr 20 '26

diagrams-js - Cloud architecture diagrams as code

Thumbnail diagrams-js.hatemhosny.dev
22 Upvotes

r/javascript • • Apr 20 '26

Just shipped docmd 0.7.0 : zero-config docs with native i18n

Thumbnail github.com
13 Upvotes

Hey everyone,

We just shipped the 0.7.0 release for docmd.

The goal with this project has been simple: remove as much setup and config as possible from docs tooling.

If you have a folder of Markdown files, you can just run:

npx @docmd/core dev

and it turns into a full docs site with navigation, search and routing out of the box. No frameworks, no bloat and whole website ready in seconds.

Some things we just finalised in 0.7.0:

Native i18n:
Locale-based routing with built-in language switching and fallback. Works with both fully translated docs and string-level localisation.

Completely Offline Search:
Built-in fuzzy search, no Algolia or external setup needed.

AI-ready context:
Automatically generates llms.txt + llms-full.txt so tools like Cursor or ChatGPT can read your docs without extra work.

Also pushed a 0.7.1 patch to isolate plugins so a bad plugin won’t crash the build.

It’s fully open source. Would love feedback if you try it. Thank You!

GitHub: https://github.com/docmd-io/docmd
Docs: https://docs.docmd.io

(docs now available in other languages as-well, since we added i18n support, adding more languages slowly)


r/javascript • • Apr 20 '26

HTTP resilience tradeoffs in practice: retry vs Retry-After vs hedging (scenario data)

Thumbnail blog.gaborkoos.com
1 Upvotes

I ran 3 controlled chaos scenarios comparing retry-only, Retry-After-aware retry, and hedging.

One run improved success with retries but significantly worsened p95/p99 under a tight timeout budget. Another showed that honoring Retry-After turned a 40% 429-heavy error profile into stable completion. More in the post.


r/javascript • • Apr 20 '26

Show r/javascript: pretext-flow, embed shapes and animated objects in text flow without writing collision math

Thumbnail nourthearab.com
4 Upvotes

Every time I wanted text to wrap around a moving shape in a Pretext demo, I rewrote the same geometry: circle interval math, slot carving, line-by-line obstacle routing. 200–300 lines every time, even my AI sessions got impacted because the output was too large.

So I packaged it: pretext-flow. One call, no geometry:

import { flowLayout } from 'pretext-flow'


const result = flowLayout({
  text, font, width, lineHeight,
  embeds: [{
    id: 'logo',
    shape: { type: 'circle', radius: 50 },
    position: { type: 'flow', paragraph: 1, progress: 0.4, side: 'right' },
    margin: 16,
  }]
})
// result.lines → positioned lines
// result.embeds → resolved rects

v0.2 adds animation (embeds follow arc/bezier paths at 60fps), per-character effects (cursor ripple, ambient drift), hit testing, and hull extraction from image alpha channels. Renderer-agnostic.. returns data, you draw it however you want.

TypeScript strict. MIT.

Demo: https://nourthearab.com/pretext-flow/
npm: npm install pretext-flow
Github: https://github.com/NourTheArab/pretext-flow


r/javascript • • Apr 19 '26

Was hitting duplicate API calls when the same async function got triggered multiple times.

Thumbnail github.com
7 Upvotes

r/javascript • • Apr 19 '26

AskJS [AskJS] What are some of the best opensource Javascript projects that you have seen?

11 Upvotes

By best I mean great design practices - a great community and something that contributed to javascript's growth.


r/javascript • • Apr 20 '26

Web Bro: Full in-browser AI agent with WebGPU, ONNX, and direct File System Access API integration

Thumbnail aeroxy.github.io
0 Upvotes

Hey r/javascript,

I built Web Bro — a completely client-side AI coding/research agent that runs entirely in the browser using modern web APIs.

Highlights:

  • Runs Gemma 4 E2B-it (ONNX quantized) directly via WebGPU
  • Uses the File System Access API so the agent can list, search, read, edit, and write files in a real local folder you choose
  • Automatic file snapshots in IndexedDB before every write (built-in undo/restore)
  • No server, no install, no API keys — everything (model, chats, settings, file history) stays 100% local
  • Built with vanilla JS + WebGPU + Transformers.js-style inference

It's a fun demo of what’s possible today with WebGPU, ONNX in the browser, and the modern File System APIs.

Live Demo:
https://aeroxy.github.io/web-bro

GitHub repo:
https://github.com/aeroxy/web-bro

Would love feedback from the webdev side — especially on:

  • WebGPU performance & compatibility across browsers/devices
  • File System Access API quirks you've run into
  • Ideas for more agent tools or better UX

Let me know what you think!


r/javascript • • Apr 18 '26

Scratchpad for JavaScript and TypeScript. Open-source alternative to RunJS

Thumbnail github.com
17 Upvotes

Hey everyone. I want to share a weekend project that got a little out of hand.

NODL (pronounced "noodle") is a free, open-source scratchpad for JavaScript and TypeScript.

Write code, blink an eye, and see results inline. Think RunJS, but free and hackable - no license keys, and the full source is yours to fork.

I built it because I use scratchpads daily for quick util functions, and I wanted one I could bend to my own workflow - tweak the UI, add features, change anything.

The best way to get that was to build it myself.

--

Try it out here: https://github.com/hungdoansy/nodl

--

Heads up: the macOS build isn't code-signed yet, so you'll need a couple of extra steps to open it the first time.

If that makes you uneasy, the source is right there - clone it and build it yourself <3.

I'd love to hear what you think. And if you enjoy it, a ⭐ on GitHub goes a long way toward keeping me motivated.

Thank you so much for your time!


r/javascript • • Apr 18 '26

Showoff Saturday Showoff Saturday (April 18, 2026)

8 Upvotes

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

Show us here!


r/javascript • • Apr 17 '26

Custom .af video format for WebCodecs: frame-accurate playback without <video>

Thumbnail github.com
16 Upvotes

r/javascript • • Apr 18 '26

AgenTester — Test de Calidad UI/UX Automatizado

Thumbnail agentest.cloud
0 Upvotes

I built a tool to automatically test web apps by actually using them (not just checking metrics).

It uses Playwright to crawl the UI and:

  • detects forms/buttons
  • runs CRUD flows
  • tests filters + pagination
  • captures JS and network errors

Basically tries to simulate what a QA would do manually.

CLI:
npx agentester --url https://yourapp.com

It also generates an HTML report with screenshots.

Curious if something like this would be useful in your workflow or if I’m reinventing the wheel.


r/javascript • • Apr 18 '26

I built a full-stack TypeScript framework that beats Zod in 14/15 benchmarks and replaces 5+ libraries with one coherent system. Here's what I learned.

Thumbnail docs.cleverbrush.com
0 Upvotes

r/javascript • • Apr 17 '26

I built a headless, accessible PIN/OTP input Web Component

Thumbnail javierortega95.github.io
3 Upvotes

I needed a PIN/OTP input for a project and most solutions I found were either tied to a specific framework, heavily opinionated about styling, or both. So I built my own as a native Web Component.

It supports:

- Fully customizable via ::part() — no style overrides, no specificity battles

- Smart paste — distributes pasted text across slots automatically

- SMS Autofill — autocomplete="one-time-code" out of the box

- Native form participation — works with <form>, FormData and HTML5 validation

- Mask mode — hides characters like a password field

- Separators — configurable slot grouping (e.g. 123-456)

- Full keyboard navigation and screen reader support

- React, Vue, Angular and Vanilla JS tested and working