AIGCS

Architecture

AIGCS system architecture overview

Overview

The current version of AIGCS (V1) is defined as a highly cohesive, standard Node.js Monorepo. It focuses primarily on stability within traditional server environments and local SQLite file databases. Although the structure reserves deployment compatibility for Edge Functions (e.g., Tencent Cloud EdgeOne) in the packages/edgeone directory for future development, a comprehensive cloud-native (Serverless/Distributed) refactoring has been deferred to the next major phase. Our current philosophy is "treating the present as a stable V1."

AIGCS is a monorepo containing five core packages under packages/ and plugins under packages/plugins/:

packages/
├── core/         Shared types, Drizzle ORM schema, constants
├── server/       Hono HTTP API server, middleware, notification service
├── admin/        Modern React SPA admin panel built with TanStack Router + React Query
├── widget/       Web Component for displaying comments (framework-agnostic Shadow DOM)
└── edgeone/      Reserved build scripts for future cloud-native Edge Functions
packages/plugins/
├── native/       Visitor comments plugin
└── mastodon/     Fediverse/ActivityPub integration

Data Flow

User Browser                    AIGCS Server                    AI Provider
     │                              │                              │
     │  ── Widget loads ────────►   │                              │
     │  ◄── comments JSON ────────  │                              │
     │                              │                              │
     │  ── fetch page content ──►   │                              │
     │                              │  ── generate prompt ──────►  │
     │                              │  ◄── AI response ──────────  │
     │  ◄── AI comment stored ────  │                              │

Request Lifecycle

  1. Widget loads via <script> on the user's website
  2. Widget fetches comments from the Server API
  3. Server checks the page cache:
    • Cached: returns existing AI comments immediately
    • Not cached: fetches page content → sends to AI provider → generates comment → caches
  4. Comments are displayed in the Widget (CDN-cached with ETag)

Plugin System

Plugins hook into the server lifecycle via a hook system:

beforeGenerate → generate → afterGenerate → beforeRender → afterRender

Each hook receives a context object (PluginHookContext) with access to request data, comments, and server configuration.

On this page