root d5f9cb366a refactor(infrastructure): modularize designGateway into focused modules
Split the monolithic designGateway.ts (1000+ lines) into organized modules:
- types.ts: type definitions and API contracts
- request.ts: HTTP request utilities
- responses.ts: response type definitions
- canvas.ts: canvas-related API calls
- projects.ts: project management operations
- agents.ts: agent/thread API operations
- generation.ts: image generation operations
- events.ts: event streaming and handlers
- canvasSnapshot.ts: snapshot management
- sharing.ts: share context and permissions
- assets.ts: asset operations
- clientIds.ts: client ID utilities
- shareContext.ts: share context helpers

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-10 16:58:21 +08:00
2026-07-08 10:57:55 +08:00

img-infinite-canvas

Moteva 风格的 AI 设计工作台复刻 MVP:主页 Prompt 创建项目,项目页提供无限画布、节点拖拽、缩放平移、右侧设计对话、历史回放、图片资产上传、项目保存与再生成。

Stack

  • Backend: go-zero, DDD layering, sqlc, pgx, PostgreSQL optional persistence
  • Cache: memory or Redis, default memory
  • Agent: sky-valley/pi Go agent runtime adapter, local desktop agent disabled
  • Image storage: memory, MinIO, AWS S3, Cloudflare R2, Aliyun OSS
  • Frontend: Next.js App Router, pnpm, Vite artifact build, TypeScript, gzip, i18n
  • Deploy: local binary, Docker Compose, k3s manifests

Run Locally

Backend:

cd server
go mod tidy
go run . -f etc/config.yaml

Frontend:

cd frontend
pnpm install
pnpm dev

Open http://localhost:5173. Next.js rewrites /api to http://localhost:8888 in development. pnpm build runs next build and vite build, producing gzip assets in frontend/dist.

Cache Config

Default in-memory cache:

Cache:
  Driver: memory
  TTLSeconds: 300

Redis cache:

Cache:
  Driver: redis
  Addr: localhost:6379
  Password: ""
  DB: 0
  TTLSeconds: 300

Storage Config

Default memory storage is useful for local UI work:

Storage:
  Driver: memory

Image Object Storage

Default memory mode is useful for local prototyping. Production can use MinIO, AWS S3, Cloudflare R2, or Aliyun OSS:

ObjectStorage:
  Driver: minio # memory|minio|s3|aws|r2|aliyun
  Bucket: canvas-assets
  Endpoint: localhost:9000
  Region: us-east-1
  AccessKey: canvas
  SecretKey: canvas-secret
  PublicBase: http://localhost:9000/canvas-assets
  UseSSL: false
  ExpiresIn: 900

PostgreSQL storage:

Storage:
  Driver: postgres
  DataSource: postgres://canvas:canvas@localhost:5432/canvas?sslmode=disable

Docker Compose

cd deploy
docker compose up --build

Open http://localhost:3000.

k3s

Build and load/push these images first:

docker build -t img-infinite-canvas-api:latest server
docker build -t img-infinite-canvas-web:latest frontend
kubectl apply -f deploy/k3s/img-infinite-canvas.yaml

The sample ingress host is canvas.local.

API

See server/API.md.

S
Description
No description provided
Readme 164 MiB
Languages
Go 45.7%
TypeScript 41.8%
CSS 11.6%
HTML 0.8%