How appflowy-io/appflowy-cloud works
Main Components
• Frontend:
• The “admin_frontend” directory is the dedicated admin interface. It contains assets, template files, and its own Dockerfile and Cargo configuration. This represents the user-facing web app for administration and dashboard purposes.
• Backend Services:
• Core Server Application: The “src” directory houses the main API endpoints (e.g., /api/access_request.rs, /api/user.rs, /api/ws.rs) that serve RESTful and WebSocket endpoints.
• Microservices: Under the “services” directory, there are at least two key services:
– appflowy-collaborate: Handles real-time communication, collaboration logic, and synchronization using Actix WebSocket and various sub-modules (collab, group, snapshot, etc.).
– appflowy-worker: Handles background tasks such as email notifications, indexing, file imports, and data processing.
• Shared Libraries (libs):
• The “libs” folder contains many sub-crates (e.g., authentication, client-api, database, mailer, access-control, etc.) that encapsulate domain logic and infrastructural functionality shared across different parts of the system.
• Infrastructure & External Integrations:
• Database: The project uses PostgreSQL. Migrations are maintained in the “migrations” directory.
• Storage: Minio is referenced for file storage.
• Caching & Message Queues: Redis is used, as hinted by debugging instructions and scripts.
• Real-time and collaboration protocols: There are dedicated libraries for WebSocket interactions and real-time collaboration (e.g., client-websocket, collab-rt-entity).
• External Tools: PgAdmin, Portainer, and a debug-friendly Nginx reverse proxy (from the nginx folder and Docker files) are also in play.
Relationships and Interactions
• The admin frontend interacts with the backend APIs to manage user sessions, authentication, and administration tasks.
• The main server (in “src” and core libraries) communicates with the microservices via defined API endpoints and/or WS protocols.
• The appflowy-collaborate service manages real-time communication with clients via WebSockets, using shared libraries for consistent data formats.
• The appflowy-worker processes asynchronous jobs (indexing, email notifications, file processing) and interacts with the database, object storage, and external messaging queues.
• The shared libraries are used across these components to enforce consistent business logic, authentication (libs/authentication), and error handling (libs/app-error).
Architectural Patterns and Design Principles
• Modular Design and Microservice Architecture: Separation between frontend, backend APIs, and independent worker processes.
• Domain-driven / layered design: Business logic is encapsulated in “biz” modules and shared crates.
• Real-time Data Flow: Use of WebSocket components in both the API layer and dedicated real-time collaboration libraries.
• Infrastructure-as-Code: Multiple Docker Compose files, Dockerfiles, and scripts ease deployment and testing.
• Testing: A wide range of tests (unit tests in “tests”, integration tests in “services/*/tests”) ensures each module and service works as expected.
Technologies and Frameworks
• Rust as the main programming language.
• Actix Web and Actix WebSocket for backend API and real-time communications.
• sqlx for database connectivity and migration management.
• Docker for containerizing services.
• External integrations include PgAdmin for Postgres, Redis CLI, Minio for storage, and Portainer for container management.