Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloudNest

CloudNest is a Spring Boot based distributed net disk backend. It provides user authentication, file and folder management, upload/download, recycle bin, sharing, quota management and admin APIs.

Tech Stack

  • Java 17, Spring Boot 3.5
  • Spring Security, JWT
  • MyBatis-Plus, MySQL 8
  • Redis 7
  • MinIO object storage
  • Springdoc OpenAPI / Swagger
  • H2 for local dev and tests

Features

  • User registration, login, logout and password change
  • JWT authentication with token blacklist support
  • Folder create, rename, move, tree and recursive recycle
  • File list, detail, search, sort, rename, move and batch delete
  • Simple upload with MD5 verification
  • MD5 instant upload with storage reference counting
  • Chunk upload with resume, local temp chunks, merge, MD5 verification and cleanup
  • Single file download, folder zip download and batch zip download
  • Preview by presigned URL, with text file content preview
  • Recycle bin list, restore, purge, clear and scheduled expired cleanup
  • Share create, extract code verification, cancel, public access, save to own drive and download
  • Quota accounting for upload, instant upload, share save and purge
  • Admin user management, quota adjustment, statistics, share list, operation logs and system config
  • Swagger API documentation

Project Structure

src/main/java/com/clouddrive
  common          common models, exceptions, annotations and utilities
  config          security, MyBatis, MinIO, Redis, scheduling and OpenAPI config
  infrastructure  Redis and MinIO adapters
  module/auth     registration, login, logout and password APIs
  module/user     profile and quota APIs
  module/file     folder, file, upload, media and recycle bin APIs
  module/share    sharing APIs
  module/admin    admin APIs
  module/operation operation log persistence
src/main/resources/db
  schema.sql      database schema
  data.sql        default seed users

Local Run

Start infrastructure first:

docker compose up -d

Run the API:

./mvnw spring-boot:run

On Windows PowerShell:

.\mvnw.cmd spring-boot:run

Docker Compose

docker-compose.yml starts MySQL, Redis, MinIO and the API service:

./mvnw -DskipTests package
docker compose up -d

On Windows PowerShell:

.\mvnw.cmd -DskipTests package
docker compose up -d

MySQL runs schema.sql and data.sql on first container initialization. If you already have an existing mysql_data volume, remove it before reinitializing the schema.

Database

Initialization SQL is under src/main/resources/db.

The dev profile uses H2 and initializes automatically. The default profile targets MySQL and expects the cloud_drive database from Docker Compose.

Default Accounts

  • Admin: admin / admin123456
  • User: test / test123456

Useful URLs

Core Demo Flow

  1. Login with test / test123456.
  2. Create a folder with POST /api/folders.
  3. Upload a small file with POST /api/upload/simple.
  4. Download it with GET /api/files/{id}/download.
  5. Create a share with POST /api/shares.
  6. Visit share info with GET /api/shares/public/{shareCode}.
  7. Save the share to another account with POST /api/shares/public/{shareCode}/save.
  8. Delete a file and restore or purge it from /api/recycle-bin.

Tests

./mvnw test

The tests run against H2 and mock external MinIO/Redis behavior where needed.

Configuration

Main configuration lives in src/main/resources/application.yml.

Common environment variables:

  • MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD
  • REDIS_HOST, REDIS_PORT, REDIS_PASSWORD
  • MINIO_ENDPOINT, MINIO_ACCESS_KEY, MINIO_SECRET_KEY, MINIO_BUCKET
  • JWT_SECRET, JWT_EXPIRE_SECONDS
  • UPLOAD_MAX_FILE_SIZE_MB, UPLOAD_CHUNK_SIZE_MB
  • RECYCLE_BIN_KEEP_DAYS, DEFAULT_USER_QUOTA_BYTES

Screenshots

No frontend screenshots are included. Use Swagger UI for API demonstration.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages