Skip to content

Zero-knowledge encrypted code sharing platform. Share code snippets securely with client-side encryption, self-expiring pastes, and one-time views. Built with Next.js and Cloudflare Workers.

License

Notifications You must be signed in to change notification settings

nullcoder/ghostpaste

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

85 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GhostPaste Logo

GhostPaste

Zero-knowledge encrypted code sharing platform where your secrets stay secret

License: MIT Built with Next.js Deployed on Cloudflare

Live Demo β€’ Report Bug β€’ Request Feature


πŸ” What is GhostPaste?

GhostPaste is a privacy-focused code sharing platform that ensures your code snippets remain completely private through client-side encryption. Unlike traditional code sharing services, our servers never have access to your plaintext content - everything is encrypted in your browser before being uploaded.

✨ Key Features

  • πŸ”’ Zero-Knowledge Encryption - Your code is encrypted locally using AES-GCM before leaving your browser
  • πŸ‘€ No Account Required - Share code instantly without signing up
  • ✏️ Password-Protected Editing - Set a password to allow editing your snippets later
  • πŸ“ Multi-File Support - Share multiple files in a single gist
  • 🎨 Syntax Highlighting - Beautiful code display with CodeMirror 6
  • πŸ“‹ One-Click Copy - Copy code or share links instantly
  • πŸŒ“ Dark/Light Mode - Easy on the eyes, day or night
  • ⌨️ Keyboard Shortcuts - Power user friendly with full keyboard support
  • πŸ“± Responsive Design - Works perfectly on all devices
  • πŸš€ Global Edge Deployment - Fast access from anywhere in the world

βœ… Available Features

  • ⏱️ Self-Expiring Content - Set snippets to auto-delete after a specified time
  • πŸ‘οΈ One-Time View - Create snippets that disappear after being viewed once
  • πŸ“ Version History - Track changes with automatic versioning (storage ready)

🚧 Coming Soon

  • ✏️ Edit Existing Gists - Edit your gists with password protection
  • πŸ” Advanced Search - Search within your gists and filter by language

πŸš€ Quick Start

Sharing Code

  1. Visit ghostpaste.dev
  2. Paste or write your code
  3. Add multiple files if needed (click "Add File")
  4. Set an optional password for editing
  5. Click "Create Gist" and share the generated link

Viewing Shared Code

Simply open the shared link - the decryption key is in the URL fragment (#key=...) and never sent to our servers.

Keyboard Shortcuts

  • Cmd/Ctrl + Enter - Add new file (in editor)
  • Cmd/Ctrl + Enter - Create gist (on create page)
  • Cmd/Ctrl + ? - Show all shortcuts
  • Escape - Close dialogs

πŸ›‘οΈ Security & Privacy

  • Client-Side Encryption: All encryption/decryption happens in your browser using the Web Crypto API
  • Zero-Knowledge: Servers only store encrypted blobs - we can't read your content even if we wanted to
  • No Tracking: No analytics, no cookies, no user tracking
  • Bot Protection: Optional Cloudflare Turnstile integration for spam prevention
  • Open Source: Verify our security claims by reviewing the code

πŸ› οΈ Technical Stack

  • Framework: Next.js 15 with React 19
  • Runtime: Cloudflare Workers (Edge)
  • UI Components: shadcn/ui with Radix UI
  • Code Editor: CodeMirror 6
  • Encryption: Web Crypto API (AES-GCM)
  • Storage: Cloudflare R2 with versioning
  • Styling: Tailwind CSS with CSS variables
  • Testing: Vitest with React Testing Library

πŸ“Š Limits

Resource Limit Why?
File size 500 KB Covers 99% of code files
Total size 5 MB Enough for ~10-20 typical files
Files per gist 20 Keeps the UI responsive
Versions kept 50 Balances history with storage

πŸ“ Project Structure

ghostpaste/
β”œβ”€β”€ app/                    # Next.js app router
β”‚   β”œβ”€β”€ api/                # API routes
β”‚   β”œβ”€β”€ create/             # Gist creation page
β”‚   β”œβ”€β”€ g/[id]/             # Gist viewing page
β”‚   └── demo/               # Component demos
β”œβ”€β”€ components/             # React components
β”‚   β”œβ”€β”€ ui/                 # Reusable UI components
β”‚   └── *.tsx               # Feature components
β”œβ”€β”€ lib/                    # Core utilities
β”‚   β”œβ”€β”€ storage.ts          # R2 storage client
β”‚   β”œβ”€β”€ crypto.ts           # Encryption utilities
β”‚   β”œβ”€β”€ binary.ts           # Binary encoding
β”‚   └── ...                 # Other utilities
β”œβ”€β”€ types/                  # TypeScript types
β”œβ”€β”€ docs/                   # Documentation
└── public/                 # Static assets

πŸ”§ Development

Prerequisites

  • Node.js 20+
  • npm or yarn
  • Git

Quick Start

# Clone the repository
git clone https://github.com/nullcoder/ghostpaste.git
cd ghostpaste

# Install dependencies
npm install

# Start development server
npm run dev             # Next.js development (hot reload)
# OR
npm run preview         # Full Cloudflare Workers simulation

See our Local Development Guide for detailed setup instructions.

Configuration

Create a wrangler.toml file:

name = "ghostpaste"
compatibility_date = "2024-12-01"

[[r2_buckets]]
binding = "GHOSTPASTE_BUCKET"
bucket_name = "ghostpaste-bucket"

[vars]
NEXT_PUBLIC_APP_URL = "https://ghostpaste.dev"

For environment variables:

Build-time variables (.env or .env.production):

# Only NEXT_PUBLIC_* variables - these are embedded in the client bundle
NEXT_PUBLIC_TURNSTILE_SITE_KEY=your_public_site_key

Runtime secrets (.dev.vars for local, wrangler secret put for production):

# Never put these in .env files!
TURNSTILE_SECRET_KEY=your_secret_key

⚠️ Important: Never put secrets in .env or .env.production files as they become part of the client bundle!

Deployment

# Build for Cloudflare Workers
npm run build

# Deploy to production
npm run deploy

πŸ“ˆ Development Status

GhostPaste is actively being developed. Here's what's completed and what's in progress:

βœ… Completed (Phase 1-5)

  • Core Infrastructure: Encryption/decryption system, binary format, authentication
  • UI Components: 100% of components complete (19/19) with comprehensive testing
  • API Implementation: Complete CRUD operations for gists and blobs
  • Create Gist Flow: Full end-to-end gist creation with encryption and sharing
  • View Gist Flow: Complete gist viewing with decryption and syntax highlighting
  • Multi-file Support: Add, remove, and manage up to 20 files per gist
  • Security Features: Password protection, expiry settings, one-time view
  • Modern UI: Responsive design, dark/light mode, keyboard shortcuts
  • Developer Experience: Comprehensive documentation, testing, and tooling

🚧 In Progress (Phase 6)

  • Gist Editing: Edit existing gists with password validation
  • File Management: Enhanced file operations and reordering
  • Performance: Loading states and error handling improvements

πŸ“… Upcoming

  • Version History: View and restore previous versions
  • Advanced Features: Search, themes, keyboard navigation
  • Polish: Animations, PWA support, print/export

πŸ“– Documentation

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for detailed information on how to contribute to this project.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: 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 - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ€– Built with Claude Code

GhostPaste is a testament to the power of AI-assisted development. This entire project was built through a collaborative dialogue between human creativity and Claude's technical expertise. From architecture decisions to implementation details, every line of code emerged from thoughtful conversation.

The Collaboration Story

What started as an idea for a privacy-focused code sharing platform evolved through hundreds of interactions with Claude Code. Together, we:

  • Architected a zero-knowledge encryption system that keeps data private
  • Designed a clean, intuitive UI using modern React patterns
  • Implemented edge-compatible code for global performance
  • Solved complex challenges like versioning and binary encoding
  • Refined the user experience through iterative improvements

This project demonstrates that AI can be more than just a coding assistant - it can be a true development partner that helps bring ideas to life while maintaining high standards for security, performance, and user experience.

Key Achievements

  • 100% AI-Paired Development: Every component built through human-AI collaboration
  • Production-Ready Code: Comprehensive testing, error handling, and documentation
  • Security-First Design: Encryption implementation guided by best practices
  • Modern Architecture: Leveraging cutting-edge web technologies

A collaborative creation
Built through the synergy of human vision and AI capability
Powered by Claude Code + Human Creativity

Visit GhostPaste β€’ Report Bug β€’ Request Feature


GhostPaste
Share code. Keep secrets. Stay ghosted. πŸ‘»

About

Zero-knowledge encrypted code sharing platform. Share code snippets securely with client-side encryption, self-expiring pastes, and one-time views. Built with Next.js and Cloudflare Workers.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages