The export surface of a codebase is a thing you can count, and almost nobody does. It decides how much of your code is reachable from anywhere, how much of your module graph is real, and how often "just export it" has been used instead of a decision. I counted ours: every export in the repository, who imports it, and how many nothing imports at all.

The subject is Nakodo, 582 TypeScript files under src, 72,683 lines, Next 16 with the App Router.

85 default exports, and the framework chose every one of them

53 page.tsx 19 loading.tsx 7 layout.tsx 1 sitemap.ts 1 robots.ts 1 manifest.ts 1 opengraph-image.tsx 1 not-found.tsx 1 error.tsx -- 85 total 

That is the complete list. Every default export in this codebase is in a file whose name the framework dictates, because the framework resolves those files by path and imports the default. The other 497 files, every component, every helper, every query, every Server Action, export only named values.

Nobody wrote that rule down. It emerged because a default export is only ever worth it when something outside your control is doing the importing, and in an App Router project that is exactly the set of filenames above. 58 of those 85 files also have named exports, which are the route segment config and metadata the framework reads alongside the component.

Each of those 53 page.tsx files is a URL. The guides index, the pricing page and the glossary are three of them, and the 63 content pages behind the dynamic segments all come from one more.

2,039 named exports

Kind Count
export function 970
export const 617
export type 264
export { ... } re-export 170
export class 18
export interface 0
export enum 0
export * 0

Zero export * in 582 files is the one I would defend hardest. A star re-export makes a module's surface unknowable without reading the modules behind it, and it defeats exactly the census this post is made of. The 170 explicit re-exports name every symbol they forward.

Per file, the median number of named exports is 1. 209 files export exactly one name. The biggest exporters are the places you would guess: the database schema at 62, a pricing module at 44, and one Server Actions file at 34. 90 files export no name at all, and they split cleanly: 27 are default-only page and layout files, and 63 are test files, which export nothing because the runner finds them by filename.

81 names exist in more than one file, and almost all of that is the framework contract again: metadata in 47 files, dynamic in 18, GET in 15, maxDuration in 14, generateStaticParams and generateMetadata in 9 each. The only application names that repeat are the four content page objects (guide in 22 files, niche in 20, audience in 8, post in 5), which is a convention rather than a collision: one page per file, same export name, assembled by one registry.

Who imports what

Resolving every named import in the repository and matching it against every declaration gives three populations.

753 exports are imported exactly once. That is 37% of the surface. A single-consumer export is not automatically wrong, but it is the population where "this should be a parameter" and "these two files should be one file" live.

130 exports are never imported by name because the framework calls them. metadata, generateMetadata, generateStaticParams, dynamic, dynamicParams, maxDuration, GET, POST, viewport, plus the three Open Graph image exports (alt, size, contentType). Nothing in my code mentions them, and deleting one changes the behaviour of a URL. Any dead-code tool that does not know this list will tell you to delete your entire routing configuration.

276 exports are never imported by anything. This is the interesting number, and it is mostly not what it looks like.

253 of those 276 are decoration

For each of the 276 I checked whether the name is used elsewhere inside its own file. 253 are. They are helpers, constants and types that one module uses internally and exports for no reader at all. The export keyword on them does nothing except widen the surface and defeat the compiler's unused-symbol check.

By directory, the top of that list is 47 in components/ui, which is the shadcn copy-paste layer: those files ship a primitive plus the types and sub-parts of that primitive, and most projects import three of the five names. The rest are spread across the server modules, where the pattern is a pipeline step that exports its own stage functions.

I am not going to mass-delete 253 export keywords. The useful version of this finding is a rule for new code: if a symbol is only used in its own file, it does not get exported, and a test helper that needs it imports the module rather than the symbol.

The twelve that nothing anywhere references

That leaves 23 exports with exactly one occurrence in the whole of src: their own declaration. Three groups:

Eight are imported by the maintenance CLI, which lives in scripts/ and not in src, so my scan never saw it. This is a straightforward scope error in the measurement, and it is worth stating because it is the most common way an export census lies: one-off operational entry points look dead from inside the application.

Two are framework entry points resolved by file, not by import: the proxy function in proxy.ts and the register function in instrumentation.ts. My framework list was incomplete, which the data caught for me.

One is loaded with a dynamic import and was therefore invisible to a scan that reads static import { ... } from statements only:

const SupportPanel = dynamic(() => import("./panel").then((m) => m.SupportPanel), { ssr: false }); 

If you run this census on your own codebase, that pattern is the trap to handle before you believe any result. Lazy-loaded panels, modals and editors are exactly the heavy components a team splits out, and they are exactly the ones a naive scan calls dead.

Which leaves twelve genuinely unreferenced exports in 2,039. Four React components, two types, and six functions or constants. The pleasing one is a date helper exported from the shared time module that nothing imports, while a private copy of the same three-line function is declared inside one background job and used twelve times there. The shared version is dead because the consumer rewrote it rather than importing it, which is a much more common failure than either file suggests on its own.

Two of the twelve I already knew about: a clock component with no importers, found when I audited the three clock components a fortnight ago, and a legend component for a chip that got absorbed into the chip itself.

What I take from this

  1. A census is cheap and the method is the hard part. Four passes, each about thirty lines of Python: declarations, static imports, same-file usage, then the leftovers by hand. The three corrections that mattered (the scripts directory, the file-resolved framework exports, the dynamic import) were all found by looking at the residue rather than by being clever up front.
  2. The default export rule is worth writing down. "Default exports only in files the framework resolves by name" is already true 85 times out of 85 here, and a one-line lint rule would keep it true.
  3. Delete the twelve, keep the 253 for a rule. Twelve dead exports is a twenty minute pull request. 253 unnecessary export keywords is a convention change, and the only way a convention change sticks is if new code follows it and old code is left alone until it is touched anyway.
  4. The duplicate date helper is the real bug in this post. A dead shared util plus a private reimplementation is two symptoms of one problem, and a census over exports finds the first half while a census over function bodies would find the second.

If you want to try it on your own repo, start with the smallest version: list every export default and check that each one is in a file something outside your code opens. On a framework project, the answer should be a short, boring list, and if it is not, you have found something more interesting than I did.