0Pricing
Angular Academy · Lesson

Public API and Entry Points

Design a clean library surface.

The Public API Surface

A library should expose only what consumers are meant to use. The public API is the curated set of exports; everything else stays internal. In Angular libraries this surface is defined by public-api.ts.

public-api.ts as a Barrel

public-api.ts re-exports the symbols you want consumers to access. If something is not exported here, it is effectively private, even if it exists in the source.

// projects/ui-kit/src/public-api.ts
export * from './lib/button/button.component';
export * from './lib/theme.service';
// internal helpers are intentionally NOT exported

All lessons in this course

  1. Creating a Library with ng generate
  2. Public API and Entry Points
  3. Building with ng-packagr
  4. Publishing to npm
← Back to Angular Academy