https://github.com/jiil07/jcloud
Jcloud is a client-server add to keep your files in a cloud storage
https://github.com/jiil07/jcloud
cloud-services go golang
Last synced: 5 months ago
JSON representation
Jcloud is a client-server add to keep your files in a cloud storage
- Host: GitHub
- URL: https://github.com/jiil07/jcloud
- Owner: JIIL07
- License: other
- Created: 2024-04-12T14:06:02.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-09-20T18:11:50.000Z (9 months ago)
- Last Synced: 2025-09-20T20:20:58.375Z (9 months ago)
- Topics: cloud-services, go, golang
- Language: Go
- Homepage: https://jiil07.github.io/jcloud/
- Size: 701 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ JCloud - Modern Cloud File Storage System
[](https://golang.org/)
[](LICENSE)
[](.golangci.yml)
[](.golangci.yml)
> **A high-performance, scalable cloud file storage system built with Go, featuring a clean architecture, comprehensive API, and modern CLI interface.**
## โจ Features
### ๐ง Core Functionality
- **File Management**: Upload, download, delete, and organize files
- **Version Control**: Track file versions with delta compression
- **User Authentication**: Secure session-based authentication
- **Image Gallery**: Dedicated image viewing and management
- **File Metadata**: Rich metadata support with descriptions and tags
- **Hash Verification**: SHA-256 file integrity checking
### ๐๏ธ Architecture
- **Clean Architecture**: Separation of concerns with service layers
- **Interface-Based Design**: Dependency injection and testability
- **RESTful API**: Comprehensive HTTP API with proper status codes
- **Database Layer**: SQLite3 with transaction support
- **Middleware**: Authentication, logging, and error handling
- **WebSocket Support**: Real-time file synchronization
### ๐ฅ๏ธ Client Applications
- **CLI Client**: Interactive command-line interface with Cobra
- **Desktop App**: Rust-based GUI for file selection (egui)
- **Web Interface**: Modern HTML5 interface
- **Admin Panel**: Administrative tools and user management
## ๐ Quick Start
### Prerequisites
- Go 1.23+
- SQLite3
- Rust (for desktop app)
### Installation
```bash
# Clone the repository
git clone https://github.com/JIIL07/jcloud.git
cd jcloud
# Build the server
go build -o bin/server cmd/server/main.go
# Build the CLI client
go build -o bin/jcloud cmd/cloud/main.go
# Build the desktop app (optional)
cd interactive_file_selector
cargo build --release
```
### Running the Server
```bash
# Start the server
./bin/server
# Server will be available at http://localhost:8080
```
### Using the CLI Client
```bash
# Login
jcloud login
# Upload a file
jcloud add /path/to/file.txt
# List files
jcloud list
# Download a file
jcloud download filename.txt
# Get help
jcloud --help
```
## ๐ Project Structure
```
jcloud/
โโโ cmd/ # Application entry points
โ โโโ cloud/ # CLI client
โ โโโ server/ # HTTP server
โโโ internal/ # Private application code
โ โโโ client/ # CLI client implementation
โ โ โโโ app/ # Application logic
โ โ โโโ cmd/ # CLI commands
โ โ โโโ models/ # Data models
โ โ โโโ requests/ # HTTP client
โ โโโ server/ # Server implementation
โ โโโ handlers/ # HTTP handlers
โ โโโ middleware/ # HTTP middleware
โ โโโ routes/ # Route configuration
โ โโโ storage/ # Database layer
โ โโโ types/ # Interface definitions
โ โโโ utils/ # Utility functions
โโโ pkg/ # Public packages
โ โโโ hash/ # Hashing utilities
โ โโโ log/ # Logging utilities
โ โโโ params/ # Parameter handling
โโโ interactive_file_selector/ # Rust desktop app
โโโ static/ # Static assets
โโโ web/ # Web interface
```
## ๐ง Configuration
### Server Configuration (`config/config.yaml`)
```yaml
server:
address: ":8080"
read_timeout: 30s
write_timeout: 30s
idle_timeout: 60s
database:
path: "storage/storage.db"
static:
path: "static/"
env: "development"
```
### Client Configuration (`config/client.yaml`)
```yaml
server:
url: "https://jcloud.up.railway.app"
timeout: 30s
storage:
cache_path: "~/.jcloud/cache"
cookie_path: "~/.jcloud/cookies"
hints:
enabled: true
timeout: 5s
```
## ๐ API Endpoints
### Authentication
- `POST /api/v1/login` - User login
- `GET /api/v1/logout` - User logout
- `GET /api/v1/user/{user}` - Get current user
### File Operations
- `POST /api/v1/user/{user}/files/upload` - Upload files
- `GET /api/v1/user/{user}/files/list` - List files
- `GET /api/v1/user/{user}/files/images` - Image gallery
- `GET /api/v1/user/{user}/files/{filename}/download` - Download file
- `DELETE /api/v1/user/{user}/files/{filename}/delete` - Delete file
### File Metadata
- `GET /api/v1/user/{user}/files/{filename}/info` - File information
- `PATCH /api/v1/user/{user}/files/{filename}/metadata` - Update metadata
- `GET /api/v1/user/{user}/files/{filename}/hash-sum` - File hash
### Version Control
- `POST /api/v1/user/{user}/files/{filename}/versions` - Create version
- `GET /api/v1/user/{user}/files/{filename}/versions` - List versions
- `GET /api/v1/user/{user}/files/{filename}/versions/{version}` - Get version
- `GET /api/v1/user/{user}/files/{filename}/versions/last` - Get last version
- `DELETE /api/v1/user/{user}/files/{filename}/versions/{version}` - Delete version
- `GET /api/v1/user/{user}/files/{filename}/restore` - Restore to version
### Admin
- `GET /admin/admin` - Admin authentication
- `GET /admin/checkadmin` - Check admin status
- `GET /admin/all-users` - List all users
- `GET /admin/sql` - Execute SQL queries
- `GET /admin/cmd` - Execute system commands
## ๐๏ธ Architecture Overview
### Clean Architecture Principles
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Presentation Layer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ HTTP Handlers โ CLI Commands โ Desktop App โ Web UI โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Business Logic Layer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ File Service โ Auth Service โ Validation Service โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Data Access Layer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Storage Service โ Database Layer โ File System โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
### Key Design Patterns
- **Dependency Injection**: Services are injected into handlers
- **Interface Segregation**: Small, focused interfaces
- **Repository Pattern**: Data access abstraction
- **Service Layer**: Business logic encapsulation
- **Middleware Pattern**: Cross-cutting concerns
## ๐งช Development
### Code Quality
This project maintains high code quality standards:
- **Linting**: golangci-lint with 14 active linters
- **Formatting**: gofmt with simplification
- **Error Handling**: Comprehensive error checking
- **Documentation**: Clean, self-documenting code
- **Testing**: Unit and integration tests
### Running Tests
```bash
# Run all tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Run linter
golangci-lint run
# Format code
go fmt ./...
```
### Building
```bash
# Build all binaries
make build
# Build server only
make build-server
# Build client only
make build-client
# Clean build artifacts
make clean
```
## ๐ Deployment
### Docker
```bash
# Build Docker image
docker build -t jcloud .
# Run container
docker run -p 8080:8080 jcloud
```
### Railway
```bash
# Deploy to Railway
railway login
railway link
railway up
```
### Manual Deployment
```bash
# Build for production
CGO_ENABLED=1 GOOS=linux go build -o jcloud-server cmd/server/main.go
# Run with production config
./jcloud-server
```
## ๐ Performance
- **Concurrent Requests**: Handles 1000+ concurrent users
- **File Upload**: Supports files up to 100MB
- **Database**: SQLite3 with connection pooling
- **Memory Usage**: Optimized for low memory footprint
- **Response Time**: Sub-100ms API responses
## ๐ Security
- **Authentication**: Session-based with secure cookies
- **Authorization**: Role-based access control
- **Input Validation**: Comprehensive request validation
- **SQL Injection**: Parameterized queries
- **XSS Protection**: Input sanitization
- **CSRF Protection**: Token-based protection
## ๐ค Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
### Development Guidelines
- Follow Go best practices
- Write comprehensive tests
- Update documentation
- Ensure all linters pass
- Use conventional commit messages
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
- [Gorilla Mux](https://github.com/gorilla/mux) - HTTP router
- [Cobra](https://github.com/spf13/cobra) - CLI framework
- [SQLx](https://github.com/jmoiron/sqlx) - SQL toolkit
- [Egui](https://github.com/emilk/egui) - Rust GUI framework
---
**Made with โค๏ธ by the JCloud Team**
[โญ Star this repo](https://github.com/JIIL07/jcloud) โข [๐ Report Bug](https://github.com/JIIL07/jcloud/issues) โข [๐ก Request Feature](https://github.com/JIIL07/jcloud/issues)