This file provides guidance to Codex (https://Codex.com/code) when working with code in this repository.
Valaxy is a Next Generation Static Blog Framework built with Vue 3, Vite 8 (Rolldown), and pnpm workspaces. It's a monorepo containing the core framework, themes, addons, documentation, and demo sites.
Key Links:
- Documentation: https://valaxy.site
- Demo: https://yun.valaxy.site
# Install dependencies (MUST use pnpm due to workspaces)
pnpm i
# Build the core packages (required before first run)
pnpm run build
# Full development mode (builds CLI + runs demo)
pnpm dev
# Two-terminal development (recommended for better visibility):
# Terminal 1 - Watch core valaxy & valaxy-theme-yun packages
pnpm dev:lib
# Terminal 2 - Run demo site
pnpm demo
# or run docs
pnpm docs:dev# Build core packages (utils -> valaxy -> devtools)
pnpm run build
# Build all packages in workspace
pnpm run build:all
# Build specific package
pnpm run build:valaxy
pnpm run build:create-valaxy
pnpm run build:devtools
# Build demo site
pnpm run demo:build
# Build docs
pnpm run docs:build# Run unit tests with Vitest
pnpm test
# Run E2E tests with Playwright
pnpm e2e
# Run E2E with UI
pnpm e2e:ui
# View E2E test report
pnpm e2e:reportUnit tests are located in test/**/*.test.ts and use Vitest.
E2E tests are in e2e/ and use Playwright (tests docs site at localhost:4859).
# Lint JavaScript/TypeScript/Vue files
pnpm lint
# Lint and fix styles
pnpm stylelint
# Type check
pnpm typecheck# Clean build artifacts
pnpm clean
# Link valaxy CLI globally for local testing
pnpm link:dev
# Test the create-valaxy scaffolding
pnpm ci
# Run devtools development server
pnpm devtoolsvalaxy/
โโโ packages/
โ โโโ @valaxyjs/utils/ # Shared utilities
โ โโโ create-valaxy/ # CLI scaffolding tool (pnpm create valaxy)
โ โโโ devtools/ # Valaxy DevTools integration
โ โโโ valaxy/ # Core framework โญ
โ โโโ valaxy-theme-yun/ # Default Yun theme
โ โโโ valaxy-theme-press/ # Press theme (VitePress-like)
โ โโโ valaxy-addon-*/ # Addons (waline, algolia, lightgallery, etc.)
โโโ demo/ # Demo sites for testing
โ โโโ yun/ # Main demo using theme-yun
โ โโโ custom/ # Custom theme demo
โโโ docs/ # Documentation site (uses Valaxy itself)
โโโ e2e/ # Playwright E2E tests
โโโ test/ # Vitest unit testsThe core is split into Node (build-time) and Client (runtime):
Node Side (packages/valaxy/node/):
cli/- CLI commands (dev, build, new, clean, deploy, debug)config/- Configuration resolution (site.ts, valaxy.ts, theme.ts, addon.ts)plugins/- Vite plugin orchestrationpreset.ts- Main plugin compositionmarkdown/- Markdown-it processing pipelinevueRouter.ts- File-based routing via vue-router/vitevalaxy.ts- Virtual module generationunocss.ts- UnoCSS configuration
modules/- Built-in features (RSS, Fuse search)utils/- Helper functions
Client Side (packages/valaxy/client/):
main.ts- Entry pointapp/- Runtime data managementmodules/- Client-side modules (components, pinia, mermaid, etc.)setup/- Application setupcomposables/- Vue composablescomponents/- Core Vue componentslayouts/- Layout system
- CLI Entry (
bin/valaxy.mjs) โ resolves options from:site.config.ts- Site metadata (title, author, etc.)valaxy.config.ts- Framework config (theme, addons, features)- Theme's
valaxy.config.ts(if exists) - Addon configs
- Config Merging - Uses
defudeep merge: Default โ Theme โ Addons โ User (user wins) - Vite Server/Build - Created with merged plugins from all sources
Roots System: File resolution follows priority order:
roots = [clientRoot, themeRoot, ...addonRoots, userRoot]User content overrides theme overrides core.
Virtual Modules: Generated at build time via Vite plugins:
#valaxy/config- Resolved runtime configuration#valaxy/styles- Combined styles from all rootsvirtual:generated-layouts- Layout routesvirtual:valaxy-addons- Addon registration
Routing:
- File-based via
vue-router/vite .vueand.mdfiles inpages/directory- Frontmatter parsed from
.mdand merged into route meta - Layouts auto-assigned by path patterns
Markdown Processing:
Uses markdown-it with custom plugins:
- Extract frontmatter (gray-matter)
- Custom plugins (highlight, code blocks, containers, links)
- @mdit-vue plugins (headers, toc, title, sfc)
- Third-party (attrs, emoji, footnote, katex, task-lists)
- Output cached for route generation
SSG (Static Site Generation):
- Single built-in Valaxy SSG engine (Vue SSR + pure string rendering, no JSDOM). The legacy JSDOM-based
vite-ssgengine was removed in v1.0 (broken under pnpm, see #706); there is no--ssg-engineflag. - Flash-of-unstyled-content handled by the FOUC guard (not Critical CSS inlining)
- Filters draft posts in production
- Supports pagination
- Generates sitemap and redirects
- Minimum heap: ~4 GB (
--max-old-space-size=4096). Vite 8 (Rolldown) uses more memory during chunk generation; the SSG engine auto-respawns with sufficient heap.
Themes are self-contained npm packages that extend Valaxy.
Theme Structure:
valaxy-theme-{name}/
โโโ client/ # Client-side code
โโโ node/ # Node-side config
โโโ components/ # Vue components (auto-imported)
โโโ layouts/ # Vue layouts
โโโ styles/ # Theme styles
โโโ locales/ # i18n files
โโโ App.vue # Theme app entry
โโโ valaxy.config.ts # Theme config (defineTheme)
โโโ index.ts # Package exportsThemes can:
- Export
viteconfig extensions - Export
unocsssafelists/presets - Define
themeConfigschema - Override any core components/layouts
Reference: valaxy-theme-starter
Addons are pluggable packages for additional features.
Addon Structure:
valaxy-addon-{name}/
โโโ client/ # Vue components/stores
โโโ node/ # Node-side setup
โโโ components/ # Vue components (auto-imported)
โโโ valaxy.config.ts # defineAddon export
โโโ index.ts # Package entryAddons can:
- Provide auto-imported Vue components
- Extend Vite config
- Hook into lifecycle events
- Register CLI commands
MUST use pnpm - the project uses pnpm workspaces. npm and yarn will not work correctly.
Core packages must be built before running demos:
pnpm run build # Builds in order: utils โ valaxy โ devtoolsWhen displaying repository URLs from package.json, always import and use the normalizeRepositoryUrl() helper from @valaxyjs/utils to remove the "git+" prefix:
import { normalizeRepositoryUrl } from '@valaxyjs/utils'
const repoUrl = normalizeRepositoryUrl(pkg.repository.url)This prevents browser errors with git+https://... URLs.
The dev server supports hot reload for:
- Config files (
valaxy.config.ts,site.config.ts) - Markdown files
- Vue components
- Styles
Requires Node.js 18+ or 20+
- Unit tests: Test utilities, markdown processing, config resolution
- E2E tests: Test the built docs site and demo in real browsers
- Tests run in CI via GitHub Actions
The project supports:
- Netlify (via
netlify.toml) - GitHub Pages (via
.github/workflows/gh-pages.yml) - Other static hosts (build output in
dist/)
pnpm release # Uses bumpp to version and releaseReleases are automated via .github/workflows/release.yml