Public API Surface
This document describes the public API for the admin panel packages.Overview
Both@monorepo/solid-pkg-ui and @monorepo/solid-pkg-core now expose a controlled public API surface through their root index.ts files. This prevents deep imports and allows internal refactoring without breaking changes.
@monorepo/solid-pkg-ui
Exported Components
Available Components
- GlassButton - Button component with glassmorphism styling
- GlassCard - Card component with glassmorphism styling
- ProtectedRoute - Route wrapper that requires authentication
- AuthGuard - Conditional rendering based on auth state
Exported Types
❌ Do NOT Use
✅ Correct Usage
@monorepo/solid-pkg-core
Exported Modules
Available Exports
API ClientapiClient- Configured REST API client
authClient- Better Auth client- Other auth utilities from
./auth
useApprovals- Fetch approvals data- Other TanStack Query hooks from
./hooks
env- Environment configuration- Other config from
./config
cn- Class name utility (clsx + tailwind-merge)- Other public utilities from
./utils
- All types from
./types
❌ Do NOT Use
✅ Correct Usage
Benefits
1. Prevents Deep Imports ✅
Consumers cannot bypass the public API and import internal modules directly.2. Allows Internal Refactors ✅
You can:- Move files around
- Rename internal components
- Reorganize folder structure
- Change internal implementations
3. Enforces Design System Discipline ✅
- Only approved components are exported
- Prevents ad-hoc component usage
- Maintains consistency across apps
Example: Building a Page
Adding New Public Exports
When adding new components or utilities that should be part of the public API:For @monorepo/solid-pkg-ui
- Create your component in
packages/ui/src/components/ - Export it from
packages/ui/src/components/index.ts - Add it to
packages/ui/src/index.ts
For @monorepo/solid-pkg-core
- Create your hook/utility in the appropriate directory
- Export it from that directory’s
index.ts - It will automatically be available (we use
export *in the root)
Internal-Only Code
Some code should never be exported:- Internal helper functions
- Private utilities
- Implementation details
- Test utilities
- Development tools
index.ts file.
Migration Guide
If you have existing deep imports, update them:Enforcement (Optional)
You can add ESLint rules to prevent deep imports:Related Documentation
- Public API Implementation - Implementation details
- Public API Quick Reference - Quick reference guide
- Adding Features - Where to add new code
- Module Boundaries - Package dependencies