Hastebin Pastebin
Simple pastebin alternative for sharing code snippets.
Overview
Hastebin is a minimalist, open-source pastebin service originally created by John Crepezzi that focuses on speed and simplicity for sharing code snippets and text. Unlike traditional pastebins that require forms and captchas, Hastebin provides an elegant interface where users can paste content directly and immediately receive a shareable URL, making it ideal for quick code sharing during development or debugging sessions. This implementation uses Redis as the backend storage engine, providing fast in-memory data access and built-in expiration capabilities that automatically clean up old pastes after 30 days. The combination of Haste Server and Redis creates a high-performance pastebin solution that can handle thousands of paste operations per second while maintaining data persistence through Redis's RDB snapshots. This stack is perfect for development teams, educational institutions, and organizations that need a private, self-hosted alternative to public pastebin services with complete control over data retention and access policies.
Key Features
- Lightning-fast paste creation with immediate URL generation via Haste Server's streamlined interface
- Automatic syntax highlighting for 150+ programming languages including JavaScript, Python, Go, and Rust
- Built-in keyboard shortcuts (Ctrl+S to save, Ctrl+N for new paste) for rapid workflow integration
- Redis-powered automatic paste expiration after 30 days to prevent storage bloat
- RESTful API support for programmatic paste creation and retrieval
- Command-line integration allowing direct piping of files and command output
- Raw text viewing mode for easy copy-paste operations without formatting
- Duplicate paste detection through Redis key management to optimize storage
Common Use Cases
- 1Development teams sharing code snippets during pair programming and code reviews
- 2Educational environments where instructors need to quickly share code examples with students
- 3Internal corporate pastebin for sharing configuration files and scripts without external dependencies
- 4DevOps teams sharing deployment scripts and configuration snippets during incident response
- 5Open source projects providing a branded pastebin for community code sharing
- 6Homelab enthusiasts running a personal pastebin for cross-device text and code synchronization
- 7Organizations requiring GDPR compliance with full control over paste data storage and retention
Prerequisites
- Docker and Docker Compose installed with at least 1GB available RAM for Redis operations
- Port 7777 available for the Haste Server web interface and API access
- Basic understanding of Redis data structures for troubleshooting storage issues
- Approximately 512MB RAM allocated for Redis to handle concurrent paste operations effectively
- Network access configured if planning to use the CLI haste-client tool from remote machines
- Understanding of paste expiration policies to communicate data retention to users
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 hastebin: 3 image: ghcr.io/toptal/haste-server:latest4 container_name: hastebin5 environment: 6 - STORAGE_TYPE=redis7 - STORAGE_HOST=redis8 - STORAGE_PORT=63799 - STORAGE_EXPIRE_SECONDS=259200010 ports: 11 - "7777:7777"12 depends_on: 13 - redis14 networks: 15 - hastebin-network16 restart: unless-stopped1718 redis: 19 image: redis:7-alpine20 container_name: hastebin-redis21 volumes: 22 - redis-data:/data23 networks: 24 - hastebin-network25 restart: unless-stopped2627volumes: 28 redis-data: 2930networks: 31 hastebin-network: 32 driver: bridge.env Template
.env
1# Hastebin2# Default expiration: 30 daysUsage Notes
- 1Web UI at http://localhost:7777
- 2Paste code and get shareable link
- 3Keyboard shortcuts available
- 4Syntax highlighting
- 5CLI tool: cat file | haste
Individual Services(2 services)
Copy individual services to mix and match with your existing compose files.
hastebin
hastebin:
image: ghcr.io/toptal/haste-server:latest
container_name: hastebin
environment:
- STORAGE_TYPE=redis
- STORAGE_HOST=redis
- STORAGE_PORT=6379
- STORAGE_EXPIRE_SECONDS=2592000
ports:
- "7777:7777"
depends_on:
- redis
networks:
- hastebin-network
restart: unless-stopped
redis
redis:
image: redis:7-alpine
container_name: hastebin-redis
volumes:
- redis-data:/data
networks:
- hastebin-network
restart: unless-stopped
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 hastebin:5 image: ghcr.io/toptal/haste-server:latest6 container_name: hastebin7 environment:8 - STORAGE_TYPE=redis9 - STORAGE_HOST=redis10 - STORAGE_PORT=637911 - STORAGE_EXPIRE_SECONDS=259200012 ports:13 - "7777:7777"14 depends_on:15 - redis16 networks:17 - hastebin-network18 restart: unless-stopped1920 redis:21 image: redis:7-alpine22 container_name: hastebin-redis23 volumes:24 - redis-data:/data25 networks:26 - hastebin-network27 restart: unless-stopped2829volumes:30 redis-data:3132networks:33 hastebin-network:34 driver: bridge35EOF3637# 2. Create the .env file38cat > .env << 'EOF'39# Hastebin40# Default expiration: 30 days41EOF4243# 3. Start the services44docker compose up -d4546# 4. View logs47docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/hastebin-pastebin/run | bashTroubleshooting
- Pastes not saving or returning 500 errors: Check Redis container logs for memory issues and ensure STORAGE_HOST environment variable matches the Redis service name
- Syntax highlighting not working for specific languages: Verify the paste content has proper file extensions or language hints, as Haste Server relies on content analysis for highlighting
- CLI haste command timing out: Ensure the haste-client is configured with the correct server URL and that port 7777 is accessible from the client machine
- Redis data persistence lost after container restart: Verify the redis-data volume is properly mounted and Redis has write permissions to /data directory
- High memory usage in Redis container: Monitor paste creation rate and consider reducing STORAGE_EXPIRE_SECONDS or implementing Redis maxmemory policies for automatic eviction
- Pastes expiring too quickly or not expiring: Verify STORAGE_EXPIRE_SECONDS is set correctly (2592000 = 30 days) and Redis is processing TTL commands properly
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
hastebinredis
Tags
#pastebin#hastebin#code-sharing#snippets
Category
Productivity & CollaborationAd Space
Shortcuts: C CopyF FavoriteD Download