Murasaki

Project structure

What lives where in a Murasaki app.

A scaffolded app looks like a Next.js project. You only touch src/ and murasaki.config.ts — Murasaki owns the app shell and the client bootstrap, so there's no index.html or entry file to maintain.

my-app/
├─ src/
│  ├─ app/                    # pages, layouts, globals.css (file-based routing)
│  │  ├─ layout.tsx           # root layout — wraps children in <App>
│  │  ├─ page.tsx             # "/" route
│  │  └─ about/page.tsx       # "/about" route
│  ├─ api/                    # API route handlers -> /api/*
│  │  ├─ hello/route.ts       # GET/POST handlers
│  │  └─ greet/[name]/route.ts # dynamic segment -> /api/greet/:name
│  ├─ main.ts                 # long-lived Node lifecycle (optional)
│  ├─ backend/                # common home for 'use main' modules (optional)
│  ├─ middleware.ts           # runs before every navigation (optional)
│  ├─ lib/                    # your app code (stores, context-menu actions, helpers)
│  └─ assets/                 # images, icons
├─ murasaki.config.ts         # app identity, window, signing
├─ tailwind.config.ts
├─ vite.config.ts             # wires up the murasaki Vite plugin
└─ package.json

There's no src/actions.ts in the scaffold itself, but it's the common spot for 'use server' functions — see Server Actions. A 'use server' file can live anywhere under src/; it isn't tied to src/app/ or src/api/.

src/app/ — routes

File-based routing over src/app/**/page.tsx, with layout.tsx, dynamic [param] segments, and loading / error / not-found boundaries. Your root layout wraps everything in <App>. See Routing.

src/api/ — API routes

src/api/<path>/route.ts exports one function per HTTP method and is served at /api/<path>. These run on the server (Node) in both dev and prod. See API Routes.

Server actions

Unlike src/app/ and src/api/, there's no dedicated folder — a 'use server' function runs on the server and is called from the client with useAction, wherever you put the file. See Server Actions.

Node Main and 'use main'

src/main.ts owns long-lived Node resources and graceful shutdown. A module with a top-level 'use main' directive exposes typed renderer-to-Node functions and can live anywhere under src/; src/backend/ is only a useful convention. See Node Main.

murasaki.config.ts

Your app's identity, window, and build settings:

murasaki.config.ts
import { defineConfig } from 'murasaki'

export default defineConfig({
  appId: 'com.example.my-app',
  productName: 'My App',
  version: '0.1.0',
  icon: 'src/assets/icon.png',
  window: { width: 1000, height: 700 },
})

See Configuration for every field.

Next

Improve this page on GitHub

On this page