Sharing code snippets, configuration files, or sensitive information online shouldn’t mean surrendering your privacy to third-party services. While public pastebin services like Pastebin.com or GitHub Gists are convenient, they come with privacy concerns: your data is stored on someone else’s servers, potentially analyzed, logged, or even sold.
Self-hosting your own pastebin gives you complete control over your data, ensures end-to-end encryption, and provides a reliable way to share text securely with colleagues, friends, or your team. In this comprehensive guide, we’ll compare the two leading self-hosted pastebin solutions in 2026 — PrivateBin and Hemmelig — and walk you through setting up both on Docker.
Why Self-Host a Pastebin?
Before diving into the technical details, let’s explore why you’d want to run your own pastebin service:
Privacy and Data Ownership: When you self-host, your sensitive code snippets, API keys, logs, and configuration files never leave your infrastructure. You control who has access and for how long.
End-to-End Encryption: Both PrivateBin and Hemmelig encrypt content in the browser before it’s sent to the server. This means even you, as the server administrator, cannot read the content without the decryption key.
No Ads or Tracking: Public pastebin services often inject ads, track users, or require registration. Your self-hosted solution is clean, fast, and respects user privacy.
Custom Retention Policies: Define your own expiration rules. Keep pastes for 5 minutes, a day, or forever — it’s your choice.
Team Collaboration: Provide your team or community with a trusted, private platform for sharing snippets without relying on external services.
PrivateBin vs Hemmelig: Feature Comparison
Let’s break down the key differences between these two popular self-hosted pastebin solutions.
PrivateBin
PrivateBin is the most mature and widely-used self-hosted pastebin. It’s a minimalist, zero-knowledge paste service where the server has no knowledge of the pasted data.
Key Features:
- Zero-knowledge encryption: All data is encrypted/decrypted in the browser using AES-256
- Burn after reading: Pastes can self-destruct after being read once
- Syntax highlighting: Supports dozens of programming languages
- File attachments: Upload and share encrypted files
- Password protection: Add an extra layer of security with passwords
- Configurable expiration: 5 minutes to never
- Discussion threads: Enable comments on pastes (also encrypted)
- QR code generation: Easy mobile sharing
- Lightweight: Runs on minimal resources
- Multiple storage backends: Filesystem, database, S3, Google Cloud Storage
Technology Stack:
- Written in PHP
- No database required (filesystem backend by default)
- Works with SQLite, MySQL, PostgreSQL for larger deployments
- Simple, battle-tested codebase
Best For:
- Users who prioritize stability and maturity
- Minimal resource consumption
- Simple deployment with no database requirements
- Organizations needing proven, audited encryption
Hemmelig
Hemmelig (Norwegian for “secret”) is a newer, modern take on the pastebin concept with a sleek UI and some unique features.
Key Features:
- End-to-end encryption: AES-256-GCM encryption in the browser
- Modern, intuitive UI: Clean, responsive design with dark mode
- User accounts: Optional registration for managing pastes
- Burn after reading: One-time view option
- Password protection: Additional security layer
- Configurable expiration: Flexible retention policies
- File uploads: Share encrypted files alongside text
- QR codes: Mobile-friendly sharing
- Admin dashboard: Manage users and monitor usage
- Markdown support: Rich text rendering
- Public/private pastes: Choose visibility per paste
Technology Stack:
- Built with Node.js and React
- Requires PostgreSQL database
- Modern JavaScript ecosystem
- Active development with frequent updates
Best For:
- Teams needing user account management
- Users who prefer modern, polished interfaces
- Organizations wanting granular admin controls
- Projects already running Node.js infrastructure
Performance and Resource Usage
PrivateBin is incredibly lightweight. A typical Docker deployment uses:
- RAM: ~50-100 MB
- CPU: Minimal (mostly idle)
- Storage: Only the pastes themselves (configurable limits)
- Database: Optional (can run filesystem-only)
Hemmelig requires more resources due to its modern stack:
- RAM: ~150-300 MB (Node.js + PostgreSQL)
- CPU: Low to moderate
- Storage: Pastes + PostgreSQL database
- Database: PostgreSQL required
For small homelabs or resource-constrained environments, PrivateBin has the clear advantage. If you’re already running PostgreSQL and Node.js services, Hemmelig integrates seamlessly.
Security and Encryption
Both solutions implement zero-knowledge encryption, meaning:
- Content is encrypted in the user’s browser before transmission
- The server stores only encrypted data
- The decryption key is in the URL fragment (never sent to the server)
- Even the server administrator cannot read paste content
PrivateBin has undergone multiple security audits and has a longer track record. Its encryption implementation is well-documented and peer-reviewed.
Hemmelig uses modern cryptographic standards (AES-256-GCM) and follows best practices, but being newer, it has less battle-testing in production environments.
Verdict: Both are secure for most use cases. PrivateBin gets the edge for organizations requiring audited, proven encryption.
How to Set Up PrivateBin on Docker
Let’s deploy PrivateBin using Docker Compose. This setup uses the filesystem backend (no database required).
Prerequisites
- Docker and Docker Compose installed
- A domain or subdomain (e.g.,
paste.yourdomain.com) - A reverse proxy (we’ll use Traefik in this example)
Docker Compose Configuration
Create a directory for PrivateBin:
| |
Create a docker-compose.yml file:
| |
Create Configuration File
PrivateBin uses a PHP configuration file. Create config/conf.php:
| |
Create config/conf.php:
| |
Deploy PrivateBin
| |
Access PrivateBin at https://paste.yourdomain.com. That’s it! You now have a secure, self-hosted pastebin running.
Optional: Database Backend
For higher traffic or better performance, you can use a database. Here’s how to switch to PostgreSQL:
Update docker-compose.yml to add PostgreSQL:
| |
Update config/conf.php:
| |
How to Set Up Hemmelig on Docker
Hemmelig requires PostgreSQL, so our setup will include both services.
Docker Compose Configuration
Create a directory for Hemmelig:
| |
Create docker-compose.yml:
| |
Generate JWT Secret
Generate a secure JWT secret:
| |
Replace your_very_long_random_secret_key_here in the docker-compose.yml with the generated value.
Deploy Hemmelig
| |
Access Hemmelig at https://secret.yourdomain.com. The first time you visit, you can create an admin account.
Configuration Options
Hemmelig offers several environment variables for customization:
- DISABLE_USERS: Set to
trueto disable user registration (anonymous-only mode) - DISABLE_FILE_UPLOAD: Set to
trueto block file attachments - MAX_FILE_SIZE: Maximum upload size in bytes
- RATE_LIMIT: Requests per minute per IP
- ADMIN_EMAIL: Email for the default admin account
Which One Should You Choose?
Here’s a decision matrix to help you choose:
Choose PrivateBin if you:
- Want the lightest possible resource footprint
- Prefer proven, battle-tested software
- Don’t need user account management
- Want to run without a database
- Value simplicity and stability over modern UI
Choose Hemmelig if you:
- Need user accounts and team management
- Prefer modern, polished interfaces
- Already run PostgreSQL infrastructure
- Want an admin dashboard for monitoring
- Value active development and new features
Both are excellent choices, and you can’t go wrong with either. For most homelab users, PrivateBin is the safer, simpler bet. For teams or organizations, Hemmelig offers more management features.
Security Best Practices
Regardless of which solution you choose, follow these security best practices:
1. Use HTTPS Always
Never run a pastebin over plain HTTP. Encryption happens in the browser, but HTTP can still expose metadata and enable man-in-the-middle attacks.
Use Traefik, Caddy, or nginx with Let’s Encrypt certificates.
2. Set Appropriate Expiration Defaults
Configure sensible default expiration times. For most use cases, 1 week or 1 month is reasonable. Avoid “never” as a default to prevent indefinite storage of potentially sensitive data.
3. Limit File Upload Sizes
Both solutions allow file uploads. Limit the maximum size to prevent abuse and storage exhaustion:
- PrivateBin: Set
sizelimitinconf.php - Hemmelig: Set
MAX_FILE_SIZEenvironment variable
Recommended limits: 5-10 MB for most use cases.
4. Implement Rate Limiting
Protect against abuse with rate limiting:
- PrivateBin: Built-in traffic limiting in
conf.php - Hemmelig:
RATE_LIMITenvironment variable - Additional: Use your reverse proxy (Traefik, nginx) for IP-based rate limiting
5. Regular Backups
Back up your pastebin data regularly:
PrivateBin (filesystem):
| |
Hemmelig (PostgreSQL):
| |
Automate backups with cron or use solutions like Duplicati, Restic, or Borg for comprehensive backup strategies.
6. Monitor and Prune Old Pastes
Implement cleanup policies to remove expired pastes:
PrivateBin: Automatic purge based on expiration settings (no manual action needed)
Hemmelig: Built-in expiration handling
7. Disable Registration (If Not Needed)
If you’re running a personal pastebin or internal team tool, disable public registration:
- PrivateBin: No user accounts by design
- Hemmelig: Set
DISABLE_USERS=true
Integration and API Usage
Both solutions can be integrated into your workflows.
PrivateBin API
PrivateBin doesn’t have an official REST API, but the community has created CLI tools:
pbincli (Python):
| |
Hemmelig API
Hemmelig has a built-in REST API. Example using curl:
Create a secret:
| |
Retrieve a secret:
| |
Check Hemmelig’s documentation for the full API specification.
Maintenance and Updates
PrivateBin Updates
| |
PrivateBin is very stable and rarely requires manual intervention. Updates are typically security patches or minor feature additions.
Hemmelig Updates
| |
Hemmelig is more actively developed, so check the changelog before updating.
Automating Updates
Use Watchtower to automate Docker container updates:
| |
Troubleshooting Common Issues
PrivateBin: “Error: Paste does not exist”
Cause: The data directory isn’t writable or pastes expired.
Fix:
| |
Hemmelig: Database Connection Failed
Cause: PostgreSQL isn’t ready when Hemmelig starts.
Fix: Add a health check to docker-compose.yml:
| |
Both: CORS Errors
Cause: Reverse proxy misconfiguration.
Fix: Ensure your reverse proxy passes the correct headers:
Traefik: Add middleware for CORS if needed.
nginx:
| |
Hardware Recommendations
Both solutions run on minimal hardware. Here’s what you need:
Minimum:
- CPU: 1 core (any modern CPU)
- RAM: 512 MB (PrivateBin), 1 GB (Hemmelig)
- Storage: 5 GB (for the application + pastes)
Recommended:
- CPU: 2 cores
- RAM: 2 GB
- Storage: 20 GB SSD
Any modern mini PC or Raspberry Pi 4 will handle either solution effortlessly. If you’re building a full homelab, check out our guide on the best mini PCs for your homelab in 2026.
Final Thoughts
Self-hosting a pastebin is one of the simplest yet most useful additions to your homelab. Whether you choose PrivateBin for its battle-tested reliability and minimal footprint, or Hemmelig for its modern interface and team features, you’ll gain a private, secure way to share sensitive information.
Both solutions respect user privacy through zero-knowledge encryption, give you full control over your data, and cost nothing beyond your existing infrastructure.
Start with PrivateBin if you’re new to self-hosting or want something lightweight. Experiment with Hemmelig if you need user management or prefer modern UIs. Either way, you’re taking back control of your data — and that’s what self-hosting is all about.
Next Steps:
- Secure your self-hosted services with proper authentication
- Set up Authelia or Authentik for SSO across your homelab
- Implement backup strategies to protect your data
Have questions about self-hosting pastebin solutions? Drop a comment below or reach out on our community forum. Happy self-hosting!