Skip to content

YashSaini99/zk-share

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔐 ZKShare - Zero-Knowledge File Sharing Platform

A secure, privacy-focused file sharing platform with end-to-end encryption using zero-knowledge architecture. Deployed with Kubernetes and automated CI/CD.

🌟 Features

  • Zero-Knowledge Encryption: Files are encrypted client-side with RSA-OAEP-2048 and AES-256-GCM
  • Public Link Sharing: Share files via password-protected public links with download limits
  • Secure File Sharing: Share encrypted files with other users
  • Dark Mode: Persistent theme preference with light/dark mode toggle
  • Real-time Notifications: WebSocket-based notification system
  • Usage Tracking: Monitor storage usage and file statistics
  • Key Backup Management: Secure backup and recovery of encryption keys
  • Responsive UI: Modern, mobile-friendly interface built with React and Tailwind CSS
  • Kubernetes Deployment: Production-ready container orchestration
  • CI/CD Pipeline: Automated builds and deployments with GitHub Actions

🏗️ Architecture

Backend (Go Microservices)

  • API Gateway (Port 8000): Routes requests to appropriate services
  • Auth Service (Port 8001): User authentication and JWT management
  • File Service (Port 8002): File upload, download, and storage
  • Metadata Service (Port 8003): File metadata and sharing management
  • Subscription Service (Port 8004): User subscription management
  • Notification Service (Port 8005): Real-time notifications via WebSocket

Frontend (React)

  • React 19 with Vite
  • Tailwind CSS for styling
  • shadcn/ui component library
  • Client-side encryption with Web Crypto API
  • Dark mode with persistent localStorage

Database

  • MongoDB 7: Document storage for users, files, and metadata

🚀 Getting Started

Docker Compose (Quick Development)

  1. Clone the repository

    git clone https://github.com/yourusername/zkshare.git
    cd zkshare
  2. Set up environment variables

    cd zkshare-backend
    cp .env.example .env
    # Edit .env and set your JWT_SECRET
  3. Build and run with Docker Compose

    docker-compose up -d
  4. Access the application

Development Setup

For local development without Docker:

Backend:

cd zkshare-backend
go mod download
# Run individual services
go run cmd/api-gateway/main.go

Frontend:

cd zkshare-frontend
pnpm install
pnpm dev

📁 Project Structure

zkshare/
├── zkshare-backend/          # Go microservices
│   ├── cmd/                  # Service entry points
│   ├── internal/             # Business logic
│   ├── pkg/                  # Shared packages
│   ├── migrations/           # Database migrations
│   └── docker-compose.yml    # Docker orchestration
├── zkshare-frontend/         # React application
│   ├── src/
│   │   ├── components/       # React components
│   │   ├── contexts/         # React contexts
│   │   ├── lib/              # Utilities and API clients
│   │   └── config/           # Feature flags
│   └── public/               # Static assets
├── k8s/                      # Kubernetes manifests
│   ├── namespace.yaml
│   ├── auth/                 # Auth service deployment
│   ├── file/                 # File service deployment
│   ├── gateway/              # API gateway deployment
│   ├── frontend/             # Frontend deployment
│   ├── mongo/                # MongoDB deployment
│   └── secrets/              # Secret templates
├── infra/
│   └── kind/                 # Kind cluster config
└── .github/
    └── workflows/            # CI/CD pipelines
        ├── ci.yaml           # Build and push
        └── cd.yaml           # Deploy to Kind

🔒 Security Features

  • Client-Side Encryption: All files are encrypted in the browser before upload
  • Zero-Knowledge: Server never has access to unencrypted data or encryption keys
  • Secure Key Management: RSA key pairs generated and stored locally
  • JWT Authentication: Secure token-based authentication
  • CORS Protection: Configured CORS policies

🛠️ Technologies Used

Backend:

  • Go 1.23
  • MongoDB Driver
  • JWT-Go
  • Gorilla WebSocket
  • Gorilla Mux

Frontend:

  • React 19
  • Vite
  • Tailwind CSS
  • shadcn/ui
  • Lucide Icons
  • Web Crypto API

Infrastructure:

  • Docker & Docker Compose
  • Kubernetes (Kind for local, ready for cloud)
  • GitHub Actions (CI/CD)
  • GitHub Container Registry (GHCR)
  • Nginx (Frontend serving)
  • MongoDB 7

DevOps:

  • Container Orchestration (Kubernetes)
  • Infrastructure as Code (K8s YAML manifests)
  • Automated CI/CD pipelines
  • Multi-stage Docker builds
  • Secret management
  • Health checks & liveness probes

📝 API Documentation

Authentication

  • POST /auth/register - Register new user
  • POST /auth/login - User login
  • GET /auth/verify - Verify JWT token

Files

  • POST /files/upload - Upload encrypted file
  • GET /files/list - List user's files
  • GET /files/download/:id - Download file
  • DELETE /files/:id - Delete file

Public Sharing

  • POST /files/public-share - Create public share link
  • GET /files/public/:shareId - Get public share info
  • POST /files/public/:shareId/download - Download via public link (no auth)
  • GET /files/my-public-shares - List your public shares
  • DELETE /files/public-share/:shareId - Delete public share

Private Sharing

  • POST /metadata/share - Share file with user
  • GET /metadata/shared - Get files shared with user
  • DELETE /metadata/share/:id - Revoke file sharing

🎨 Feature Flags

Configure features in zkshare-frontend/src/config/features.js:

SUBSCRIPTIONS_ENABLED: false,  // Hide subscription features
USAGE_TRACKING_ENABLED: true   // Show usage statistics

🐛 Troubleshooting

Docker Compose

Services won't start:

docker-compose down
docker-compose up -d --build

MongoDB connection issues:

docker-compose logs mongo

Frontend build errors:

cd zkshare-frontend
pnpm install
docker-compose build frontend

🤝 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

📄 License

This project is licensed under the MIT License.

👨‍💻 Author

Yash

🙏 Acknowledgments

  • Zero-knowledge encryption inspired by modern privacy-focused applications
  • UI components from shadcn/ui
  • Icons from Lucide

About

A secure, privacy-focused file sharing platform with end-to-end encryption using zero-knowledge architecture.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages