Skip to content
星罗
Search
Switch language
Go back

Getting Started

1 min read Edit on GitHub

This guide helps you bootstrap Xingluo for local development and production builds from scratch.

Requirements

DependencyMinimum versionNotes
Node.js22.12.0See engines.node in package.json
pnpm10.xPackage manager (the project uses pnpm workspace)

Tip: manage Node versions with fnm or nvm.

Installation

After cloning the repository, install dependencies:

bash
pnpm install

Once dependencies are installed, the reference projects under references/ are automatically excluded from TypeScript compilation and builds (see exclude in tsconfig.json).

Local Development

Start the dev server (defaults to http://localhost:4321/):

bash
pnpm dev

In development mode:

  • Drafts and scheduled posts are all visible (for preview); they are filtered only during production builds
  • Content collection changes trigger hot reload
  • Client-side behaviors (theme toggle, View Transitions, etc.) match production

Type Sync

After modifying content collection schemas or types, run sync to refresh .astro/types.d.ts:

bash
pnpm sync

Build

The production build has three steps (see the build script in package.json):

bash
pnpm build
  1. astro check: TypeScript and Astro template type checking; any error aborts the build
  2. astro build: statically generates the whole site to dist/ (including dynamic OG images, RSS, sitemap, robots.txt)
  3. node scripts/generateSearchIndex.mjs: scans dist/ to generate the full-text search index into dist/search/

Note: The search index is generated by a Node script after the build completes.

Preview the Build

Preview the build output in dist/ locally:

bash
pnpm preview

Code Quality

CommandPurpose
pnpm formatFormat all code with Prettier (including Astro and Tailwind)
pnpm format:checkCheck formatting compliance (used in CI)
pnpm lintESLint checks (including eslint-plugin-astro)

Next Steps


Related posts

  • Deployment

    2 min read

    Xingluo deployment guide covering static hosting platforms (Netlify/Vercel/GitHub Pages), Nginx self-hosting, Docker, and environment variables.

  • Search

    1 min read

    Xingluo search guide covering Flexsearch full-text search integration, index generation, UI, multilingual search, and performance.