How jiangrui1994/cloudsaver works
Project Type and Purpose
• CloudSaver is a full-stack web application (monorepo managed by pnpm) combining a Vue 3 + TypeScript frontend with an Express + TypeScript backend and SQLite3 for persistence.
• It provides users with multi-source resource search and one-click transfers to various cloud storage services (115, Quark, Tianyi, 123yun), plus Douban integration and multi-user support.
File-Structure Analysis
• Top-level:
• Dockerfile, docker-entrypoint.sh, nginx.conf → containerization & reverse proxy
• pnpm-workspace.yaml, package.json → monorepo root, shared scripts
• backend/: Express app in src/ with subfolders for config, controllers, services, models, middleware, routes, utils, core, types → classic layered architecture (MVC‐ish + service layer)
• frontend/: Vite + Vue 3 app in src/, organized by api/, components/, views/ (pc & mobile), router/, stores/ (Pinia), styles/, utils/, assets/ → responsive multi-platform UI
• docs/, .github/: documentation and CI/CD workflows (docker build/test)
README Insights
• Confirms technology stack (Vue 3, Pinia, Element Plus, Vant, Express, SQLite3)
• Describes features: multi-source search, cloud transfer, Douban ranking, multi-user & role-based auth, responsive design
• Offers deployment options: local dev, Docker single container, Docker Compose
Main Components
a. Client
• Browser (PC / Mobile) → interacts via HTTP(S)
b. CDN / Reverse Proxy
• Nginx container (serves static assets, proxies API calls to Express)
c. Frontend
• Vue 3 + Vite dev server (dev mode) or built static files served by Nginx in production
• Pinia store, Vue Router (PC & mobile routes), UI libraries
d. Backend
• Express server (app.ts)
• Controllers (handle HTTP requests) → Services (business logic, cloud API wrappers) → Models (TypeORM or SQLite3 queries via DatabaseService)
• Middleware (auth, CORS, rate limiting, error handler, request logger)
• Core modules (ApiResponse, types)
e. Database
• SQLite3 file accessed via DatabaseService
f. External Services
• Cloud115 API, Quark API, Tianyi, 123yun (via Cloud115Service, QuarkService, etc.)
• Douban API (DoubanService)
• Optional Telegram integration (for channel configs)
g. Persistence & Config
• /app/data (SQLite DB file), /app/config (.env) mounted as Docker volumes
Relationships & Data Flow
• Browser → (HTTP GET/POST) → Nginx
• Nginx → serves static JS/CSS or proxies /api/* → Express
• Express middleware processes → Route → Controller → Service → (External API calls or SQLite operations)
• Service returns data → Controller → ApiResponse → JSON → Browser
• For cloud-transfer: Service orchestrates requests to third-party cloud APIs, returns status to client
• Auth flows: login/register → JWT issued → subsequent requests validated by auth middleware
Architectural Patterns & Principles
• Layered architecture (presentation → controller → service → data)
• Dependency injection via inversify.js (inversify.config.ts)
• Centralized error handling and request logging middleware
• Separation of concerns: API integrations encapsulated in dedicated services
• Responsive UI using same codebase with platform-specific routes & components
Must-Haves
• Component names and roles
• Notes on technologies at each component (e.g., “Pinia, Vue Router”, “Express, inversify.js”, “SQLite3”)
• Docker containers and volume mounts if illustrating deployment