Skip to content

Installation

Dashild is an admin layer for Next.js + Prisma. A resource is a data file; there are no pages to generate or files to keep in sync.

  • Node.js 22 or newer.
  • Next.js 15 or 16 with the App Router.
  • Prisma 7.10 or newer and a client generated with the prisma-client provider.
  • PostgreSQL, MySQL, or SQLite. PostgreSQL, SQLite, and MySQL 8.4 run end-to-end in CI; MariaDB uses the same adapter as MySQL but is not in the CI matrix.
  • Tailwind CSS v4 and shadcn/ui for the shell.

These are documented ranges, not runtime checks: the CLI does not verify the Next.js or Prisma version of your project.

Terminal window
pnpm create dashild@latest my-app

The scaffolder runs create-next-app non-interactively (--yes --empty) and then asks its own questions: starter, auth, database, and whether to install, migrate, and seed. It also works with flags:

pnpm create downloads and runs the project generator without installing it as a permanent dependency in your current project. my-app is the new directory name. The example below selects a starter and PostgreSQL, supplies the database URL, chooses pnpm, and accepts defaults so the command can run without prompts.

Terminal window
npx create-dashild@latest my-app \
--template demo \
--database postgresql \
--database-url "$DATABASE_URL" \
--pm pnpm \
--yes
Flag Values
--template basic, demo, local:<path>, github:<owner>/<repo>#<ref>
--auth better-auth, none
--database postgresql, mysql, sqlite
--database-url Connection string
--direct-url Non-pooled URL for migrations
--pm pnpm, npm, yarn, bun
--name Project name when you omit the positional argument
--dir Target directory (defaults to the project name)
--path Panel route (defaults to /admin)
--locale en or es, for prompts and generated labels
--tenancy Organizations, tenant session, and switcher (Better Auth)
--no-install Skip dependency installation
--no-git Skip git init
--no-migrate Do not apply the schema
--no-seed Do not load starter data
-y, --yes Accept the defaults without prompting
--dry-run Print the plan without writing
--list-templates List bundled starters

--dry-run still resolves a github: starter, which means downloading and caching it in ~/.cache/dashild/templates.

If the database is unreachable, the app is still created and the migration and seed commands are printed as pending steps. See Templates for the starter format.

Terminal window
pnpm add @dashild/core@alpha @dashild/admin@alpha @dashild/prisma@alpha
pnpm add -D @dashild/cli@alpha

Add the two Prisma generators:

generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
generator dashild {
provider = "dashild-prisma-generator"
output = "../src/generated/dashild"
}

The dashild generator writes dashild-metadata.json, the contract used by the CLI, the runtime, and the panel. The CLI and the panel only read it.

Prisma 7 reads the connection from prisma.config.ts:

import "dotenv/config";
import { defineConfig, env } from "prisma/config";
export default defineConfig({
schema: "prisma/schema.prisma",
datasource: {
// DIRECT_URL wins when set: use it for migrations behind a pooler.
url: process.env.DIRECT_URL || env("DATABASE_URL"),
},
});

The app also needs a Prisma client with a driver adapter:

import { PrismaPg } from "@prisma/adapter-pg";
import { PrismaClient } from "@/src/generated/prisma/client";
export const prisma = new PrismaClient({
adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL }),
});

For SQLite use @prisma/adapter-better-sqlite3 and better-sqlite3; for MySQL/MariaDB, @prisma/adapter-mariadb. The scaffolder picks the right one.

Dashild does not start a database. Point DATABASE_URL at a running instance:

Terminal window
# SQLite
DATABASE_URL="file:./prisma/dev.db"
# PostgreSQL
DATABASE_URL="postgresql://user:password@host:5432/database"
# MySQL
DATABASE_URL="mysql://user:password@host:3306/database"

For SQLite, the generated prisma.config.ts and the adapter resolve the path from the project root, and the scaffolder verifies the file exists after migrating. The scaffolder installs better-sqlite3 with the Node that runs the app (pinning PATH and npm_config_target) because pnpm does not ship node-gyp.

dashild init reads dashild-metadata.json, so generate the Prisma client and the metadata first. prisma generate runs both configured Prisma generators: the client generator makes the typed database API, and the Dashild generator makes metadata used to build the admin UI.

Terminal window
pnpm prisma generate
pnpm dashild init --auth better-auth

dashild init plans the panel files and auth integration. It prints the plan first; without --yes it does not apply it. Review that plan before accepting it:

Terminal window
pnpm dashild init --auth better-auth --yes

If the metadata is not in one of the standard paths, pass it explicitly with --metadata prisma/generated/dashild/dashild-metadata.json.

It writes:

src/dashild/panel.ts
src/dashild/policies.ts
src/dashild/actions/index.ts
src/dashild/icons.tsx
src/dashild/runtime.ts
src/dashild/server.ts
src/dashild/registry.tsx
src/app/<route>/[[...dashild]]/page.tsx

With --auth better-auth it also writes login, signup, session, password reset, and API route files, and appends the Better Auth models to the schema. See Authentication.

Then regenerate because init --auth better-auth may have changed the Prisma schema. db push synchronizes that schema with the configured database without creating a versioned migration. For a team or production workflow, use Prisma migrations instead:

Terminal window
pnpm prisma generate
pnpm prisma db push

init appends missing keys to .env.example; it never writes .env.

If app/admin/page.tsx already exists, init proposes /panel, /admin-panel, or /dashild. Use --path /other-route to force one. --force overwrites the generated files (including the auth ones) but does not bypass a route conflict caused by an explicit --path; pick another route instead.

The shell lives in @dashild/admin; Tailwind must scan its build. Add this to your global CSS (adjust the relative path):

@source "../../node_modules/@dashild/admin/dist";

You also need the shadcn theme variables (--background, --foreground, --primary, --sidebar, etc.). The scaffolder writes a complete globals.css; for a manual install, start from apps/playground/app/globals.css in the repository. Define a real font stack in --font-sans; a self-referencing variable leaves the app in Times New Roman.

Terminal window
pnpm dashild make:resource Customer
pnpm dashild doctor

The first command takes a Prisma model name and creates a resource definition: the panel’s instructions for displaying and editing that model. It registers the new file in panel.ts and adds a fail-closed policy entry. It never overwrites an existing resource file. The second command checks that resources, metadata, policies, and action handlers are wired consistently; it does not repair problems automatically.

The policy entry starts as scope: () => null, so the resource returns 404 until you define its scope and permissions. See Policies and security and Resources.

Terminal window
pnpm dev

pnpm dev runs the development server defined by your app’s package.json. The panel is at http://localhost:3000/admin (or the route you chose). In development use localhost, not 127.0.0.1: Next 16 blocks assets and hydration from unlisted origins. The scaffold adds allowedDevOrigins: ["127.0.0.1", "localhost"]; add any other domain you use.