Canx Admin

Rapidly build admin panels with the make:admin generator.

Overview

Canx Admin provides a powerful generator to scaffold Admin Controllers and Views based on your models. It utilizes Canx UI components for a consistent and modern look.

Installation

Install the canx-admin package:

bash
bun add canx-admin

Generating Resources

To generate an admin CRUD interface for a model (e.g., User), run:

bash
npx canx-admin make:admin User

What gets generated?

  • src/app/controllers/Admin/UserController.ts
    Handles CRUD logic (index, create, store, edit, update, destroy).
  • src/resources/views/admin/users/index.tsx
    The list view using Canx UI Table and Buttons.

Analytics Dashboard

You can also generate a modern analytics dashboard:

bash
npx canx-admin make:dashboard

This creates src/resources/views/admin/dashboard.tsx with sample charts and metrics cards.

Next Steps

After generation, register your routes in routes/web.ts:

typescript
import { Route } from "canx/routing";
import { UserController } from "@/app/controllers/Admin/UserController";

Route.prefix("admin").group(() => {
    Route.resource("users", UserController);
});