Architecture
Too Much Tools is a single Next.js (App Router) application with strict internal module boundaries. It behaves like a plugin system: a small tool SDK, a registry, and self-contained tool folders.
The big picture
┌─────────────────────────────┐
│ src/tools/<id>/ │
│ definition.ts (metadata) │
│ logic.ts (pure) │
│ component.tsx (UI) │
│ worker.ts (optional) │
└───────────────┬─────────────┘
│ one entry each
▼
src/tools/registry.ts
(definition + lazy `load()` thunk)
│
┌────────────────────────────┼────────────────────────────┐
▼ ▼ ▼
lib/registry (search, app/tools/[toolId] components/
compatibility, lookups) (SSG route + SEO) command-palette,
│ │ home, tool, ui
▼ ▼
homepage, palette, ToolRunner (client):
Send-To targets records recent, consumes
transfer, dynamic-imports
the tool component
Everything the site shows (pages, search, categories, navigation, Send To destinations) is derived from the registry. There are no if (tool === ...) chains anywhere.
Layers
Tool SDK: src/lib/tool-sdk
Defines the contract and vocabulary: ToolDefinition, ToolDataType, ToolExecution (local | server | hybrid), the category catalog and the defineTool() helper. It imports nothing heavy. See Creating a Tool for the reference.
Registry: src/tools/registry.ts and src/lib/registry
registry.ts is the single source of truth for installed tools. Each entry pairs a light definition with a load thunk, a dynamic import of the tool's component:
export const TOOL_ENTRIES: ToolEntry[] = [
{ definition: base64, load: () => import("./base64/component") },
// …
];
lib/registry builds lookups, search and Send To compatibility on top of that list. Definitions are cheap to import eagerly; components stay behind load thunks so they are code-split.
Routing: src/app
app/page.tsxrenders the homepage;HomeBrowser(client) handles search, recents, favourites and category browsing.app/tools/[toolId]/page.tsxis statically generated for every tool and produces SEO metadata from the tool's definition.
Tool runtime: ToolRunner
A client component that takes only the tool id. On mount it records the tool in "recently used", consumes any staged Send To payload as initialInput, and lazily loads the tool component.
Data flow inside a tool
user input ──▶ component state ──▶ logic.ts (pure) ──▶ output
│
(optional) Web Worker for heavy inputs
Keeping logic pure and outside React makes it testable, runnable in a worker and reusable for tool chaining.
State
There are two kinds of client state:
- Preferences: non-sensitive, persisted locally through one central store (
src/lib/preferences). Components never touchlocalStoragedirectly. - Tool data: ephemeral and never persisted. Send To uses an in-memory, single-consumption transfer buffer (
src/lib/transfer).
import { usePreference, useFavorites, useRecents } from "@/lib/preferences/hooks";
const [theme, setTheme] = usePreference("theme");
const { favorites, toggle, isFavorite } = useFavorites();
const { recents, record } = useRecents();
Why one app instead of a monorepo
- Simpler contribution: one
pnpm install, one place to run. - Trivial self-hosting: a single
docker buildwith Next.js standalone output. - Same modularity: the seams already exist as module boundaries (
lib/tool-sdk,lib/registry,components/ui,tools/*). Tools never import each other.
Performance model
- Code splitting: opening one tool does not download any other tool's JavaScript.
- SSG: tool pages are prerendered as static HTML for fast first paint and SEO.
- Web Workers: heavy transforms run off the main thread above a size threshold, with a main-thread fallback.