A comprehensive file storage system with React frontend and Spring Boot backend, featuring JWT authentication, file/folder management, caching, rate limiting, and complete Docker support.
- React + TypeScript - Modern, type-safe frontend
- Clean UI - Google-like minimal design with white background
- Responsive - Works on desktop and mobile devices
- File Upload - Simple drag-and-drop file upload
- Folder Navigation - Intuitive folder structure browsing
- Search - Real-time file search functionality
- JWT Authentication - Secure user registration and login with role-based access control
- File Management - Upload, download, delete files with metadata tracking
- Folder Structure - Organize files in nested folders
- Search & Filter - Search files by name with pagination and sorting
- Caching - Redis-based caching for improved performance
- Rate Limiting - Bucket4j-based rate limiting to prevent abuse
- Email Notifications - SMTP integration for notifications
- API Documentation - Swagger/OpenAPI documentation
- Docker Support - Complete containerization with one-command startup
- Data Persistence - PostgreSQL database with volume mounts
- Docker and Docker Compose
- (Optional) Java 17+ and Maven 3.9+ for backend local development
- (Optional) Node.js 20+ and npm for frontend local development
Important: Create a .env file first with your credentials:
cp .env.template .env
# Edit .env and add your JWT_SECRET, MAIL_USERNAME, and MAIL_PASSWORDThen start the application:
# Navigate to the project root directory
cd BitBucket
docker-compose up --buildThe application will be available at:
- Frontend: http://localhost:3000 (Main application UI)
- Backend API: http://localhost:8080
- Swagger UI: http://localhost:8080/swagger-ui.html
- Health Check: http://localhost:8080/api/health
- Frontend: Port 3000 (Nginx serving React app)
- Backend: Port 8080 (Spring Boot API)
- PostgreSQL: Internal (not exposed)
- Redis: Port 6379
Open your browser and navigate to http://localhost:3000
-
Create an Account
- Click "Create account" on the login page
- Enter your email and password
- Click "Create account"
- You'll be automatically logged in and redirected to the dashboard
-
Login
- Enter your email and password
- Click "Sign in"
- You'll be redirected to the dashboard
File Management:
- Upload Files: Click "Upload File" button and select a file
- Download Files: Click "Download" next to any file
- Delete Files: Click "Delete" next to any file (confirmation required)
- Search Files: Use the search bar at the top to find files by name
Folder Management:
- Create Folder: Click "New Folder", enter a name, and click "Create"
- Navigate Folders: Click on any folder name to enter it
- Delete Folder: Click "Delete" next to any folder (confirmation required)
- Back to Root: Click "← Back to root" when inside a folder
User Account:
- View Email: Your email is displayed in the top right corner
- Logout: Click "Logout" to sign out
curl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "password123"
}'Response:
{
"token": "eyJhbGciOiJIUzUxMiJ9...",
"email": "user@example.com",
"role": "USER",
"message": "Registration successful"
}curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "password123"
}'curl -X POST http://localhost:8080/api/files/upload \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-F "file=@/path/to/file.pdf"curl -X POST http://localhost:8080/api/files/upload \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-F "file=@/path/to/file.pdf" \
-F "folderId=1"curl http://localhost:8080/api/files?page=0&size=20&sort=uploadedAt,desc \
-H "Authorization: Bearer YOUR_JWT_TOKEN"curl http://localhost:8080/api/files/1/download \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-O -Jcurl "http://localhost:8080/api/files/search?q=document&page=0&size=20" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"curl -X DELETE http://localhost:8080/api/files/1 \
-H "Authorization: Bearer YOUR_JWT_TOKEN"curl -X POST http://localhost:8080/api/folders \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My Documents"
}'curl -X POST http://localhost:8080/api/folders \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Work Files",
"parentId": 1
}'curl http://localhost:8080/api/folders \
-H "Authorization: Bearer YOUR_JWT_TOKEN"curl -X DELETE http://localhost:8080/api/folders/1 \
-H "Authorization: Bearer YOUR_JWT_TOKEN"Create a .env file from the template:
cp .env.template .envKey variables:
JWT_SECRET: Secret key for JWT token generation (min 256 bits recommended)MAIL_USERNAME: SMTP email usernameMAIL_PASSWORD: SMTP app passwordCACHE_TYPE: Set toredisto enable caching,noneto disable
See MANUAL_CONFIGURATION.md for detailed configuration instructions.
- Backend: Spring Boot 3.5.10
- Database: PostgreSQL 16
- Cache: Redis 7
- Authentication: JWT (JJWT 0.12.3)
- API Docs: SpringDoc OpenAPI 2.3.0
- Rate Limiting: Bucket4j 8.7.0
- Build: Maven 3.9
- Runtime: Java 17
- Frontend: React-18 with vite
backend/
├── src/main/java/com/razor/BitBucket/
│ ├── config/ # Security, JWT, Cache, Rate Limiting
│ ├── controller/ # REST API endpoints
│ ├── dto/ # Data Transfer Objects
│ ├── model/ # JPA Entities
│ ├── repository/ # Data Access Layer
│ ├── service/ # Business Logic
│ └── util/ # JWT Utilities
└── src/main/resources/
└── application.yaml # Application configuration
docker-compose up --builddocker-compose downdocker logs bitbucket-backend -fdocker-compose up --build -ddocker exec -it bitbucket-db psql -U postgres -d filestorage_dbusers- User accountsfolders- Folder structurefile_metadata- File information
curl http://localhost:8080/api/healthNavigate to http://localhost:8080/swagger-ui.html to explore and test all API endpoints interactively.
If port 8080 is already in use, modify docker-compose.yml:
ports:
- "8081:8080" # Change 8080 to 8081Check if PostgreSQL is healthy:
docker-compose psEnsure the upload directory has proper permissions:
docker exec -it bitbucket-backend ls -la /app/uploadsdocker-compose down -v # Removes volumes
docker-compose up --build| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/auth/register |
Register new user | No |
| POST | /api/auth/login |
Login user | No |
| GET | /api/health |
Health check | No |
| POST | /api/files/upload |
Upload file | Yes |
| GET | /api/files/{id}/download |
Download file | Yes |
| GET | /api/files |
List files | Yes |
| GET | /api/files/search |
Search files | Yes |
| DELETE | /api/files/{id} |
Delete file | Yes |
| POST | /api/folders |
Create folder | Yes |
| GET | /api/folders |
List folders | Yes |
| GET | /api/folders/{id} |
Get folder | Yes |
| DELETE | /api/folders/{id} |
Delete folder | Yes |
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
razor
- Spring Boot team for the excellent framework
- PostgreSQL and Redis communities
- Docker for containerization support