Getting Started #
This guide creates a small but complete KawaPress site. By the end, you will have Markdown pages, a default documentation interface, a local development server, and static files ready to deploy.
Prerequisites #
You need:
- Node.js 22.12 or later;
- npm, pnpm, or Yarn;
- an editor with Markdown support.
Create with the Scaffolder #
The fastest way to start is the create-kawapress scaffolder. It prepares the configuration file, a home page, and one example page in the directory you name, so the site runs right away.
npm create kawapress@latest my-kawapress-sitepnpm create kawapress my-kawapress-siteyarn create kawapress my-kawapress-siteWhile it runs, it asks for the site title, the default language, and whether to install dependencies. Add --yes to accept every default without any questions:
npm create kawapress@latest my-kawapress-site --yesThe other flags are --title, --lang, --second-lang, --pm, and --install / --no-install. Run the command with --help to see them all.
Once it finishes, enter the directory and start the development server:
cd my-kawapress-site
npm run devcd my-kawapress-site
pnpm run devcd my-kawapress-site
yarn devThe sections below build the same site by hand, starting from an empty directory. Follow them if you want to know what each file does, or if you are adding KawaPress to a project you already have.
Create a Project #
Create a directory and initialize its package.json:
mkdir my-kawapress-site
cd my-kawapress-site
npm init -ymkdir my-kawapress-site
cd my-kawapress-site
pnpm initmkdir my-kawapress-site
cd my-kawapress-site
yarn init -yKawaPress treats the current working directory as the site root. Site configuration, Markdown pages, and build output are all resolved from this directory.
Install KawaPress #
A site using the built-in nagi (凪) preset only needs KawaPress:
npm install --save-dev kawapresspnpm add --save-dev kawapressyarn add --dev kawapressKawaPress is only required while developing and building the site. The deployed output does not require a Node.js server.
Add Project Scripts #
Add these commands to the scripts field in package.json:
{
"scripts": {
"docs:dev": "kawapress dev",
"docs:build": "kawapress build",
"docs:preview": "kawapress preview"
}
}docs:devstarts the development server.docs:buildgenerates the static site.docs:previewserves the production build locally.
Configure the Site #
Create kawapress.config.ts in the project root:
import { nagi } from 'kawapress/nagi'
export default nagi({
title: 'My Docs',
})The nagi() preset installs the default documentation interface and its plugins. Its styles are included automatically, so the site does not need a separate theme CSS import.
Add Head Tags #
Use head to put tags into the <head> of every page. Analytics scripts, Open Graph cards for sharing, and site verification tags all go here:
import { nagi } from 'kawapress/nagi'
export default nagi({
head: [
['script', { src: 'https://example.com/analytics.js', defer: true }],
['meta', { property: 'og:image', content: 'https://example.com/social.png' }],
],
})Each entry is [tag, attributes, content?]. The tag name must be meta, link, script, style, or noscript. Attribute values are strings or true/false. The optional third element is the raw content inside the tag, which suits inline scripts and styles. KawaPress owns title and base, so they are not accepted here. Addresses are used as written, so include the site base yourself on internal paths.
Multi-language sites can give each language its own head. Tags with the same name or property follow the language setting:
import { nagi } from 'kawapress/nagi'
export default nagi({
locales: {
root: {
label: 'English',
lang: 'en',
head: [['meta', { property: 'og:locale', content: 'en_US' }]],
},
zh: {
label: '简体中文',
lang: 'zh-CN',
head: [['meta', { property: 'og:locale', content: 'zh_CN' }]],
},
},
})A single page can add tags of its own in frontmatter. See Frontmatter.
Use UnoCSS Utilities #
nagi enables UnoCSS with presetWind4, presetIcons, and presetWebFonts. Wind4 utilities work directly in Markdown HTML:
<div class="rounded-xl bg-indigo-500/8 px-4 py-3 text-sm">
UnoCSS generates this card's spacing, radius, and translucent background.
</div>The Wind4 global reset is disabled, so it does not overwrite nagi or other plugin foundations. The Icons and Web Fonts presets are ready, but they load assets only after you configure a specific icon collection or font.
Add Your First Pages #
Create index.md in the project root:
---
layout: home
title: My Docs
---
# My Docs
Welcome to my first KawaPress site.
[Start reading](/guide/hello)Then create guide/hello.md:
# Hello, KawaPress!
This is my first documentation page.The project should now contain:
my-kawapress-site/
├─ guide/
│ └─ hello.md
├─ index.md
├─ kawapress.config.ts
└─ package.jsonMarkdown file paths become public routes:
index.mdmaps to/.guide/hello.mdmaps to/guide/hello.
The home page explicitly selects layout: home. Other Markdown pages use the doc layout by default, which includes the Sidebar and page outline.
Start the Development Server #
Run:
npm run docs:devpnpm docs:devyarn docs:devThe site is now available at http://localhost:5173. Open it in a browser and follow the link from the home page to the guide.
Markdown changes are applied through HMR. Initial requests still run through real server-side rendering, so development and production builds share the same SSR semantics.
Build and Preview #
Generate the static site:
npm run docs:buildpnpm docs:buildyarn docs:buildKawaPress writes the deployable output to dist. Preview that output locally with:
npm run docs:previewpnpm docs:previewyarn docs:previewThe preview server runs at http://localhost:4173 by default. After checking the result, deploy the dist directory to any static hosting service.
You Are Ready #
You now have a complete KawaPress site that:
- uses Markdown for pages;
- uses nagi for its documentation interface;
- provides HMR and real SSR during development;
- builds static files that do not require a Node.js server.
You can keep adding Markdown pages or move on to routing, Markdown extensions, multilingual sites, plugins, and themes. Each of those features builds on the same project structure.


Comments