jcloud

module
v0.0.0-...-bdb90e4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2025 License: MIT

README ΒΆ

πŸš€ JCloud - Modern Cloud File Storage System

Go Version License Code Quality Linter

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
# 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
# Start the server
./bin/server

# Server will be available at http://localhost:8080
Using the CLI Client
# 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)
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)
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
# Run all tests
go test ./...

# Run tests with coverage
go test -cover ./...

# Run linter
golangci-lint run

# Format code
go fmt ./...
Building
# Build all binaries
make build

# Build server only
make build-server

# Build client only
make build-client

# Clean build artifacts
make clean

πŸš€ Deployment

Docker
# Build Docker image
docker build -t jcloud .

# Run container
docker run -p 8080:8080 jcloud
Railway
# Deploy to Railway
railway login
railway link
railway up
Manual Deployment
# 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 file for details.

πŸ™ Acknowledgments


Made with ❀️ by the JCloud Team

⭐ Star this repo β€’ πŸ› Report Bug β€’ πŸ’‘ Request Feature

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL