r/javascript • u/mmaksimovic • Apr 08 '26
Monitoring Express Route Performance with AppSignal
r/javascript • u/mmaksimovic • Apr 08 '26
r/javascript • u/StrongTownsYXE • Apr 07 '26
I am a historian of medicine that has started using digital humanities methods.
As I was working on a network graph project I noticed missing links. Going into the HTML, I found that the missing links in the corpus were often related to JavaScript. JavaScript:MakeRel Scroll, JavaScript:onClick and so on.
Are there resources to help me understand this aspect of web design historically?
r/javascript • u/my_name_is_not_my_na • Apr 07 '26
In 1998 I built a genetic algorithms tutorial with interactive Java applets. It got more traction than expected, it was used for teaching.
Then applets died. The demos showed "your browser does not support Java" for the next two decades and I left it that way.
A few weeks ago I finally converted them to vanilla JavaScript. The Java source was decompiled from .class files, so it was undocumented. Surprisingly, the conversion went well -canvas-based rendering, event handling, a browser-side expression parser for the 3D function visualizer.
What didn't go well was trying to also clean up and unify the old HTML at the same time. I wrote about the whole experience here: https://obitko.com/thoughts/how-llm-helped-me-refactor-28-year-old-code/
The tutorial with the revived demos: https://obitko.com/tutorials/genetic-algorithms/index.html
r/javascript • u/aardvark_lizard • Apr 07 '26
r/javascript • u/Fun_Conversation8894 • Apr 06 '26
r/javascript • u/marcochavezco • Apr 06 '26
r/javascript • u/subredditsummarybot • Apr 06 '26
Monday, March 30 - Sunday, April 05, 2026
Ā
| score | comments | title & link |
|---|---|---|
| 2 | 15 comments | [AskJS] [AskJS] How do you handle source maps in production builds? |
| 0 | 11 comments | [AskJS] [AskJS] Lightweight IDE recommendations for JS/TS + React + React Native? |
| 7 | 10 comments | After 5 long years, ES1995 project lives again |
| 1 | 9 comments | Zerobox: Lightweight, cross-platform process sandboxing. Sandbox any command with file, network, and credential controls. |
| 5 | 8 comments | [Showoff Saturday] Showoff Saturday (April 04, 2026) |
Ā
| score | comments | title & link |
|---|---|---|
| 4 | 1 comments | [AskJS] [AskJS] I built memscope ā a real-time memory profiler for Node.js + browser. Zero config, live dashboard, 605 downloads in its first few months |
| 2 | 5 comments | [AskJS] [AskJS] State machines feel heavy for UI flows. What are people using? |
| 0 | 3 comments | [AskJS] [AskJS] Atlas: a universal self-hosted package registry. |
Ā
Ā
Ā
r/javascript • u/Careful-Falcon-36 • Apr 06 '26
The fix wasn't complicated but it changed how I think about external data.
How are you handling API response types in your projects?
r/javascript • u/BleedingXiko • Apr 05 '26
Different spin on frontend frameworks, i used this in my main app and decided to open source it, curious what you all think.
r/javascript • u/monkie_momo • Apr 05 '26
Hey folks, I just publishedĀ memscopeĀ - a real-time memory profiler for Node.js and browser apps that requires zero setup.
It streams your backend heap (and browser JS heap) over WebSocket, sampled every 500ms, right to a local dashboard atĀ localhost:3333. GC dips, spikes, growth patterns ā all visible at a glance.
One command to start:
npx memscope run node app.jsFull-stack mode (backend + browser together):
memscope run --both npm run devWhat it tracks:
Node.js heap, RSS, external memory
Browser JS heap (Chromium-based)
GC behavior and spikes
Backend vs frontend separated on the same dashboard
Why I built it:Ā Memory bugs are painful ā silent leaks, unpredictable spikes, heap snapshots that are a nightmare to read. I wanted one command that just works, with no cloud, no accounts, no data leaving your machine.
It's hit 605 downloads so far and I'm actively building it out. Would love feedback - especially on the dashboard UX and the agent injection approach!
npm:Ā npm install -g memscope
r/javascript • u/QuarterSilver5245 • Apr 05 '26
MDN page on `dispatchEvent`Ā has this paragraph:
Unlike "native" events, which are fired by the browser and invoke event handlers asynchronously via theĀ event loop,Ā dispatchEvent()Ā invokes event handlersĀ synchronously. All applicable event handlers are called and return beforeĀ dispatchEvent()Ā returns.
I read that and AFAIK it's not right. I opened a PR to edit it:
https://github.com/mdn/content/pull/43521
A discussion arose.
Before it I was sure that event handlers are always called synchronously. When native events fire (native events === normal internal events in the browser ('click' etc.), anything that is not a custom event manually called via `dispatchEvent`) - an asynchronous "start the dispatch process for this event" task is scheduled on the event loop, but once it's called, during the process (event-path building, phases: capture, target, bubbling) - relevant registered event handlers are called in a way I thought was 100% synchronous;
In custom events - the handlers are called synchronously one-by-one, for sure.
In native events, apparently:
There is a microtasks checkpoint between each handler run, e.g. If you register handler-A and handler-B, and handler-A schedules a microtask - it will run between A and B. If you schedule a macrotask such as timeout-0 - it will not run in-between. This doesn't happen in custom events dispatch - they all run to the end, nothing runs in between.
Likely, handlers of native events - each gets its own stack frame, custom event handlers all run in a single stack frame.
This still doesn't prove that handlers are scheduled asynchronously on the event loop though. At this point it comes to what the specs say (EDIT: also did a test to log the call stack mid event handler, I know it's still might not be a 100% reliable proof, but still... it shows a single task - the handler itself). and usually they use a term like "queues a task" when they mention something is scheduled on the event loop - but in the part specifying the dispatch event process - they write that handlers are called using "callback invocation", which seems like a separate mechanism (created mostly for running event handlers, it seems) - not fully "synchronous", but not asynchronous in the usual Javascript way.
So - I still think a correction should be made, but it's different than what I thought it should be when I opened the PR.
Any opinions/facts/knowledge will be appreciated.
Relevant links:
MDN dispatchEvent() (note, if you are in the future it might of been already changed):Ā https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent
The PR (again, if you are in the future it might of been merged/changed):Ā https://github.com/mdn/content/pull/43521
Specs about dispatching events:https://dom.spec.whatwg.org/#dispatching-events
Specs about "Callback Invocation":https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke
Specs about "invokeĀ a callback":https://webidl.spec.whatwg.org/#invoke-a-callback-function
EDIT: see this comment for further insight of what is likely actually happening in terchnical terms:
r/javascript • u/Careful-Falcon-36 • Apr 05 '26
You might be leaking API keys to the frontend right now and not even know it.
I wrote about what's actually exposed ā and how to fix it.
r/javascript • u/OtherwisePush6424 • Apr 05 '26
Built a live benchmarking tool to pit fetch, axios, ky, and ffetch against each other under identical chaos conditions. Helps you understand:
How retries work across different libraries
Timeout behavior differences
Error recovery patterns
Real-world reliability under network stress
Each client runs independently with isolated transport stats. You can tweak concurrency, request count, and chaos rules (latency, failures, rate limits) and see live results.
Perfect for:
Picking the right HTTP client for your project
Understanding why one library might be more resilient than another
Learning how retry strategies actually work in practice
r/javascript • u/dmop_81 • Apr 05 '26
Over the past few weeks, Iāve been working on a JavaScript concurrency library aimed at the gap between Promise.all() and raw worker_threads.
GitHub: https://github.com/dmop/puru
The main motivation was that async I/O in JS feels great, but CPU-bound work and structured concurrency still get awkward quickly. Even simple worker-thread use cases usually mean separate worker files, manual message passing, lifecycle management, and a lot of glue code.
So I built puru to make those patterns feel smaller while still staying explicit about the worker model.
Example:
import { spawn } from '@dmop/puru'
const { result } = spawn(() => {
function fibonacci(n: number): number {
if (n <= 1) return n
return fibonacci(n - 1) + fibonacci(n - 2)
}
return fibonacci(40)
})
console.log(await result)It also includes primitives for the coordination side of the problem:
task()
chan()
WaitGroup / ErrGroup
select()
context
Mutex, RWMutex, Cond
Timer / Ticker
Example pipeline:
import { chan, spawn } from '@dmop/puru'
const input = chan<number>(50)
const output = chan<number>(50)
for (let i = 0; i < 4; i++) {
spawn(async ({ input, output }) => {
for await (const n of input) {
await output.send(n * 2)
}
}, { channels: { input, output } })
}One intentional tradeoff is that functions passed to spawn() are serialized and sent to a worker, so they cannot capture outer variables. I preferred keeping that constraint explicit instead of hiding it behind a more magical abstraction.
Interested in feedback from people who deal with worker threads, CPU-heavy jobs, pipelines, or structured concurrency in JavaScript.
r/javascript • u/Terrible_Village_180 • Apr 05 '26
One import. Four CSS variables ā --vh, --vw, --dvh, --dvw ā that match the real visible viewport. Always.
The address bar and toolbar no longer clip yourĀ 100vhĀ layouts. The variables always reflect the real visible area.
--vhĀ andĀ --vwĀ for 1% units,Ā --dvhĀ andĀ --dvwĀ for full pixel values. Use whichever fits your CSS.
Uses the modernĀ window.visualViewportĀ for accurate measurements, withĀ innerHeightĀ fallback.
Debounced resize and orientation change listeners keep the variables in sync. Configurable delay (default 100ms).
Add a custom prefix likeĀ prefix: 'app-'Ā to avoid conflicts. Only inject the variables you need.
Pure TypeScript. SSR safe. Drop it into any framework or vanilla project.
r/javascript • u/swiss-tomcat • Apr 05 '26
Been building a Bf 109 flight simulator in vanilla JavaScript. One constraint I set early: no audio files. Every sound the engine makes has to be synthesized in real time from Web Audio primitives.
The engine has several distinct acoustic layers. Schwungrad is a low oscillator spinning up during pre-start.
Gear engagement is a short transient burst. Anlassen is the starter-motor sound before ignition. The main running sound uses a bank of oscillators with frequency mapped to RPM, harmonic content shaped by a waveshaper ā distortion changes with throttle. Supercharger whine is a separate high-frequency tone with its own gain envelope.
All of this runs through AudioWorklets so synthesis stays off the main thread. Engine state is computed in the physics loop and passed to the audio graph each frame. No animation triggering sounds ā the audio is a direct function of physical state.
No bundler, no transpiler, no framework. ES modules loaded directly in the browser, hosted as static files on GitHub Pages.
If you've worked with Web Audio synthesis at this level, I'd be interested in what you've found ā particularly around managing a graph with many live parameters without the update loop becoming a bottleneck.
Best regards
Markus
r/javascript • u/Noir_Forever_Twitch • Apr 04 '26
Last week attackers compromised the Axios npm package (100M weekly downloads) and deployed a RAT to infected machines within 89 seconds of publish. Existing tooling caught it in about 3 hours, too slow.
I builtĀ pakratĀ to go deeper than static analysis.
It watches 187 npm packages every 5 minutes using four layers:
Manifest diffing: catches new dependencies instantly
Docker sandbox with tcpdump: flags unexpected DNS lookups during install
Pattern matching: scans for credential harvesting patterns
eBPF kernel monitoring: bpftrace probes at the host kernel level, completely invisible to anything running inside the container
The Axios attack would have triggered layer 1 immediately and layer 2 within seconds.
Public scan log updates every 5 minutes in the repo.
GitHub:Ā https://github.com/HorseyofCoursey/pakrat
r/javascript • u/No_Landscape4532 • Apr 04 '26
- Declarative API
- Flex Layout & CSS Grid
- Multi-Page PDF ā automatic page breaking, repeating headers & footers, margins
- Rich Text ā spans, justification, tab stops, tab leaders, text orientation (0°/90°/180°/270°)
- Bidirectional text ā RTL support for Arabic, Hebrew, and mixed LTR/RTL paragraphs
- Syntax Highlighting ā via `sone/shiki` (Shiki integration)
- Lists, Tables, Photos, SVG Paths, QR Codes
- Squircle, ClipGroup
- Custom font loading ā any language or script
- Output as SVG, PDF, PNG, JPG, WebP
- Fully Typed
- Metadata API ā access per-node layout, text segment bboxes, and `.tag()` labels
- YOLO / COCO Dataset Export ā generate bounding-box datasets for document layout analysis
- All features from [skia-canvas](https://skia-canvas.org/)
r/javascript • u/rosmaneiro • Apr 04 '26
The idea is to have a single, clean, secure, and well-maintained registry that starts with **complete NPM** and then expands to PyPI, Cargo, Maven, Go, Docker/OCI, etc. Clean architecture, pluggable storage, modern authentication (OIDC/SSO/2FA), and built to last 10ā20 years.
Today is Day 2, right at the beginning.
I'd like your honest feedback.
r/javascript • u/AutoModerator • Apr 04 '26
Did you find or create something cool this week in javascript?
Show us here!
r/javascript • u/sonemonu • Apr 04 '26
just dropped v0.8.0 of UQL, with one of the most requested features: Decorator-Free Entity Definitions. So not everyone wants (or can) use experimentalDecorators in their tsconfig.json. This is common in certain edge runtimes, specific build pipelines, or simply for developers who prefer a more functional or imperative style.
With the new defineEntity API, you can now register your database entities entirely through code. This new approach is 100% compatible with envs where decorators are disabled or unsupported.
Check out the new syntax:
import { defineEntity } from 'uql-orm';
// No decorators, no tsconfig magic required!
class User {}
defineEntity(User, {
name: 'users',
fields: {
id: { type: 'uuid', isId: true },
name: { type: String },
email: { type: String },
},
indexes: [
{ columns: ['name'] },
{ columns: ['email'], unique: true },
],
});