5.5 KiB
Yoresee Doc
Yoresee Doc is a collaborative document platform built with a Go backend, Vue 3 frontend, and a Yjs-based real-time collaboration stack.
Runtime Topology
Core app services:
frontend: Vue 3 (Vite)backend: Go Connect RPC/gRPC servicecollab-core: Node.js Yjs collaboration corecollab:collab-goWebSocket gatewaysnapshot-worker: document snapshot sync workernotification-worker: notification event consumersearch-sync-worker: Elasticsearch sync worker
Infrastructure services:
postgresredisrabbitmqconsulminioelasticsearchnginx(single ingress)
Request and Event Flow
Main request path:
- Browser -> Nginx
- Nginx
/-> Frontend - Nginx
/grpc/-> Backend gRPC-web endpoint - Backend -> Postgres/Redis/MinIO/Consul/Elasticsearch/MQ as needed
Realtime collaboration path:
- Browser -> Nginx
/ws/doc/{docId} - Nginx ->
collab-go collab-govalidates JWT and proxies tocollab-corecollab-coremaintains Yjs doc state in memory and Redis
Async event path:
collab-coremarks dirty docs in Redis and publishes dirty-doc eventssnapshot-workerconsumescollab.dirty_docs(RabbitMQ group mode) and also scans dirty set periodicallysnapshot-workerfetches/internal/yjs/doc-snapshot/{docId}fromcollab-core, writes snapshot/content to DB, and emits search-sync event when content changedsearch-sync-workerconsumessearch.sync.documentand upserts Elasticsearch (when ES is enabled)notification-workerconsumesnotification.createand writes notification records
Health and Graceful Shutdown
Backend probes:
/health/readyz/livez
Collab probes:
collab-core:/health,/readyz,/livezcollab-go:/health,/readyz,/livez
Shutdown behavior:
- Backend and collab services support draining and graceful shutdown.
- Readiness becomes
not_readyduring draining.
Deployment Modes
deploy/docker-compose.dev.yml:
- Source-mounted development containers
- Backend debug port exposed (
2345) - Postgres/Redis/RabbitMQ/Elasticsearch ports exposed to host
start.sh dev ...auto-runsdeploy/script/gen_proto.sh
deploy/docker-compose.yml:
- Production-style images
- Fewer host-exposed ports
- Backend/worker binaries are prebuilt in image stages
Dev Prerequisites
start.sh dev ... runs deploy/script/gen_proto.sh on the host machine before docker compose starts.
Required on host:
docker+docker composego+protoc(for Go stubs)- frontend plugins in
frontend/node_modules(protoc-gen-es,protoc-gen-connect-es) grpc_tools_node_protoc_plugininPATH(for Node gRPC stubs used bycollab)
Configuration Workflow
Single source of truth:
deploy/.env- template:
deploy/.env.example
Interactive init/update:
bash deploy/script/configure.sh
What configure.sh does:
- prompts for key ports/secrets/env values
- writes/updates
deploy/.env - derives
MINIO_BROWSER_REDIRECT_URLfromVITE_API_BASE_URL - calls
prepare.shautomatically
Render generated config files:
bash deploy/script/prepare.sh
Generated files:
backend/config.tomlfrontend/nginx.confdeploy/nginx/nginx.confdeploy/nginx/conf.d/default.confdeploy/redis/redis.confdeploy/rabbitmq/rabbitmq.conf
Template files:
backend/config.toml.tmplfrontend/nginx.conf.tmpldeploy/nginx/nginx.conf.tmpldeploy/nginx/conf.d/default.conf.tmpldeploy/redis/redis.conf.tmpldeploy/rabbitmq/rabbitmq.conf.tmpl
Quick Start
Recommended (interactive):
bash deploy/script/configure.sh
bash deploy/script/start.sh dev up
Non-interactive:
cp deploy/.env.example deploy/.env
bash deploy/script/prepare.sh
bash deploy/script/start.sh dev up
Release mode:
bash deploy/script/start.sh release up
Backend image startup behavior:
- backend container runs
migrate,db_init,es_init, then startscmd/main.
Other actions:
bash deploy/script/start.sh dev rebuild
bash deploy/script/start.sh dev restart
bash deploy/script/start.sh dev clear
Public Entry Points
Default dev ports:
- App UI:
http://localhost:8080 - gRPC-web:
http://localhost:8080/grpc/ - Collaboration WS:
ws://localhost:8080/ws/doc/{docId}?token={jwt} - MinIO console (via Nginx):
http://localhost:8080/minio/ - Object public path (via Nginx):
http://localhost:8080/storage/... - RabbitMQ management (via Nginx):
http://localhost:8080/rabbitmq/
Direct infra ports in dev:
- Postgres:
localhost:5432 - Redis:
localhost:6379 - RabbitMQ AMQP:
localhost:5672 - Consul:
localhost:8500 - Elasticsearch:
localhost:9200
Message Queue Notes
- Worker consumers are currently configured to use RabbitMQ backend.
- MQ interface supports Redis and RabbitMQ implementations.
- Redis Pub/Sub does not provide true consumer-group semantics.
- For dirty-doc pipeline, keep
DIRTY_DOC_MQasrabbitmqorbothif snapshot-worker should consume events from RabbitMQ.
Build and Protobuf
Manual protobuf generation:
bash deploy/script/gen_proto.sh
Generated targets:
backend/pkg/gencollab-go/pkg/genfrontend/src/gencollab/src/gen
Repository Structure
backend: API service, workers, repositories, storage integrationfrontend: Vue applicationcollab: Node.js collaboration corecollab-go: Go WebSocket gateway for collaboration trafficproto: protobuf contractsdeploy: compose files, scripts, infra templatesdocs: project docs