Skip to content

Latest commit

 

History

History
138 lines (125 loc) · 3.16 KB

File metadata and controls

138 lines (125 loc) · 3.16 KB
title Quickstart
```bash npx create-zenbu-app my-app ``` ```bash pnpx create-zenbu-app my-app ``` ```bash yarn dlx create-zenbu-app my-app ``` ```bash bunx create-zenbu-app my-app ``` This creates a new directory with everything you need to get started. ```bash cd my-app && pnpm install ``` ```bash cd my-app && npm install ``` ```bash cd my-app && yarn ``` ```bash cd my-app && bun install ``` ```bash pnpm run dev ``` ```bash npm run dev ``` ```bash yarn dev ``` ```bash bun run dev ``` Your app will open in a new window, and any changes you make will hot-reload.

Project structure

After scaffolding, your project looks like this:

my-app/
├── zenbu.config.ts       # The only required config file
├── package.json
├── vite.config.ts
├── tsconfig.json
└── src/
    ├── main/
    │   └── services/
    │       ├── init.ts   # Opens the main window on boot
    │       └── cwd.ts    # RPC service that returns process.cwd()
    └── renderer/
        ├── index.html
        ├── main.tsx
        └── App.tsx

The zenbu.config.ts file is the entry point. It tells Zenbu.js where everything in your project is.

import { defineConfig, definePlugin } from "@zenbujs/core/config"

export default defineConfig({
  uiEntrypoint: "./src/renderer",
  plugins: [
    definePlugin({
      name: "app",
      services: ["./src/main/services/*.ts"],
    }),
  ],
})

Add a schema: "./src/main/schema.ts" field to the plugin when you're ready to introduce a database. The top-level db field is optional and defaults to ./.zenbu/db.

Available scripts

Script What it does
pnpm run dev Run the app locally with hot reloading.
pnpm run link Regenerate types after changing your project structure.
pnpm run db:generate Create a migration after changing your database schema.
pnpm run build:source Stage the source tree for publishing.
pnpm run build:electron Produce a signed .app / installer.

Next steps

Learn the plugin model, state, and RPC.