Skip to content

Installation

Quick Start with create-kimesh

The easiest way to start a new Kimesh project is using create-kimesh:

bash
# Interactive mode (recommended)
bun create kimesh

# With project name
bun create kimesh my-app

# Non-interactive with all options
bun create kimesh my-app --template minimal --modules tailwindcss,pinia --pm bun --install --git

Alternative package managers:

bash
# npm
npx create-kimesh@latest

# pnpm
pnpm create kimesh

# yarn
yarn create kimesh

create-kimesh Options

ArgumentAliasDescriptionDefault
[dir]-Project directory namePrompted
--template-tTemplate to useminimal
--modules-mComma-separated modules to installPrompted
--pm-Package manager (npm, yarn, pnpm, bun)Auto-detected
--install-iInstall dependencies after scaffoldingPrompted
--git-gInitialize git repositoryPrompted
--force-fOverride existing directoryfalse

Available Modules

When scaffolding, you can select from these modules:

ModuleDescriptionAuto-Dependencies
tailwindcssUtility-first CSS framework-
shadcnRe-usable components built with Radix Vuetailwindcss
piniaIntuitive store for Vue.js-

Manual Setup

If you prefer to add Kimesh to an existing project:

1. Install Dependencies

bash
# Using bun (recommended)
bun add kimesh

# Using pnpm
pnpm add kimesh

# Using npm
npm install kimesh

The kimesh package includes all core sub-packages:

  • @kimesh/kit — Build-time engine
  • @kimesh/cli — CLI commands
  • @kimesh/router-runtime — Runtime router
  • @kimesh/router-generator — Route code generation
  • @kimesh/query — Data fetching
  • @kimesh/head — Head management

2. Create kimesh.config.ts

ts
// kimesh.config.ts
import { defineKmConfig } from 'kimesh/kit'

export default defineKmConfig({
  name: 'my-app',
  dev: {
    port: 3000,
  },
})

3. Create Routes Directory

Create src/routes/ with your route files:

src/routes/
├── __root.vue    # Root layout (wraps all routes)
├── index.vue     # Home page (/)
└── about.vue     # About page (/about)

4. Root Layout

src/routes/__root.vue — The root layout wraps all routes:

vue
<template>
  <div id="app">
    <nav>
      <!-- KmLink is auto-imported -->
      <KmLink to="/">Home</KmLink>
      <KmLink to="/about">About</KmLink>
    </nav>
    <main>
      <RouterView />
    </main>
  </div>
</template>

Note: KmLink and RouterView are auto-imported — no explicit import statement needed.

5. Page Components

src/routes/index.vue — Home page:

vue
<template>
  <h1>Welcome to Kimesh</h1>
  <p>Type-safe file-based routing for Vue.</p>
</template>

src/routes/about.vue — About page:

vue
<template>
  <h1>About</h1>
  <p>Learn more about our application.</p>
</template>

6. Configure package.json

json
{
  "scripts": {
    "prepare": "km prepare",
    "postinstall": "km prepare",
    "dev": "km dev",
    "build": "km build"
  }
}

7. Configure TypeScript

json
{
  "extends": "./.kimesh/tsconfig.json",
  "compilerOptions": {
    "strict": true
  }
}

8. Run Development Server

bash
bun dev

Kimesh will automatically:

  • Scan your src/routes directory
  • Generate routes in .kimesh/routes.gen.ts
  • Generate types in .kimesh/typed-routes.d.ts
  • Auto-import Vue, Vue Router, and Kimesh APIs
  • Hot-reload when files change

Auto-Imports

Kimesh auto-imports commonly used APIs so you don't need explicit import statements:

Vue APIsref, reactive, computed, watch, onMounted, etc.

Vue RouteruseRoute, useRouter, onBeforeRouteLeave, etc.

Kimesh APIscreateFileRoute, defineRoute, useNavigate, useSearch, useParams, KmOutlet, KmLink, KmDeferred, defineKimeshMiddleware, navigateTo, abortNavigation, etc.

Your own composables from composables/ and utilities from utils/ directories are also auto-imported.

Project Structure

A typical Kimesh project:

my-app/
├── src/
│   ├── routes/
│   │   ├── __root.vue        # Root layout
│   │   ├── index.vue         # /
│   │   ├── about.vue         # /about
│   │   ├── posts.vue         # Layout for /posts/*
│   │   └── posts/
│   │       ├── index.vue     # /posts
│   │       ├── $postId.vue   # /posts/:postId
│   │       └── -posts.data.ts # Query definitions (excluded from routing)
│   ├── components/           # Auto-imported components
│   ├── composables/          # Auto-imported composables
│   └── middleware/            # Route middleware
├── .kimesh/                   # Generated files (gitignored)
│   ├── routes.gen.ts
│   ├── tsconfig.json
│   └── auto-imports.d.ts
├── kimesh.config.ts
├── tsconfig.json
└── package.json

Next Steps

Released under the MIT License.