Skip to content

AriiSib/cloud-storage

Repository files navigation

Cloud Storage

Spring Boot application for a personal cloud‑storage service. The app exposes a REST API for user registration/authentication and file/directory operations. Files are stored in MinIO (S3‑compatible), user data lives in PostgreSQL, and Redis backs HTTP sessions. Flyway keeps the schema in sync. OpenAPI/Swagger UI documents and exercises the API


Deploy

Application http://217.25.90.175/

Documentation http://217.25.90.175/swagger-ui/index.html


Features

  • User authentication – sign-up, sign-in, and sign-out endpoints with server-side HTTP sessions backed by Redis
  • Resource management:
    • Create/list directories
    • Upload, download (file or folder as ZIP)
    • Inspect resource metadata (file/dir), search by name (recursive), move/rename, delete
    • Max upload size: 2 GB per request (configurable)
  • Object storage via MinIO – files are streamed directly to/from MinIO while metadata stays in Postgres
  • Database migrations – Flyway migrations manage the relational schema
  • OpenAPI documentation – generated through springdoc-openapi and available at /swagger-ui/index.html

Technology stack

  • Java 21, Spring Boot 3.5
  • Spring Web, Spring Security, Spring Session (Redis)
  • PostgreSQL 16, Spring Data JPA (Hibernate)
  • MinIO (S3 API)
  • Flyway
  • Lombok, MapStruct
  • Springdoc-openapi

API overview

All endpoints are under /api and require an authenticated session unless noted

Endpoint Method Description
/api/auth/sign-up POST Register a user and create session
/api/auth/sign-in POST Login with username/password
/api/auth/sign-out POST Logout current session
/api/user/me GET Returns current username
/api/directory?path=$path GET List children of a directory (non‑recursive)
/api/directory POST Create a directory at path
/api/resource?path=$path GET Inspect a file or directory (metadata)
/api/resource POST Upload files into directory path
/api/resource DELETE Delete a file or directory (directory is deleted recursively)
/api/resource/move?from=$from&to=$to GET Move or rename a resource
/api/resource/search?query=$query GET Recursive search by name (files & directories)
/api/resource/download?path=$path GET Download a file (binary) or a directory (ZIP)

Path semantics

  • path is URL‑encoded; a directory path must end with /

  • Root is

  • Returned JSON for resources:

    {
      "path": "folder1/folder2/", // parent directory
      "name": "file.txt",         // file or dir name
      "size": 123,                // absent for directories
      "type": "FILE"              // FILE or DIRECTORY
    }

Validation (server‑side)

  • Directory paths must end with / and must not contain .. or //
  • Filenames are validated by a conservative segment pattern
  • On invalid path → 400, not found → 404, conflicts (existing) → 409

Refer to Swagger UI for full request/response models


Logging & observability

  • Logback configuration in logback-spring.xml:

  • Correlation: Each request carries X-Request-Id; filter puts it into MDC as cid and echoes it in responses

  • Access log: concise per‑request log line with method/URI/status/user/latency


About

Personal cloud storage: Spring Boot 3 (Java 21), MinIO (S3), PostgreSQL, Redis Sessions, Flyway, OpenAPI/Swagger; Docker + Nginx

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors