Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.

Project structure · More

TypeScript npm library project structure

Opens with credits

A small, typed npm package (a retry helper) built the way modern libraries ship in 2026: TypeScript source in src, bundled by tsdown into dist with type declarations and an exports map, tested with Vitest, checked with publint and Are the Types Wrong, versioned with Changesets and published from CI with npm provenance. For students who want to publish their first package, and for anyone whose package works locally but breaks for users.

Curated by Tauseef FayyazIntermediate123 files and foldersTypeScript 7.0 (tsgo), tsdown 0.23, Node 24 LTS (builds need 22.18 or newer)Checked October 2026
Explore the filesPick any file to see what it is, why it exists and when you add it.

How it grows

Each stage opens the explorer there

  1. 1Day 1What the scaffold and your first hour give you15 files and folders
  2. 2GrowingWhat a real app with features and tests adds+44 files and folders
  3. ProductionWhat running it for real users adds+26 files and foldersOpens with credits
  4. ExpertWhat a team needs to keep it healthy for years+38 files and foldersOpens with credits

How it is organised

  • Users import `dist`, not `src`. Every check that matters (types, exports, Node versions) runs against the built package.
  • The `exports` map is the public API boundary: entries listed there can be imported, nothing else can. Let tsdown generate it, then verify it with publint and attw.
  • Ship ESM, and add CJS only if your users still need `require`. Dual builds are fine when tsdown builds both from one source; hand-maintained duplicates are not.
  • Zero runtime dependencies is the goal. Every dependency you add is installed by every user, forever.
  • Every user-facing change comes with a changeset, so versions follow semver and the changelog writes itself.
  • Releases come only from CI, with npm trusted publishing and provenance, never from a laptop.
  • A breaking change is anything that can fail a user's build or tests: a removed export, a narrower type, a new required option. It waits for a major version.

At the top of the project

Open one in the explorer for the full story

Learn more on Sefism

Roadmaps, cheat sheets and projects that go with TypeScript npm library.

See 9 more
Checked against 18 official sources, October 2026. If something has changed, the docs win.Show sources

Picked from the other libraries by shared topics.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.

  • 1:1 Mentorship
  • Fresh Graduate Mentorship
  • Career Guidance

Brand deals, promos and partnerships: tauseeffayyaz@gmail.com