Build Tools
This project uses a combination of tools to build the static site and manage dependencies. Understanding them is key to customizing the project and contributing effectively.
Core Build Tools
| Tool | Configuration | Purpose |
|---|---|---|
| Bun | bun.lockb, package.json | The primary runtime, package manager, and script executor. Used for installing dependencies and running all build scripts. |
| TypeScript | tsconfig.json | Compiles TypeScript source code in quartz/ and scripts/ directories. Configured for ESNext and strict mode. |
| Quartz | quartz.config.ts, quartz.layout.ts | The static site generator that transforms Markdown content into a searchable, interactive website. |
Common Build Commands
Here are the most common commands you’ll use during development:
Development
npm run docsorbun run docs: Starts the Quartz development server with hot-reloading athttp://localhost:8080. This is the primary command for writing content.bun install: Installs all necessary dependencies defined inpackage.json.
Building
npm run buildorbun run build: Performs a production build of the site, outputting to thepublic/directory.npm run build:strict: Validates all links before building. Used in CI/CD pipelines to ensure quality.npm run compact-report: Builds the site and generates a compact knowledge graph report for AI analysis.
Validation
bun run scripts/validate-content.ts: Validates all markdown files for proper frontmatter and formatting.bun run scripts/validate-links.ts: Checks all internal links for broken references.npm run check-links: Pre-build link validation (called bybuild:strict).
Build Process Overview
1. Content Discovery
Quartz scans the content/ directory for all Markdown files, respecting the ignore patterns defined in quartz.config.ts.
2. Transformation Pipeline
Content passes through a series of transformers:
- FrontMatter: Extracts YAML metadata
- ObsidianFlavoredMarkdown: Processes wiki-style
[[links]] - GitHubFlavoredMarkdown: Handles tables, task lists, and strikethrough
- SyntaxHighlighting: Applies GitHub-themed code highlighting
- CrawlLinks: Builds the content graph for navigation
3. Output Generation
Emitters create the final static files:
- ContentPage: Individual HTML pages for each Markdown file
- ContentIndex: Generates
contentIndex.jsonfor search and graph visualization - TagPage: Creates tag-based navigation pages
- FolderPage: Builds directory listing pages
4. Static Assets
The build process also:
- Bundles CSS and JavaScript
- Optimizes images and fonts
- Generates social media preview cards
- Creates the interactive graph visualization
Quartz Configuration
Site Configuration (quartz.config.ts)
configuration: {
pageTitle: "Claude Code Research",
enableSPA: true, // Single Page App navigation
enablePopovers: true, // Preview on hover
baseUrl: "script-kit.github.io/claude-research",
ignorePatterns: ["private", "templates", ".obsidian"],
defaultDateType: "modified", // Shows last update date
}Build Output
After building, find:
public/: Complete static site ready for deploymentpublic/static/contentIndex.json: Content graph and metadatapublic/index.html: Entry pointpublic/static/: Bundled assets (CSS, JS, fonts)
Development Workflow
1. Local Development
# Start development server
npm run docs
# In another terminal, run validation
bun run scripts/validate-content.ts2. Testing Changes
# Build locally to test
npm run build
# Serve the built site
npx serve public3. Pre-Push Validation
The project includes git hooks that automatically validate content before pushing:
- Checks frontmatter requirements
- Validates link integrity
- Ensures proper formatting
To set up hooks:
bun run scripts/setup-validation.tsCI/CD Pipeline
GitHub Actions automatically builds and deploys the site:
- Trigger: Push to main branch
- Environment: Node.js 22 with Bun
- Build:
npx quartz build - Deploy: Publishes to GitHub Pages
See .github/workflows/deploy.yml for the complete pipeline.
Troubleshooting Build Issues
Common Issues
Build fails with “Module not found”
# Clear cache and reinstall
rm -rf node_modules bun.lockb
bun installLinks validation errors
# Run link checker to see details
bun run scripts/validate-links.tsFrontmatter validation failures
# Check specific file
bun run scripts/validate-content.ts | grep "filename.md"Build Performance
To optimize build times:
- Use
npm run docsfor development (incremental builds) - Exclude large directories in
.gitignore - Run
build:strictonly in CI/CD - Use the compact report for quick overview
Advanced Topics
- Creating Custom Quartz Plugins
- Build Optimization Techniques
- Knowledge Base Architecture
- Deployment Guide