dashforge-cli
v0.6.0
Published
Scaffold a ready-to-run Dashforge dashboard app (Tailwind or MUI) in seconds.
Maintainers
Readme
dashforge-cli
Scaffold a ready-to-run Dashforge app in seconds — pick your UI library and template and get a themed, dark-mode-ready Vite + React + TypeScript project.
Three templates:
dashboard— an app shell with stat cards, example cards, a data table, mock auth, RBAC and forms.landing— a fast, fully pre-rendered SaaS landing page (hero, features, pricing, FAQ, CTA), SEO-ready and responsive.crud— a full-stack starter: the dashboard plus a Posts CRUD section wired to a small Express + file-store backend (client/+server/, one command runs both).
All come in tw (Tailwind) and mui (Material UI). No lock-in — just
the boilerplate you'd otherwise write by hand.
Requirements: Node ≥ 22.22. Both this CLI and the app it generates need it — the generated app is built on React Router 8 + Vite 7, which require Node ≥ 22.22.
Usage
npx dashforge-cli my-app --lib tw # dashboard (default)
npx dashforge-cli my-site --lib tw --template landing # landing page
npx dashforge-cli my-app --lib mui --template crud # full-stack CRUDOr fully interactive (it will ask for the directory and the library):
npx dashforge-cliThe key=value form works too:
npx dashforge-cli my-app lib=mui template=dashboardOptions
| Option | Description |
| ------------------- | ---------------------------------------------------- |
| [directory] | Target directory (positional). |
| --lib <tw\|mui> | UI library: tw = Tailwind, mui = MUI. |
| --template <name> | Template: dashboard (default), landing, or crud.|
| --install | Install dependencies after scaffolding. |
| --no-install | Skip the dependency install. |
| --force, -f | Scaffold into a non-empty directory. |
| --help, -h | Show help. |
| --version, -v | Print the version. |
Variants
tw—@dashforge/tw(Tailwind CSS):AppShell+LeftNav+TopBar,Card,Table,Chip,Typography, themed viadashforgePreset()andDashforgeTailwindProvider. Dark mode viatoggleMode().mui—@dashforge/ui(Material UI):AppShell+DashforgeThemeProvider, base@mui/materialCard/Table. Dark mode by swapping the theme (defaultLightTheme/defaultDarkTheme).
What's inside
Both variants scaffold the same starter, built on react-router in framework mode:
- Routing + SEO — real routes (
app/routes.ts). Public pages (/,/sign-in) are pre-rendered to static HTML (ssr: false+prerender); the app is client-rendered behind sign-in. Deploy thebuild/clientfolder to any static host — no Node server required. - Themed app shell — side nav + top bar, workspace switcher, four stat cards, two example cards (chart placeholders), and a data table with mock data. Dark mode wired and working.
- Mock auth —
login → session → route guard. Sign in asadmin,editor, orviewer(@demo.dev, passwordpassword). - RBAC (
@dashforge/rbac) — a/app/rbacexample plus role-gated actions across the app. - Forms (
@dashforge/forms) — a/app/formsexample with validation and dependent fields. - Users CRUD — list + create/edit/delete over a kit-style API layer
(
app/api:types+providerselecting live/mock viaVITE_PROVIDER+servicereturning aResult<T>+mock/+live/), so it runs with no backend and swaps to your real API by implementing thelive/files.
my-app/
react-router.config.ts # ssr: false + prerender (public pages)
vite.config.ts
tsconfig.json
app/
root.tsx # providers (auth, theme)
routes.ts # route table
routes/ # home, sign-in, dashboard, users, rbac, forms, settings
api/ # kit-style API layer (auth, users) — mock + live stubs
lib/ # auth, policy, useAsync, theme
components/ # StatCard, WorkspaceSwitcher, UserMenu, …
data/mock.ts # mock stats, activity, ordersCharts are intentionally left out — the two dashboard "chart" blocks are
example cards; drop in your own charting library where you see the
{/* Add your chart here */} marker.
Development (for this CLI)
npm install
npm run build # bundle src/ → dist/index.js (esbuild)
node dist/index.js /tmp/demo --lib tw --no-installLicense
MIT
