Adding Features
Learn where to add different types of code in the admin panel.Decision Tree
Where should I add my code?- Is it a new page/route? → Add to
admin/apps/panel/src/routes/ - Is it a reusable UI component? → Add to
admin/packages/ui/ - Is it business logic or API call? → Add to
admin/packages/core/ - Is it app-specific? → Add to
admin/apps/panel/src/components/
Adding a New Route
1. Create Route File
Location:admin/apps/panel/src/routes/
2. Register Route
Updatesrc/app.tsx to include your route.
Adding a Shared Component
1. Create Component
Location:admin/packages/ui/src/components/
2. Export Component
File:admin/packages/ui/src/components/index.ts
3. Use Component
Adding Business Logic
1. Create Hook
Location:admin/packages/core/src/hooks/
2. Export Hook
File:admin/packages/core/src/hooks/index.ts
3. Use Hook
Adding API Endpoints
Update API Client
Location:admin/packages/core/src/api/rest/client.ts
Adding Utilities
1. Create Utility
Location:admin/packages/core/src/utils/
2. Export Utility
File:admin/packages/core/src/utils/index.ts
3. Use Utility
Best Practices
1. Keep Packages Focused
- Core: Business logic, no UI
- UI: Components, no business logic
- Panel: Routes and composition
2. Use TypeScript
Always define types for your data:3. Follow Naming Conventions
- Components: PascalCase (
DataTable) - Hooks: camelCase with
useprefix (useReports) - Utilities: camelCase (
formatDate) - Files: Match export name (
DataTable.tsx)
4. Export from Index
Always export fromindex.ts for clean imports:
Related Documentation
- Architecture - Understand the structure
- Module Boundaries - Know where to put code
- Build Scripts - Test your changes
- Public API - Package API surface guidelines