Skip to content

Conversation

Copy link

Copilot AI commented Oct 16, 2025

Overview

This PR addresses the issue "总结一下项目架构" (Summarize the project architecture) by adding detailed bilingual documentation explaining the zdocs project's architecture, components, and design decisions.

What's Added

ARCHITECTURE.md

A comprehensive architecture document covering:

  • Project Overview: Explains zdocs as a documentation tool for Zig modules, similar to Zig's standard library documentation but supporting all Zig modules
  • Three-Tier Architecture Design:
    • CLI/HTTP Server Layer (src/main.zig): Command-line interface, HTTP server, static file serving, and source code archival
    • WebAssembly Processing Layer (src/wasm/): AST parsing (Walk.zig), declaration management (Decl.zig), HTML rendering (html_render.zig), and Markdown processing (markdown.zig)
    • Web Frontend Layer (www/): TypeScript/Bun-based web server, WASM interface, and browser-side documentation UI
  • Data Flow Diagram: Visual representation showing how user requests flow through the system
  • Build System: Documentation of build targets, WASM compilation, and the dual-mode approach (embedded vs. standalone)
  • Deployment Modes: Embedded mode (single binary), development mode (hot reload), and standalone web server
  • Key Features: Module support, source code browsing, search functionality, and documentation comment parsing
  • Complete Directory Structure: Detailed breakdown of the project organization
  • Dependencies: Zig 0.14.x, Bun 1.2.18+, TypeScript
  • Extension Points: Guidelines for adding new documentation formats, Zig language features, and UI customizations
  • Performance Considerations: WASM performance, incremental parsing, caching, and multi-threading
  • Development Workflow: Commands and best practices for contributing

README.md Updates

Added a new "documentation" section that links to the architecture documentation, making it easily discoverable for new contributors and users who want to understand the project structure.

Benefits

  • Bilingual Support: Documentation in both Chinese and English serves the international developer community
  • Comprehensive Coverage: 13 major sections covering all architectural aspects
  • Practical Information: Includes actual build commands, development workflows, and code examples
  • Clear Component Separation: Explains how the three layers interact and their individual responsibilities
  • Onboarding: Significantly reduces the learning curve for new contributors

Documentation Highlights

The architecture follows a clean separation of concerns:

  1. The CLI/Server handles user interaction and serves static assets
  2. The WASM layer performs heavy lifting: parsing Zig source code, analyzing ASTs, and generating documentation HTML
  3. The Web frontend provides both a development server (with multiple package support) and an embedded browser UI

This design enables zdocs to be distributed as a single binary while also supporting a more flexible web-based deployment for serving documentation of multiple Zig packages simultaneously.

Original prompt

总结一下项目架构


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits October 16, 2025 05:40
Co-authored-by: kindy <50860+kindy@users.noreply.github.com>
Co-authored-by: kindy <50860+kindy@users.noreply.github.com>
Copilot AI changed the title [WIP] Summarize project architecture overview Add comprehensive project architecture documentation Oct 16, 2025
Copilot AI requested a review from kindy October 16, 2025 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants