How thetnaingtn/memos works
Main Components
• Backend Server: Represent the Go “server” directory. Note its subcomponents such as the API router (server/router/api/v1), runners (for tasks like memopayload and s3presign), and version/profile management.
• Plugins: Show the different plugin categories (cron, filter, httpgetter, idp, storage, webhook) as modular extension points. Indicate that these plugins extend the core functionality (e.g., scheduling tasks or handling external integrations).
• Proto API: Include a component for the API specifications (proto folder) and generated code (proto/gen). This illustrates how service definitions map to gRPC/REST endpoints.
• Data Store: Illustrate the store layer that handles database interactions. Mention the support for multiple database backends (MySQL, Postgres, SQLite), migration scripts (located in store/migration and store/seed), and caching.
• Frontend: Include the “web” directory that contains the React-based user interface, its routing, state management (store/v1, store/v2), and theming. Note that this separates user interaction concerns from the backend logic.
• External Interfaces: Mark Docker configuration (Dockerfile, dockerignore) and CI/CD pipelines (in .github/workflows) showing deployment infrastructure. Additionally, note that the self-hosted nature means that external access could be via API endpoints.
Relationships and Interactions
• API Communication: Demonstrate how the backend uses protocol definitions (proto) to structure communication, ensuring consistency between services.
• Plugin & Core Integration: Indicate that plugins integrate into the main application flow to handle tasks like scheduling or external HTTP requests.
• Data Storage: Show that the backend server interacts with the data store layer (store) that abstracts multiple SQL databases. Also include migration and seeding processes for database setup.
Architectural Patterns & Design Principles
• Layered Architecture: Separate concerns clearly into presentation (web frontend), business logic (server/router, runners), persistence (store), and extension (plugins).
• Modularity & Extensibility: Emphasize how the plugin system allows for features to be added or modified without altering core components.
• API-First Approach: With defined proto files and generated code, the system enforces a contract between services.
• CI/CD Integration: Reflect the importance of automated testing and deployment as indicated by the GitHub workflows and Docker setup files.
Relevant Technologies & Frameworks
• Go as the primary backend language.
• React and TypeScript (with Vite and Tailwind CSS) for the frontend.
• gRPC/Protocol Buffers for API definition and communication.
• SQL databases (MySQL, Postgres, SQLite) with migration support.
• Docker for containerization and deployment.
• CI/CD tools (GitHub Actions) for build, testing, and deployment automation.