Quick Start

Create your first Linch Desktop app in 5 minutes

Prerequisites

Before getting started, ensure your development environment meets the following requirements:

Create a Project

Use the scaffolding tool to create a new project:

npx @linch-tech/create-desktop-app my-app

The CLI will prompt for the following information:

OptionDescriptionExample
Project nameDirectory name and package.json namemy-app
Display nameApp name shown in title barMy App
App identifierUnique app identifiercom.mycompany.myapp

Command Line Arguments

You can also skip interactive prompts using command line arguments:

npx @linch-tech/create-desktop-app my-app \
  -d "My App" \
  -i com.mycompany.myapp \
  -y

Arguments:

ArgumentDescription
-d, --display-nameDisplay name
-i, --identifierApp identifier
-t, --templateTemplate name (default: default)
-y, --yesSkip all prompts, use default values

Install Dependencies

cd my-app
pnpm install

First-time installation may take a few minutes to compile Rust dependencies.

Start Development Server

pnpm tauri:dev

This will:

  1. Start Vite dev server (frontend hot reload)
  2. Compile Rust code
  3. Open the desktop app window

First-time Rust compilation is slow, subsequent starts will be much faster.

Project Structure Preview

The created project structure looks like this:

my-app/
├── src/                    # Frontend source
│   ├── main.tsx           # React entry point
│   ├── App.tsx            # Routing and Provider setup
│   ├── config.ts          # Core configuration
│   └── pages/             # Page components
├── src-tauri/             # Tauri/Rust source
│   ├── src/
│   │   ├── lib.rs         # Rust entry point
│   │   └── main.rs
│   ├── Cargo.toml         # Rust dependencies
│   └── tauri.conf.json    # Tauri configuration
├── package.json
└── vite.config.ts

Configure Your App

Open src/config.ts, the core configuration file:

import { Home, Settings } from 'lucide-react';
import type { LinchDesktopConfig } from '@linch-tech/desktop-core';

export const config: Partial<LinchDesktopConfig> = {
  brand: {
    name: 'app.name',
    version: `v${__APP_VERSION__}`,
  },

  nav: [
    { title: 'app.home', path: '/', icon: Home },
    { title: 'settings.title', path: '/settings', icon: Settings },
  ],

  features: {
    updater: true,
    database: true,
    sentry: false,
  },

  i18n: {
    defaultLanguage: 'zh',
    supportedLanguages: ['zh', 'en'],
    resources: {
      en: {
        app: {
          name: 'My App',
          home: 'Home',
        },
      },
      zh: {
        app: {
          name: '我的应用',
          home: '首页',
        },
      },
    },
  },
};

Add a New Page

  1. Create a page component src/pages/About.tsx:
import { PageHeader } from '@linch-tech/desktop-core';

export function About() {
  return (
    <div className="p-6">
      <PageHeader title="About" />
      <p>This is the about page.</p>
    </div>
  );
}
  1. Add a route in src/App.tsx:
import { About } from './pages/About';

// Add to Routes
<Route path="/about" element={<About />} />
  1. Add a navigation item in src/config.ts:
import { Info } from 'lucide-react';

nav: [
  // ...other items
  { title: 'app.about', path: '/about', icon: Info },
],

Build the App

pnpm tauri:build

Build artifacts are located in src-tauri/target/release/bundle/:

PlatformArtifacts
Windows.msi, .exe
macOS.dmg, .app
Linux.deb, .AppImage

Next Steps