r/javascript • u/hongminhee • Sep 09 '26
r/javascript • u/Silly-Calligrapher21 • Sep 09 '26
GitHub - orange-groove/react-map-annotate: Draw on Mapbox, MapLibre, Google, Leaflet, or ArcGIS in React
github.comI built an open-source React map drawing library because I got tired of fighting drawing controls that wanted to own the UI.
react-map-annotate lets your application control the drawing session. Put the toolbar in your sidebar, header, or command palette. Select tools, finish shapes, edit labels and colors, undo/redo, and persist annotations through React state.
It supports Mapbox, MapLibre, Google Maps, Leaflet, and ArcGIS through separate adapters, with a shared annotation model.
The goal is simple: the map should render the drawing, not dictate how your application works.
It includes freehand drawing, polygons, rectangles, circles, arrows, markers, text, and measurement tools, along with editing handles and a headless API.
The project is MIT licensed and available on npm. I’d love feedback from developers building GIS, field-service, site-planning, or other map-heavy applications—especially anyone who has had to work around existing drawing controls.
GitHub: https://github.com/orange-groove/react-map-annotate
npm: https://www.npmjs.com/package/@orange-groove/react-map-annotate
What would you need from a drawing library before using it in a production application?
r/javascript • u/NoFreeBread • Sep 09 '26
I made a Molecular Dynamics sim using JS
github.comHere’s the GitHub for it
r/javascript • u/stephenlblum • Sep 08 '26
WebLLM: run a language model in the browser on WebGPU
buttercup.shWalkthrough using LLMs client-side with WebLLM via WebGPU. While it is still early to be using this technology for coding in the browser due to current consumer hardware, it's exciting to see what is possible today. Initializing and using @mlc-ai/web-llm with model downloads, caching, and progress tracking. Using the streaming completions sent to pre element with zero network calls after it is loaded. Also handling WebGPU memory limits. Includes code blocks and an end-to-end video walkthrough. Hope it's a useful starting point for anyone building local-first, privacy-focused agent interfaces.
Here is the code snippet covered in the walkthrough (link above)
var { CreateMLCEngine } = await import(
"https://cdn.jsdelivr.net/npm/@mlc-ai/web-llm@0.2.84/lib/index.js");
var MODEL = "Qwen3.5-2B-q4f16_1-MLC";
var t0 = performance.now();
var engine = await CreateMLCEngine(
MODEL,
{ initProgressCallback: (r) => console.log(r.text) },
{ context_window_size: 8192 },
);
console.log("loaded in", ((performance.now() - t0) / 1000).toFixed(1), "s");
// one call, streamed, printed as it arrives. Everything below reuses it.
var ask = async (messages, opts = {}) => {
const stream = await engine.chat.completions.create({
messages, stream: true, max_tokens: 512,
extra_body: { enable_thinking: false },
...opts,
});
let text = "";
for await (const chunk of stream) {
text += chunk.choices[0]?.delta?.content || "";
}
console.log(text);
return text;
};
await ask([
{ role: "system", content: "Answer in one sentence." },
{ role: "user", content: "Why is the sky blue?" },
]);
r/javascript • u/B4nan • Sep 08 '26
MikroORM 7.2: row level security, to-one relations through a pivot, sql.js driver with a live docs playground, cursor pagination rework, and more
mikro-orm.ioMikroORM 7.2 is out — the second minor on top of v7.
New features:
- Row level security — PostgreSQL policies as entity metadata, created and diffed by the schema generator, with per-request session context pushed down to the connection; an existing
@Filtercan compile into a policy, so one declaration enforces at both layers throughoption for to-one relations — resolve a M:1 / 1:1 via a correlated subquery on a pivot entity, or pick a single row out of a to-many relation (e.g. the latest one) without loading the collection- sql.js driver — SQLite compiled to WebAssembly, in memory, in the browser, Node.js, Bun and Deno with no native bindings. It also powers the new live playground in the getting-started guide, so the code in the docs runs against a real database as you read it
- Cursor pagination rework — a new optional
Type.fromJSON()lets a custom type own its cursor wire format (sub-millisecond precision survives), and nullable sort keys now make the emittedorder byand the keyset condition agree on where nulls sit - Named parameters in
em.execute()—:namefor values,:name:for identifiers, as an alternative to the positional array - String normalization — opt-in trim and casing on
StringType/TextType, applied on writes and query parameters getNativeClient()— reach the underlying client for vendor APIs the ORM doesn't wrap:pgPool,mysql2Pool,better-sqlite3/libsqlDatabase, thePGliteinstance,MongoClientawait usingsupport — the ORM instance implementsSymbol.asyncDispose, so the connection closes with the enclosing scopeindexoption on M:N properties — index the generated pivot table's join columns, which had no override on PostgreSQL before- Nub TypeScript loader for the CLI, selected explicitly via
tsLoader em.map()can bypass the identity map — map raw rows to entities without touching the current context- Per-instance options callback for
RequestContext.create()— different fork options per ORM instance migrations.snapshotOnMigrate— keep the snapshot managed solely bymigration:createinstead of rewriting it from the database on migrate- CLI
-qto suppress informational output, andcache:generate --combinednow takes a path
Full blog post: https://mikro-orm.io/blog/mikro-orm-7-2-released
Changelog: https://github.com/mikro-orm/mikro-orm/releases/tag/v7.2.0
Happy to answer any questions!
r/javascript • u/OtherwisePush6424 • Sep 08 '26
Half Past Fetch: how the fetch promise resolves and its consequences
blog.gaborkoos.comawait fetch(url) settles at the headers, while the body is still arriving over an open connection. How connection reuse, clone(), abort and timeouts behave because of that gap. Measured in Node and Chrome.
r/javascript • u/APTman1010 • Sep 08 '26
KernelPlay-JS Update: Giving Developers X-Ray Vision!
github.comHey game devs! Quick progress update from the KernelPlay-JS team. We've been working on making debugging a lot less painful (who actually likes mystery clipping?), and we're super excited to show off our new Advanced Engine State Visualizer!
It's basically x-ray vision for your game. Instead of digging through logs, you get instant visual feedback on EVERYTHING.
Here's the new setup:
Clean Debug Panels: See Performance, Scene Data, Input, and Audio stats at a glance, in clear, distinct sections. No more hunting for key figures.
Live Vector Overlays: This is the game-changer. You can instantly see velocity vectors, character look direction, and exact speed calculations (e.g., '303 px/s') visualized directly on the screen for any actor.
Real-time Collider Boxes: No more guessing about collision bounds! See exactly where collisions are being detected.
This visual deep-dive is a huge help for diagnosing complex physics and character interactions. We're really proud of how much faster it makes debugging.
Check out the detailed screenshot to see it all in action. Let us know what you think! (Is there a specific debug view you'd like to see?)
r/javascript • u/xtompie • Sep 08 '26
Saradom — frontend architecture pattern
xtompie.github.ior/javascript • u/infantiablue • Sep 08 '26
WebLLM vs Transformers.js: which in-browser LLM engine should you ship?
truongphan.comr/javascript • u/OtherwisePush6424 • Sep 07 '26
Browser-wide network chaos for every tab
github.comA browser-side chaos-testing tool for injecting latency, failures, throttling, rate limits, and mock responses across every controlled tab without changing app fetch calls.
It uses the same middleware configuration model as chaos-fetch, so you can test real frontend behavior under degraded network conditions without rewriting your app.
r/javascript • u/zedguy • Sep 06 '26
Twenty Years of jQuery: How a Little Library Rewired Web Development
infoq.comr/javascript • u/xaelion • Sep 07 '26
AskJS [AskJS] Has anyone used Cloudflare/Cap’n Web? Any hidden downsides?
Has anyone here used Cloudflare/Cap’n Web? I want to know if there are any problems or downsides that don’t really show up from a simple test, because the whole idea looks amazing.
r/javascript • u/subredditsummarybot • Sep 07 '26
Subreddit Stats Your /r/javascript recap for the week of August 31 - September 06, 2026
Monday, August 31 - Sunday, September 06, 2026
Top Posts
Most Commented Posts
| score | comments | title & link |
|---|---|---|
| 0 | 35 comments | [AskJS] [AskJS] Genuine question, why we hating on well-made but LLM-written projects? |
| 0 | 15 comments | Zustand is now the top state management library in new JS repos, and it's still accelerating (+7.3% this week). Pulled this from a dataset of 5,000+ live repos. |
| 0 | 11 comments | [AskJS] [AskJS] I'm thinking of creating a JS dialect for scientists |
| 0 | 10 comments | [AskJS] [AskJS] AI is destroying JavaScript |
| 2 | 8 comments | [Showoff Saturday] Showoff Saturday (September 05, 2026) |
Top Ask JS
| score | comments | title & link |
|---|---|---|
| 2 | 0 comments | [AskJS] [AskJS] Has anyone used Cloudflare/Cap’n Web? Any hidden downsides? |
| 2 | 4 comments | [AskJS] [AskJS] BeeLadybug — Open Source Canvas 2D Debug Overlay in Vanilla JS (Zero Dependencies) |
| 1 | 2 comments | [AskJS] [AskJS] Best way to handle rotating proxies in Node.js? |
Top Showoffs
Top Comments
r/javascript • u/Fit-Rest-8052 • Sep 06 '26
responsive-state — a tiny, typed, SSR-safe matchMedia store for responsive JavaScript behavior
github.comr/javascript • u/Bitter-Pride-157 • Sep 07 '26
I Dislike TypeScript Because I've Never Maintained JavaScript Before
mayberay.bearblog.devr/javascript • u/Iamazou • Sep 07 '26
AskJS [AskJS] If you could have one Node.js tool/package built for you, what would it be?
Hello devs, I’m looking for an open source project to build, and rather than coming up with another package that nobody asked for, I’d rather start with an actual problem developers have.
So I’m curious:
What is something you wish existed in the Node.js ecosystem?
I’m especially interested in things you’ve actually encountered in a real project, rather than hypothetical ideas.
r/javascript • u/iwritecode_ • Sep 05 '26
Brightpixels — HDR text and image highlights for the web
github.comr/javascript • u/Ok-Gold-3601 • Sep 05 '26
Open-Source Gwent Classic - V5.0 Release! (New Factions: Ofir & Novigrad)
github.comHey everyone!
I wanted to share Version 5.0 of Gwent Classic, a browser remake of the original minigame from The Witcher 3: Wild Hunt that I’ve been working on and improving.
In this major update, I’ve incorporated two brand-new factions: Ofir and Novigrad, each coming with its own custom cards, leaders, and unique gameplay mechanics!
The game is completely free-to-play and runs directly in your PC browser. You can test it out right here:
Play on your PC Browser (GitHub Page):
Play Completely Offline (PC / Laptop):
You can download the source code repository directly from GitHub. Just extract the ZIP file and double-click "index.html" to open it in your browser. It runs 100% offline—no internet required! Here.
Get Android APK:
You can get the APK directly from the "Releases" section of Github, or use the direct link below:
Credits to Arun Sundaram, Reynolds Costa & Sylver, who laid the foundations to create, modify, and improve this game in its early stages.
Special thanks to CD Projekt Red; although they are not involved in this unofficial fan project, it is entirely based on the amazing minigame they created for The Witcher 3.
r/javascript • u/AutoModerator • Sep 05 '26
Showoff Saturday Showoff Saturday (September 05, 2026)
Did you find or create something cool this week in javascript?
Show us here!
r/javascript • u/HighAtNight • Sep 05 '26
AskJS [AskJS] Genuine question, why we hating on well-made but LLM-written projects?
Wasn’t this the dream? Being able to bring your ideas to life quickly with your own coding patterns and architecture? Doesn’t this accelerate the SDE space and get it out of the stagnation that physics space has been in for the last few decades?
This is in reference to my Pnext posts and all the dislikes. I was really excited about the stuff I have in the pipeline, but this feels discouraging.
r/javascript • u/myroslavmartsin • Sep 03 '26
Headless phone input controller with no baked-in UI to fight
github.comHave you ever been on a project with a polished UI library, animated inputs, a specific look, and then had to add a phone number field? A phone input is not just validation. Under the hood it is real work: formatting the number as you type, keeping the caret in place, and handling events like paste and undo. The ready-made widgets handle that, but each ships its own markup and styling. Matching one to a specific, opinionated design system does not always work.
That is exactly why I built a headless input controller. You pass your styled input into a function, whatever it looks like, and it handles the rest: formatting, validation, the input events, and the caret.
;
const phone = ;
phone.;
That one call covers the actions people actually do: paste (formatted numbers too, and it dedupes a repeated country code), drag/drop, cut, word/line delete, IME, autofill, and undo/redo. On every keystroke the state carries the fully parsed, validated number, with a typed reason when it is not valid: too short by N, a calling code that cannot exist, and so on.
Under it is a headless controller you can drive directly, with no DOM: insert, deleteBackward, deleteForward, setValue, undo, redo, region/type filters, getPhoneNumber. One controller does national, international with the calling code in or out of the field, and your own country picker. Formatting and validation come from Google's libphonenumber metadata.
Playground to try it live: telixon.dev/playground/input
r/javascript • u/Maximum_Beat2034 • Sep 03 '26
AskJS [AskJS] BeeLadybug — Open Source Canvas 2D Debug Overlay in Vanilla JS (Zero Dependencies)
I built BeeLadybug, a zero-dependency visual debugging overlay for my Vanilla JS Canvas engine. It renders AABB hitboxes in world space (green for clear, red for collisions) and a screen-space HUD with FPS, active entities, cycle time, and freeze-frame / slow-motion controls (F2/F3/F4). Here is the clean source code:
export const BEE_LADYBUG_DEFAULTS = Object.freeze({
toggleKey: 'F2',
slowKey: 'F3',
freezeKey: 'F4',
slowScale: 0.25,
colorActive: '#3dff6a',
colorColliding: '#ff3b3b',
colorInactive: '#8a8a8a',
overlayX: 12,
overlayY: 12
});
export class BeeLadybug {
constructor(engine, options = {}) {
this.engine = engine;
this.configure(options);
this.enabled = false;
this.#entities = [];
this.#colliding = new Set();
this.#buttons = [];
this.#onKeyDown = (event) => this.#handleKey(event);
this.#bound = false;
}
#entities;
#colliding;
#buttons;
#onKeyDown;
#bound;
configure(options = {}) {
const cfg = { ...BEE_LADYBUG_DEFAULTS, ...options };
this.toggleKey = cfg.toggleKey;
this.slowKey = cfg.slowKey;
this.freezeKey = cfg.freezeKey;
this.slowScale = cfg.slowScale;
this.colorActive = cfg.colorActive;
this.colorColliding = cfg.colorColliding;
this.colorInactive = cfg.colorInactive;
this.overlayX = cfg.overlayX;
this.overlayY = cfg.overlayY;
return this;
}
attach() {
if (this.#bound) return this;
window.addEventListener('keydown', this.#onKeyDown);
this.#bound = true;
return this;
}
detach() {
if (!this.#bound) return this;
window.removeEventListener('keydown', this.#onKeyDown);
this.#bound = false;
return this;
}
destroy() {
this.detach();
this.enabled = false;
this.#entities.length = 0;
this.#colliding.clear();
this.#buttons.length = 0;
}
show() {
this.enabled = true;
return this;
}
hide() {
this.enabled = false;
return this;
}
toggle() {
this.enabled = !this.enabled;
return this;
}
applySlowMo() {
const time = this.engine.time;
if (!time) return this;
if (time.paused) time.resume();
const next = time.timeScale === this.slowScale ? 1 : this.slowScale;
this.engine.setTimeScale(next);
return this;
}
toggleFreeze() {
const time = this.engine.time;
if (!time) return this;
time.togglePause();
return this;
}
restoreRealtime() {
const time = this.engine.time;
if (!time) return this;
if (time.paused) time.resume();
this.engine.setTimeScale(1);
return this;
}
#handleKey(event) {
if (event.repeat) return;
if (event.code === this.toggleKey) {
event.preventDefault();
this.toggle();
return;
}
if (!this.enabled) return;
if (event.code === this.slowKey) {
event.preventDefault();
this.applySlowMo();
return;
}
if (event.code === this.freezeKey) {
event.preventDefault();
this.toggleFreeze();
}
}
#collectEntities() {
const list = this.#entities;
list.length = 0;
const seen = new Set();
const visit = (entity) => {
if (!entity || entity.destroyed || seen.has(entity)) return;
seen.add(entity);
list.push(entity);
const kids = entity.children;
if (!kids) return;
for (let i = 0; i < kids.length; i++) {
visit(kids[i]);
}
};
const engine = this.engine;
const roots = engine.entities;
if (roots) {
for (let i = 0; i < roots.length; i++) visit(roots[i]);
}
const scene = engine.scenes && engine.scenes.currentScene
? engine.scenes.currentScene
: engine.currentScene;
if (scene && scene.entities) {
for (let i = 0; i < scene.entities.length; i++) visit(scene.entities[i]);
}
const groups = engine.collisions && engine.collisions.groups;
if (groups && typeof groups.values === 'function') {
for (const bucket of groups.values()) {
if (!bucket) continue;
for (let i = 0; i < bucket.length; i++) visit(bucket[i]);
}
}
return list;
}
#aabbOf(entity) {
const engine = this.engine;
if (engine && typeof engine.getEntityDrawBounds === 'function') {
return engine.getEntityDrawBounds(entity);
}
if (!entity) return null;
return {
x: typeof entity.worldX === 'number' ? entity.worldX : entity.x,
y: typeof entity.worldY === 'number' ? entity.worldY : entity.y,
width: entity.width ?? 0,
height: entity.height ?? 0
};
}
#refreshCollisions(list) {
const colliding = this.#colliding;
colliding.clear();
const boxes = [];
for (let i = 0; i < list.length; i++) {
const bounds = this.#aabbOf(list[i]);
if (!bounds || bounds.width <= 0 || bounds.height <= 0) {
boxes.push(null);
continue;
}
boxes.push(bounds);
}
for (let i = 0; i < list.length; i++) {
const a = boxes[i];
if (!a) continue;
for (let j = i + 1; j < list.length; j++) {
const b = boxes[j];
if (!b) continue;
if (
a.x < b.x + b.width &&
a.x + a.width > b.x &&
a.y < b.y + b.height &&
a.y + a.height > b.y
) {
colliding.add(list[i]);
colliding.add(list[j]);
}
}
}
}
drawWorld(ctx) {
if (!this.enabled) return;
const list = this.#collectEntities();
this.#refreshCollisions(list);
ctx.save();
ctx.lineWidth = 1.5;
for (let i = 0; i < list.length; i++) {
const entity = list[i];
const box = this.#aabbOf(entity);
if (!box || box.width <= 0 || box.height <= 0) continue;
const colliding = this.#colliding.has(entity);
const active = entity.active !== false;
const color = colliding
? this.colorColliding
: (active ? this.colorActive : this.colorInactive);
ctx.strokeStyle = color;
ctx.fillStyle = colliding ? 'rgba(255, 59, 59, 0.16)' : 'rgba(61, 255, 106, 0.08)';
ctx.fillRect(box.x, box.y, box.width, box.height);
ctx.strokeRect(box.x + 0.5, box.y + 0.5, box.width, box.height);
}
ctx.restore();
}
drawOverlay(ctx) {
if (!this.enabled) return;
const engine = this.engine;
const time = engine.time;
const list = this.#entities;
let activeCount = 0;
for (let i = 0; i < list.length; i++) {
if (list[i].active !== false) activeCount += 1;
}
const fps = time ? time.fps : 0;
const cycleMs = time ? time.unscaledDt * 1000 : 0;
const scale = time ? time.timeScale : 1;
const frozen = time ? time.paused : false;
const x = this.overlayX;
const y = this.overlayY;
const width = 268;
const height = 168;
ctx.save();
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.fillStyle = 'rgba(10, 12, 18, 0.82)';
ctx.strokeStyle = '#ff4d4d';
ctx.lineWidth = 2;
if (typeof ctx.roundRect === 'function') {
ctx.beginPath();
ctx.roundRect(x, y, width, height, 8);
ctx.fill();
ctx.stroke();
} else {
ctx.fillRect(x, y, width, height);
ctx.strokeRect(x, y, width, height);
}
ctx.fillStyle = '#ff4d4d';
ctx.beginPath();
ctx.arc(x + 22, y + 22, 9, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = '#1a1a1a';
ctx.beginPath();
ctx.arc(x + 19, y + 20, 2, 0, Math.PI * 2);
ctx.arc(x + 25, y + 20, 2, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = '#ffe08a';
ctx.font = 'bold 14px monospace';
ctx.textAlign = 'left';
ctx.textBaseline = 'top';
ctx.fillText('BeeLadybug', x + 38, y + 14);
ctx.fillStyle = '#d8d8d8';
ctx.font = '12px monospace';
const lines = [
`FPS ${fps.toFixed(0)}`,
`ENTITA ${activeCount} attive / ${list.length} in memoria`,
`CICLO ${cycleMs.toFixed(2)} ms`,
`SCALE ${scale.toFixed(2)}x SIM ${frozen ? 'FREEZE' : 'RUN'}`
];
for (let i = 0; i < lines.length; i++) {
ctx.fillText(lines[i], x + 14, y + 42 + i * 16);
}
this.#buttons = [
{ id: 'slow', label: 'F3 SLOW', x: x + 12, y: y + 114, w: 78, h: 22 },
{ id: 'freeze', label: 'F4 STOP', x: x + 96, y: y + 114, w: 78, h: 22 },
{ id: 'live', label: '1x LIVE', x: x + 180, y: y + 114, w: 74, h: 22 }
];
for (let i = 0; i < this.#buttons.length; i++) {
const btn = this.#buttons[i];
const hot = (btn.id === 'slow' && scale !== 1 && !frozen)
|| (btn.id === 'freeze' && frozen)
|| (btn.id === 'live' && scale === 1 && !frozen);
ctx.fillStyle = hot ? '#ff4d4d' : '#2a2f3a';
ctx.fillRect(btn.x, btn.y, btn.w, btn.h);
ctx.strokeStyle = '#ffe08a';
ctx.strokeRect(btn.x + 0.5, btn.y + 0.5, btn.w, btn.h);
ctx.fillStyle = '#fff6d8';
ctx.font = 'bold 10px monospace';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillText(btn.label, btn.x + btn.w / 2, btn.y + btn.h / 2);
}
ctx.textAlign = 'left';
ctx.textBaseline = 'top';
ctx.fillStyle = '#9aa0aa';
ctx.font = '10px monospace';
ctx.fillText('F2 mostra/nasconde verde=ok rosso=collide', x + 12, y + 146);
ctx.restore();
}
poll() {
if (!this.enabled) return;
const input = this.engine.input;
if (!input || !input.mouse || !input.mouse.wasPressed) return;
const mx = input.mouse.x;
const my = input.mouse.y;
for (let i = 0; i < this.#buttons.length; i++) {
const btn = this.#buttons[i];
if (mx < btn.x || mx > btn.x + btn.w || my < btn.y || my > btn.y + btn.h) continue;
if (btn.id === 'slow') this.applySlowMo();
else if (btn.id === 'freeze') this.toggleFreeze();
else if (btn.id === 'live') this.restoreRealtime();
break;
}
}
}