Getting Started
Welcome to the TechHub tech knowledge base! This guide will help you quickly understand the project structure, start the local development environment, and publish your first version of documentation.
Environment Requirements
- Node.js 18 or above
- Any package manager: npm / pnpm / yarn
Install Dependencies
bash
npm installStart the Development Server
bash
npm run docs:devAfter starting, visit http://localhost:5173. Editing any Markdown file will give you live hot-reload preview.
Directory Structure
.
├── docs/
│ ├── .vitepress/ # VitePress configuration and theme
│ │ ├── config.mjs # Global site configuration (nav/sidebar/search, etc.)
│ │ └── theme/ # Theme customization (styles, components)
│ ├── public/ # Static assets (images, favicon, etc.)
│ ├── index.md # Home page
│ ├── project/ # Documentation for this site itself
│ ├── frontend/ # Frontend technologies
│ ├── backend/ # Backend technologies
│ ├── languages/ # Programming languages
│ ├── ai/ # AI
│ ├── paths/ # Learning paths
│ ├── journals/ # Process journals (logs/pitfalls/retrospectives)
│ ├── books/ # Book notes
│ └── papers/ # Literature collection
├── scripts/ # Deploy/rollback/changelog scripts
├── package.json
└── README.mdAdd a New Document
- Create a
.mdfile in the corresponding directory, e.g.docs/guide/example.md; - Write the Frontmatter metadata at the top of the file:
md
---
title: 示例文档
description: 本文档用于演示基础用法。
---
# 示例文档
这里是正文内容。- Add the page to the sidebar (edit the
sidebarconfig indocs/.vitepress/config.mjs).
Build the Static Site
bash
npm run docs:buildThe build output goes to docs/.vitepress/dist, which can be hosted on any static server or CDN.
Preview the Build Locally
bash
npm run docs:previewNext Steps
- To learn how to write richer documentation content, read the Writing Guide.
- Ready to publish your docs online? Read Deployment.