No 800 Packages in node_modules and No Heavy Electron: Three Debatable Yet Practical Principles of JS MinimalismArticle · digest for November 21
Paper collage showing a clean lightweight code core with redundant library layers stripped away
Article4 sections≈ 7 min

No 800 Packages in node_modules and No Heavy Electron: Three Debatable Yet Practical Principles of JS Minimalism

"We scammed people. We promised to talk about AI, and instead we're talking about an industry-wide mess," joked Timur Shemsedinov (creator of HowProgrammingWorks, 15 years in JS after .NET and Borland) and Vlad Ten at the start of their joint stream. Still, the conversation circled back to AI—just from an unexpected angle.

Rewind five years, before AI agents existed in code editors. JavaScript projects were already drowning in external code that nobody read. Shemsedinov put it bluntly: "It was slop generated not by AI, but by crowds of unchecked human brains dumping everything into npm." Open node_modules in an average web app, and it's hard to disagree. From that talk came three debatable yet practical rules of minimalism: trimming dependencies, replacing Electron with PWAs, and dropping inline TypeScript. Let's see what actually works and where the approach creates its own headaches.

"Human Slop" in npm and the 12–30 Dependency Rule

A package manager feels like a shortcut: run one command, grab a helper function, move on. But behind a harmless library often hides a long tail of transitive dependencies—packages you never installed directly, pulled in by your libraries, which pulled in theirs. Instead of two small utilities, you end up with 800 folders from strangers on your disk.

Trusting foundational tech like V8, Node.js, browsers, or PostgreSQL makes sense—they have large teams and years of scrutiny. Trusting a tiny package maintained by one random contributor on GitHub does not. Vlad Ten pointed to Socket, a scanner teams wire into CI to catch supply-chain attacks—where attackers hijack or spoof a popular npm package so npm install pulls malicious code into thousands of projects. Vulnerabilities regularly pop up even in tiny terminal-coloring packages with 20,000 downloads. The classic ecosystem meme is installing is-even just to check parity and getting a dependency tree for a one-liner.

Vibe coding only makes this worse. Ask an AI to build a simple form, and it defaults to pulling in React and dozens of packages when two files would do. Shemsedinov's rule is strict but clear: stick to 12–30 vetted core packages from authors whose code you know, pin versions, and review diffs on updates. Clean libraries don't drag in junk. With transitive packages, that set grows to maybe 60 folders, never 800. Paired with Socket or npm audit and a strict lockfile, you cut out most of the risk.

Electron vs. PWA and Service Workers: Why Does a Chat App Need Its Own Browser?

The second pain point is wrapping a web UI in Electron just to ship a "desktop" app. Vlad Ten nailed the contrast: "In Battlefield 3, a building collapses in real time with ray tracing at 60 FPS, and voice and text chat still work. Meanwhile, Microsoft Teams lags on my desktop." You install a native-looking client expecting speed. Instead, you get another Chromium instance eating RAM just to show a chat window.

Shemsedinov reminds us that browsers already ship Web Components, Canvas, SVG, IndexedDB, WebUSB, Web Bluetooth, and Web MIDI. The main alternative to Electron is pairing a PWA with the Service Worker API. A Service Worker is a background browser script that runs independently of any tab, acting like a local proxy. It intercepts network requests, manages cache, and coordinates tabs—even 50 open tabs can share one worker and a single server connection. Using the Web Push API, the worker wakes up and shows notifications even when the tab is closed.

Official Progressive Web Apps (PWA) illustration on web.dev (Source: web.dev)

Registering one takes just a few lines with zero build tools:

// Register a Service Worker after the page loads
if ('serviceWorker' in navigator) {
  window.addEventListener('load', () => {
    navigator.serviceWorker
      .register('/sw.js')
      .catch((err) => console.error('SW failed:', err));
  });
}

Once called, the browser fetches /sw.js, runs it in the background, and lets it handle requests for that origin. The in navigator check and .catch() keep older browsers or missing scripts from breaking the page.

"Wait—can a PWA really replace a desktop app?" It's a fair question, and you shouldn't get carried away. On iOS Safari (16.4+), Web Push only works if the user adds the PWA to their Home Screen, not from a regular browser tab. WebKit also requires showing a visible notification right away via event.waitUntil(registration.showNotification(...))—silent pushes can get permissions revoked. And if your app needs full local filesystem access, raw system sockets, a tray icon, or native binaries, Electron is still necessary. For a chat app, CRM, or tracker, though, the browser is often plenty.

Plain JS and Separate .d.ts Files Instead of Inline TypeScript

The sharpest claim in the stream targeted TypeScript. Shemsedinov isn't against types—he dislikes how they clutter source files: "90% of the time when you read TypeScript, your eyes glaze over from walls of unions and generics, and the actual logic disappears." Vlad laughed and chimed in: "At least you can spot any!" Timur's point: in a good statically typed language, types are mostly inferred, whereas TS annotations layered over dynamic JS often turn into visual noise.

A working alternative is documented in the TypeScript handbook. You write plain JavaScript and keep contracts in separate .d.ts declaration files (or JSDoc). Type checking runs via tsc --noEmit with checkJs enabled:

{
  "compilerOptions": {
    "allowJs": true,
    "checkJs": true,
    "noEmit": true,
    "strict": true
  },
  "include": ["src/**/*.js", "types/**/*.d.ts"]
}

This config tells the TypeScript compiler to check plain .js files under strict rules without emitting any output files. Your function contracts live separately in a types folder, away from business logic:

// types/math.d.ts — declare signatures outside JS code
export declare function sum(a: number, b: number): number;

The upside is clear: .js files run directly in Node.js and browsers with no compile step and no source-map headaches. Your IDE still gives autocomplete, and tsc --noEmit catches type errors in CI.

The Svelte team led by Rich Harris made a similar move in mid-2023. People often misrepresent it as "Svelte ditched TypeScript." In reality, they switched only the internal codebase of the compiler and library from .ts to plain JS + JSDoc to drop the dev build step and speed up debugging. Type checking with tsc --checkJs, .d.ts generation, and full TypeScript support for Svelte users never went anywhere.

Where Minimalism Pays Off—and Where It Reinvents the Wheel

Put all three axes side by side, and the trade-offs become obvious.

Stack axisUsual stackMinimalist optionWhat you pay
DependenciesHundreds of packages in node_modules12–30 vetted packages + auditsSlower start, writing some utilities yourself
ClientElectron wrapper around web UIPWA + Service Worker & Web APIsiOS Safari limits, no full OS access
TypingInline TypeScript (.ts)Plain JS + .d.ts / JSDoc & checkJsRisk of .d.ts drifting from code, unfamiliar to teams

Minimalism shines in small, senior teams, open-source libraries, and security-sensitive projects: less third-party code means fewer vulnerabilities and easier debugging. In a 50-to-200-person product org, though, dropping standard frameworks and inline TS can backfire fast. Without realizing it, the team ends up inventing its own undocumented mini-framework, and external .d.ts files quickly drift out of sync with live JS unless code review enforces them with an iron fist.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 6