A secure, scalable file management system built with Spring Boot, PostgreSQL, and Docker
- User Authentication
- JWT-based secure login/logout (24h token validity)
- Role-based access control (Admin/User)
- File Management
- Upload, organize, and preview files (images, documents)
- Public/private visibility toggle
- Automatic thumbnail generation for images (100px, 250px, 500px)
- Scalable Architecture
- Redis caching for sessions
- Asynchronous background jobs (thumbnails, emails)
- DevOps-Ready
- Dockerized PostgreSQL + Redis
- Multi-stage Docker builds (Corretto 21 + Alpine)
| Component | Technology |
|---|---|
| Backend | Spring Boot 3.2, Java 21 (Corretto) |
| Database | PostgreSQL 15 |
| Cache | Redis 7 |
| Auth | JWT, Spring Security |
| Storage | Local filesystem (configurable to S3) |
| DevOps | Docker, Docker Compose |
- Docker Engine 24+
- Java 21 (Amazon Corretto)
- Maven 3.9+
git clone https://github.com/codemindshub/files-manager.git
cd files-manager
cp .env.example .env # Update values in `.env` docker compose up -d # Starts Postgres and Redis docker exec -it postgres-fm bash
psql -U files-manager -d files_manager_db # Connect to DB mvn spring-boot:run # Starts Spring Boot on http://localhost:8080 files-manager/
├── .dockerignore
├── .env # SECRETS (Gitignored)
├── .env.example # Template for team
├── docker-compose.yml # Docker setup (Postgres + Redis)
├── src/
│ ├── main/
│ │ ├── java/gtp/filesmanager/
│ │ │ ├── config/ # Spring config classes
│ │ │ ├── controller/ # REST endpoints
│ │ │ ├── dto/ # Request/response objects
│ │ │ ├── exception/ # Custom exceptions
│ │ │ ├── job/ # background jobs
│ │ │ ├── logging/ # logging configs
│ │ │ ├── model/ #
│ │ │ ├── repository/ #
│ │ │ ├── service/ # Business logic
│ │ │ └── util/ # Helper classes
│ │ └── resources/
│ │ ├── db/ # SQL scripts
│ │ └── application.properties
└── test/ # Unit + integration tests
| Key | Purpose |
|---|---|
POSTGRES_USER |
Database user |
POSTGRES_PASSWORD |
Database password |
POSTGRES_DB |
Database name |
erDiagram
USER {
uuid id PK "Primary Key, Not Null, Unique"
varchar_255 email "Not Null, Unique"
varchar_255 password "Not Null"
boolean is_active "Default: true"
datetime created_at
datetime updated_at
}
FILE {
uuid id PK "Primary Key, Not Null, Unique"
varchar name "Not Null"
FileType type "Not Null (folder/file)"
varchar_100 mime_type "null for folders, required for files"
bigint size "null for folders, required for files"
varchar_10 file_extension "extracted from filename"
boolean is_public "Default: false"
boolean is_deleted "Default: false, soft delete"
varchar_512 storage_path
datetime last_accessed_at
datetime created_at "Default: current timestamp"
datetime updated_at "Default: current timestamp on update"
datetime deleted_at "timestamp when soft deleted"
uuid owner_id FK "References user.id"
uuid parent_id FK "References file.id, null for root level"
}
FILE_THUMBNAIL {
uuid id PK "Primary Key, Not Null, Unique"
uuid file_id FK "References file.id"
bigint size "Not Null"
SizeType size_type "Not Null (small/medium/large)"
varchar_255 storage_path "Not Null, storage location"
varchar_100 mime_type "Not Null, Default: image/jpeg"
datetime created_at "Default: current timestamp"
}
FILETYPE_ENUM {
string folder
string file
}
SIZETYPE_ENUM {
string small
string medium
string large
}
USER ||--o{ FILE : "owns (owner_id)"
FILE ||--o{ FILE_THUMBNAIL : "has thumbnails"
FILE ||--o{ FILE : "parent/child (parent_id)"
FILE }o--|| FILETYPE_ENUM : "type"
FILE_THUMBNAIL }o--|| SIZETYPE_ENUM : "size_type"
MIT © 2024 CodeMinds
- Cloud storage (S3/GCS) integration
- File versioning
- Real-time notifications (WebSocket)
✨ Happy Coding! ✨