Adding Features

Learn where to add different types of code in the admin panel.

Decision Tree

Where should I add my code?
  1. Is it a new page/route? → Add to admin/apps/panel/src/routes/
  2. Is it a reusable UI component? → Add to admin/packages/ui/
  3. Is it business logic or API call? → Add to admin/packages/core/
  4. 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

Update src/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 use prefix (useReports)
  • Utilities: camelCase (formatDate)
  • Files: Match export name (DataTable.tsx)

4. Export from Index

Always export from index.ts for clean imports: