Skip to content

thuongtruong109/celedrive

Repository files navigation

Favicon celedrive

Store and share your files with ease

Lint config status Licence

Preview

🗾 Introduction

Celedrive is a file storage and sharing platform implements a microservices-based architecture orchestrated through Docker containers, with a central hub service coordinating multiple specialized sharing services. The system supports multiple sharing mechanisms including real-time facilitating temporary file transfers, wheareas enables users to store files permanently in the cloud.

🎗️ Preview

Storage

Public share

Protected share

Single share

Group share

Multi share

💡 Features

Features

⛳ Architecture

Celedrive is a polyglot microservices architecture built around main hub storage service and five distinct file sharing mechanisms: public sharing, protected sharing, and three types of real-time sharing (single, group, and multi-user). The system uses a spoke model where a central Next.js application orchestrates multiple specialized services, each optimized for specific sharing patterns and data persistence requirements. The architecture ensures that each service can be independently scaled and maintained while preserving the overall system functionality through well-defined service contracts and dependency management.

  • System architecture

System architecture

  • Data architecture

Celedrive employs a multi-database strategy where each sharing mechanism uses the most appropriate data store for its access patterns and consistency requirements:

Sharing Type Data Store Persistence Consistency Use Case
User Files Firebase/Firestore Permanent Strong File metadata, user profiles
Public Links MongoDB Permanent Eventual Public file downloads
Protected Files Firebase Permanent Strong One-time key validation
Single Share In-Memory Session None Direct transfers
Group Share In-Memory Session None P2P coordination
Multi Share In-Memory Session None Mesh network state
Real-time Updates Convex Temporary Strong Live dashboard updates

Data architecture

  • Security architecture

Security architecture

  • Component architecture

Component architecture

  • Build architecture

Build architecture

  • Deployment architecture

Deployment architecture

📦 Tech Stack

Service Protocol Technology Primary Function Data Store Communication Pattern Key Libraries File Locations Dependencies
Hub Service HTTP/REST Next.js/TypeScript Central dashboard, file management Firebase, Convex HTTP API, Server-side rendering Clerk, Convex, Firebase hub/ public_server, group, single, multi
Public Server HTTP/REST Node.js/Express Public file uploads/downloads MongoDB REST API MongoDB, Multer public/server mongo
Protected HTTP/REST Node.js/Express Protected file uploads/downloads Firebase REST API Firebase, Multer protected/ firebase
Single Share 5000 Node.js/Socket.io 1:1 real-time transfers In-memory TCP Sockets Real-time events single/server None
Group Share 3002 React/PeerJS Multi-user P2P sharing External P2P WebRTC signaling WebRTC signaling group/ None
Multi Share 3000 React/WebRTC Mesh network sharing Internal P2P Direct P2P connections Direct P2P multi/ peerjs
Forward Proxy 3333 Go/Gin Load balancing, request routing None HTTP forwarding HTTP reverse proxy proxy/ hub
PeerJS Server 5001 Node.js/Express P2P signaling server None WebSocket PeerJS peerjs/ None
  • System stack

System stack

  • Mapping stack

Mapping stack

  • EsLint + Prettier + Editorconfig (linting)
  • Husky + Lint-staged (pre-commit)
  • Commitlint (commit message)
  • GitHub Actions (CI/CD)
  • TypeScript (main storage, share public frontend, share protected, share group, share multi)
  • Nodemon (share public server auto-restart)
  • Tailwind CSS + Radix-ui (main storage styling)
  • React Icons (main storage icons)
  • Axios (main storage API fetcher)
  • Next.js (main storage)
  • Clerk (main storage authentication)
  • Convex (main storage database)
  • Firebase (main storage, share protected database)
  • MongoDB (share public database)
  • Express - Node (share single backend)
  • Socket.io (share single backend)
  • React (share group, share multi)
  • Peerjs (share group, share multi)
  • Redux + Reduxjs Toolkit (share group)
  • Ant Design (share group)
  • WebRTC (share multi)
  • Peer (share multi)
  • Fortawesome + SCSS (share multi)
  • Vite + Serve (share multi)
  • Docker (containerization)
  • Gin gonic - Go (proxy server)
  • Vercel + Render + GitHub Pages (deployment)
  • LaTex (report documentation)

🌊 Flow

The system uses a Go-based reverse proxy to route requests to appropriate services based on URL patterns and service availability:

  • Request flow

Request flow

  • Development flow

Development flow

  • Authentication flow

Authentication flow

  • File operation flow

File operation flow

  • File upload flow

File upload flow

  • File download flow

File download flow

  • Upload progress flow

Upload progress flow

  • Storage flow

Storage flow

  • Share flow

Share flow

  • Proxy flow

Proxy flow

🪄 Sequence diagram

  • Main storage

Storage

  • Share public:

Single sharing

  • Share protected:

Group sharing

  • Share group:

Multi sharing

  • Share multi:

Public sharing

  • Share single:

Protected sharing

🕸️ Patterns

Sharing Type Authentication Authorization Security Model
Hub Dashboard Required (OAuth) User-based Session tokens
Public Share None Public access No restrictions
Protected Share None One-time key Temporary access tokens
Single Share None Session-based Temporary room IDs
Group Share None ID-based Peer verification
Multi Share None ID-based Mesh authentication

Realtime sharing patterns

Components

🧭 Comparison

Comparison

🧩 Development

The celedrive project is configured as a monorepo with both root-level tooling and individual application build configurations. The development environment uses modern JavaScript tooling with TypeScript support and automated code quality enforcement.

Script Location Purpose Command
prepare Root Initialize git hooks husky
lint Root Validate code formatting editorconfig-checker
dev apps/multi Development server vite
build apps/multi Production build tsc && vite build
peer apps/multi Start PeerJS server peerjs --port 9000
start:dev apps/multi Build and run with peer server yarn build && concurrently "yarn peer" "yarn start"
start apps/multi Serve built application yarn serve -s dist/
preview apps/multi Preview production build vite preview
# Hub Service Configuration
NEXT_PUBLIC_SHARE_PUBLIC_API_URI=http://localhost:8000 - Points to public_server API
NEXT_PUBLIC_SHARE_SINGLE_EMBED_URI=http://localhost:5000 - Points to single sharing service
NEXT_PUBLIC_SHARE_GROUP_EMBED_URI=http://localhost:3002 - Points to group sharing service
NEXT_PUBLIC_SHARE_MULTI_EMBED_URI=http://localhost:3000 - Points to multi sharing service

# Proxy Service Configuration
APP_1=http://localhost:3001/ - Primary hub instance
APP_2=http://localhost:3003/ - Secondary hub instance

# Database Configuration
MONGO_URI=mongodb://mongo:27017 - MongoDB connection for public_server

🪪 License

MIT License ©Tran Nguyen Thuong Truong, 2024

About

❄️ Store and share your files with ease. Join and start managing your files now.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published