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

Packages

 
 
 

Contributors

Languages