How appflowy-io/appflowy-web works
Main Components
• User Interface (Frontend)
– Indicate the rich modular structure (e.g., components/app, components/global-comment, components/ai-chat, etc.) and emphasize how each of these modules contributes to overall user interaction.
• Application / Domain Layer
– Represent the “Application” logic that is in the src/application folder. This includes domain elements such as:
• Collaborative editing (handled by modules like slate-yjs and ydoc for real-time updates),
• Database operations (interfacing with AppFlowy Cloud and abstracted in src/application/db),
• Session, authentication, and publishing functionalities.
– Highlight support for different field types (text, number, relation, select-option, etc.) that facilitate creating rich documents.
• Services and Utilities Layer
– Show “Utility” modules (src/utils, src/lib) that support features such as logging, file handling, theming, and more.
• External Integration and Backend Connectivity
– Create a component for “AppFlowy Cloud” which is an external service providing the backend API (the README describes this dependency, particularly for authentication, database sync, and collaboration).
• Deployment & Infrastructure
– Include a “Deployment” section detailing Docker, Nginx, and the server files found under deploy/. This shows how the application is containerized and deployed.
– Optionally note the CI/CD pipelines (GitHub workflows under .github/workflows) which automate building, testing, and deploying the project.
• Testing & Quality Assurance
– Represent testing layers such as Cypress (end-to-end tests in cypress/), Jest (jest.config.cjs), and other mock files (__mocks__) which assure quality and stability.
Relationships and Data Flows
• That interactions trigger application logic in the domain layer (e.g., writing in the editor sends signals through collaborative services like Yjs).
• How API calls flow from the application’s services layer to the AppFlowy Cloud backend.
Architectural Patterns & Design Principles
• Separation of concerns through a layered architecture (UI, application/domain, services/integration).
• Use of modular component design (React components organized into domain-specific folders).
• Use of collaborative editing patterns (real-time syncing using Yjs and integration with Slate).
• Standard front-end patterns such as context providers (e.g., for session management and global state) and utility abstractions.
Relevant Technologies and Frameworks
• React and TypeScript for the frontend.
• Yjs and Slate for real-time, collaborative editing.
• Docker & Nginx for containerization and deployment.
• Testing frameworks like Cypress and Jest.
• Node.js-based services (as indicated by scripts and server.ts in deploy/).