How ryuichi24/iremono-old works
Project Type and Purpose
• iremono is a full‐stack application that enables users to self-host their cloud storage with advanced encryption (including zero‐knowledge encryption), supporting both SQLite and MySQL databases.
• The project is structured as a monorepo with multiple packages—including the core backend logic, an API server, a frontend web client, and a utility library.
File Structure and Main Components
• Frontend – packages/iremono-web:
– This contains the React-based web client including components, pages, hooks, and state management (Redux).
• Backend – packages/iremono-server:
– Contains the Express-based API server with controllers, routes, configurations, and middleware.
• Business/Core Logic – packages/iremono-backend-core:
– Implements domain-specific use cases (auth, file management, folder operations, trash management), repository interfaces, entities, and services (token services, crypto services, etc.).
• Utility Library – packages/iremono-util:
– Houses shared utility functions like logging, file-system helpers, error definitions, and other common tools.
• Other Items:
– Configuration files (Dockerfile, docker-compose files, .env.example) for deployment.
– Scripts for initializing and maintaining the database for both SQLite and MySQL.
– Testing and configuration files (jest, TS config, eslint, etc.)
Main Components
a. Frontend Client:
– Show “iremono-web” as the UI layer (React SPA).
– Include key elements: Components, Containers, Services, Store (Redux).
b. API Backend Server:
– Represent “iremono-server” as the Express API layer.
– Partition into areas like Controllers (for handling requests such as auth, files, folders, trash) and Routes.
– Indicate middleware (e.g., authentication, error handling, upload parser, logging).
c. Domain/Business Logic Layer:
– Show separation into layers such as “Entities”, “Use Cases”, “Repositories” (with support for both MySQL and SQLite implementations), and “Services”.
d. Utilities:
– Show “iremono-util” as a helper library that provides cross-cutting functionalities (logging, error handling, file-system operations).
e. Database and Data Access:
– Indicate the persistence layer supporting two types: MySQL and SQLite.
f. Deployment and Infrastructure:
– Include Docker/Docker Compose as the container/infrastructure layer.
– Represent configuration files like Dockerfile and docker-compose.* to illustrate the deployment aspects.
Relationships and Interactions
– The Frontend (iremono-web) sends HTTP/REST API calls to the Backend Server (iremono-server).
– The API server delegates business logic to the Core (iremono-backend-core) layer by invoking use cases.
– The backend-core layer communicates with the Persistence layer (either MySQL or SQLite) via data-access repositories.
– Utility services (from iremono-util) might be used across all layers, for logging, file system operations, etc.
• Authentication and encryption services (like access token, refresh token and crypto services) as key cross-cutting concerns.
• Clearly differentiate between external service dependencies (e.g., database service, Docker orchestration) and internal modules.
Architectural Patterns and Design Principles
• Separation of Concerns: Divide the system into distinct layers (frontend, API layer, business logic, data access, utilities).
• Modularization: Use monorepo organization to clearly separate concerns (controllers vs. use cases vs. repositories).
• Repository Pattern: Abstract database operations to support both MySQL and SQLite.
• Service Layer: Implement business logic and encryption tokens via dedicated services.
• Client-Driven Encryption: Highlight the zero-knowledge encryption aspect by showing the flow of client encryption keys that never reach the server.