Skip to content

About

cli to scaffolding dashforge react application

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

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 CRUD

Or fully interactive (it will ask for the directory and the library):

npx dashforge-cli

The key=value form works too:

npx dashforge-cli my-app lib=mui template=dashboard

Options

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 via dashforgePreset() and DashforgeTailwindProvider. Dark mode via toggleMode().
  • mui — @dashforge/ui (Material UI): AppShell + DashforgeThemeProvider, base @mui/material Card / 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 the build/client folder 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 as admin, editor, or viewer (@demo.dev, password password).
  • RBAC (@dashforge/rbac) — a /app/rbac example plus role-gated actions across the app.
  • Forms (@dashforge/forms) — a /app/forms example with validation and dependent fields.
  • Users CRUD — list + create/edit/delete over a kit-style API layer (app/api: types + provider selecting live/mock via VITE_PROVIDER + service returning a Result<T> + mock/ + live/), so it runs with no backend and swaps to your real API by implementing the live/ 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, orders

Charts 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-install

License

MIT

About

cli to scaffolding dashforge react application

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages