docs: improve and restructure shumai documentation

This commit is contained in:
yiling
2026-06-16 12:15:53 +08:00
parent 7e5735f0cc
commit fc6ad20329
20 changed files with 977 additions and 4 deletions
+67
View File
@@ -0,0 +1,67 @@
---
title: Overview
description: Learn about Shumai, a modern AI agent and media processing platform for creative work.
---
## What is Shumai?
**Shumai** is a highly modular, self-hosted media collaboration platform and AI agent playground. It allows teams to securely store, organize, and review creative assets (video, audio, images, etc.) while leveraging advanced AI capabilities to automate metadata tagging, perform semantic visual searches, and run sandboxed automation scripts.
![Shumai Overview Placeholder](https://placehold.co/800x450/2C2E3E/D95A66?text=Shumai+Dashboard+Overview)
_Placeholder: Dashboard view showing the file explorer, active projects, and sidebar options._
---
## High-Level Features
- **S3-Compatible & Local FS Storage**: Flexibly store creative assets locally or connect directly to standard S3-compatible providers (AWS S3, Cloudflare R2, MinIO, etc.).
- **Media Commenting & Drawing**: Leave frame-level and timestamped feedback with sketch overlays on image and video assets.
- **Version Stacking**: Version control for assets by stacking multiple file revisions together.
- **AI-Powered Metadata & Search**: Automatically analyze files using Gemini to populate metadata fields, and search them visually or semantically via vector databases.
- **Custom Agent Skills**: Write scripts to automate repetitive workflow actions inside secure sandboxed environments.
- **Production-Ready Media Transcoding**: Offload heavy media processing workloads using distributed workers.
---
## Architectural Layout
Shumai is developed as a modern, strictly decoupled monorepo managed with **Bun Workspaces**. Its architecture ensures clear separations of concerns across the following layers:
```mermaid
graph TD
WebUI[WebUI: packages/webui - React & Tailwind] --> API[API Layer: packages/api - Hono]
API --> Core[Core Service Layer: packages/core - Business Logic]
Core --> DB[Database Layer: packages/db - Prisma]
Core --> DTOs[DTO Layer: packages/dtos - Shared Schemas]
Core --> Workers[Workers: Agent/Transcode Workflows]
```
### The Monorepo Packages
1. **WebUI (`packages/webui`)**: The user interface. Built on React and styled with Tailwind CSS and Shadcn UI.
2. **API (`packages/api`)**: The HTTP server. Built on Hono and Bun. Acts as the entrypoint for all frontend requests.
3. **Core (`packages/core`)**: The business logic and services layer. Interacts with the database, S3 storage, and external providers.
4. **Database (`packages/db`)**: Holds the database schema, Prisma client generation, and migrations (using PostgreSQL with `pgvector`).
5. **DTOs (`packages/dtos`)**: Shared data transfer object definitions and Zod schemas, guaranteeing end-to-end type safety between the frontend and backend.
6. **Workers**: Specialized packages for running background operations:
- `@shumai/workflow-core`: Common workflow engine logic.
- `@shumai/agent`: AI agent workflows and activities.
- `@shumai/transcode`: Media processing workflows and activities.
---
## Dual Workflow Engines
To cater to different environments, Shumai implements a custom background execution layer that supports two modes:
### 1. Local Executor (Default)
In local development or lightweight self-hosted setups, Shumai uses a polling-based engine. It continuously polls the database for pending background tasks (such as metadata autofill, embedding generation, or transcoding) and executes them directly on the main application container.
### 2. Temporal Executor (Production-Ready)
For heavy production workflows, Shumai decouples background task execution entirely using **Temporal**.
- **Orchestration**: The main Hono application registers tasks to the Temporal Cluster.
- **Specialized Workers**: Separate worker machines run `@shumai/transcode` and `@shumai/agent` processes. They poll tasks from the Temporal queue and execute them independently.
- **S3 Requirement**: In Temporal mode, **you must use an S3-compatible storage backend**. Because workers run on separate machines, they cannot access a local filesystem to retrieve or write files.
+107
View File
@@ -0,0 +1,107 @@
---
title: Quickstart
description: Get Shumai up and running in minutes using Docker, NPM, or from source.
---
We support three installation paths depending on your needs. For most users, **Docker Compose** is the fastest and easiest way to run Shumai.
---
## Option 1: Docker Compose (Recommended)
Docker Compose configures and runs all required services (web application, PostgreSQL with pgvector, and S3 local storage) automatically.
### Local Stack
A lightweight setup to run the core API and frontend using pre-built images.
1. Download the docker-compose configuration:
```bash
curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/docker-compose.yaml
```
2. Spin up the containers:
```bash
docker compose up -d
```
3. Open your browser and navigate to **`http://localhost:3000`** to access the Shumai Web UI.
### Temporal Stack (Production-Ready / Development)
For details on running the full Temporal worker orchestration stack, refer to the [Docker Setup Guide](/getting-started/docker).
---
## Option 2: Install from NPM
You can run Shumai as a global npm package. This requires installing the system-level dependencies manually.
### Prerequisites
1. **FFmpeg & FFprobe**: Required for media transcoding and metadata extraction.
- **macOS**: `brew install ffmpeg`
- **Linux**: `sudo apt-get install ffmpeg`
2. **Sandbox Executable Dependencies**: Shumai runs AI agents inside secure, isolated sandboxes.
- **macOS**: Requires `ripgrep` (`brew install ripgrep`).
- **Linux**: Requires `bubblewrap`, `socat`, and `ripgrep` (`sudo apt-get install bubblewrap socat ripgrep`). On Ubuntu 24.04+, run:
```bash
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
```
### Step-by-Step NPM Setup
1. **Start PostgreSQL with pgvector**:
```bash
docker run --name shumai_postgres \
-e POSTGRES_USER=shumai \
-e POSTGRES_PASSWORD=shumai_password \
-e POSTGRES_DB=shumai_db \
-p 5432:5432 \
-d pgvector/pgvector:pg18
```
2. **Install Shumai globally**:
```bash
npm install -g @shumai-one/shumai
```
3. **Configure Environment Variables**:
Create a new directory and save a `.env` file inside it:
```bash
mkdir shumai && cd shumai
```
Create `.env`:
```env
DATABASE_URL=postgresql://shumai:shumai_password@localhost:5432/shumai_db?schema=public
BETTER_AUTH_SECRET=your-random-32-byte-secret-key
STORAGE_BACKEND=local
AWS_ENDPOINT_URL_S3=http://localhost:3000
```
4. **Run the application**:
```bash
shumai
```
Access the UI at `http://localhost:3000`.
---
## Option 3: Run from Source (For Developers)
Follow these steps to run Shumai locally for development:
1. **Clone the Repository & Install Dependencies**:
```bash
git clone https://github.com/shumaiOne/shumai.git
cd shumai
bun install
```
2. **Start the Database**:
Spin up a `pgvector` container as shown in the NPM option above.
3. **Prepare Environment Variables**:
Copy the environment variables template or create a `.env` file at the root of the workspace.
4. **Run Database Migrations**:
```bash
bun run db:migrate
```
5. **Start the Development Server**:
```bash
bun run dev
```
This launches the React frontend (running on port `3000`) and the Hono API backend simultaneously.