A lightweight and modern pastebin service built with FastAPI (Python) for the backend and Svelte for the frontend. Share code snippets, text, and more with ease.
- Simple and Clean Interface – Intuitive UI for quick paste creation and sharing
- Syntax Highlighting – Support for multiple programming languages
- Paste Expiration – Automatic cleanup of expired pastes
- Rate Limiting – Built-in protection with configurable limits and bypass tokens
- Caching Layer – LRU cache for improved performance
- Legacy Paste Support – Backward compatibility with older paste formats
- Health Monitoring – Built-in health check endpoint and storage monitoring
- Docker Ready – Easy deployment with Docker Compose
- Configurable Storage – Customizable file storage and size limits
- Trusted Hosts – IP-based access control
- Backend: FastAPI, SQLAlchemy, PostgreSQL, Alembic (migrations)
- Frontend: Svelte
- Deployment: Docker, Docker Compose
- Caching: LRU Memory Cache with configurable TTL
- Docker Engine
- Docker Compose (or
docker-composefor older versions)
Note: Depending on your Docker version, you may need to use
docker-composeinstead ofdocker compose
DevBin can be deployed in two ways:
-
Clone the repository
git clone <repository-url> cd DevBin
-
Configure environment variables
cp .env.example .env
Edit
.envand update the values according to your needs. Key configurations include:- Database credentials
- API port and host
- Rate limiting settings
- CORS domains
- Storage paths and limits
- Trusted hosts
-
Start the services
docker compose up -d
-
Run database migrations
docker compose run --rm app uv run alembic upgrade head
-
Access the application
- Frontend: http://localhost:3000
- API Documentation (Swagger): http://localhost:8000/docs
- Health Check: http://localhost:8000/health
For production deployment, you only need the production compose file and environment configuration:
-
Clone the repository
git clone <repository-url> cd DevBin
-
Configure environment variables
cp .env.example .env
Edit
.envwith production-ready values (strong passwords, proper domains, etc.) -
Start the services
docker compose -f docker-compose.prod.yml up -d
-
Run database migrations
docker compose -f docker-compose.prod.yml run --rm app uv run alembic upgrade head
Development:
docker compose downProduction:
docker compose -f docker-compose.prod.yml downKey environment variables in .env:
| Variable | Description | Default |
|---|---|---|
APP_PORT |
Backend API port | 8000 |
APP_MAX_CONTENT_LENGTH |
Maximum paste size | 10000 |
APP_WORKERS |
Number of worker processes | 1 |
APP_BYPASS_TOKEN |
Token to bypass rate limits | - |
APP_CACHE_TTL |
Cache time-to-live (seconds) | 300 |
APP_MIN_STORAGE_MB |
Minimum required storage (MB) | 1024 |
TRUSTED_HOSTS |
Array of trusted IP addresses/hostnames | ["127.0.0.1"] |
APP_CORS_DOMAINS |
Allowed CORS origins | ["http://localhost:3000"] |
See .env.example for a complete list of configuration options.
Set these variables in .env:
APP_DEBUG=true
APP_RELOAD=true
APP_SQLALCHEMY_ECHO=trueRun tests with:
cd backend
uv run pytestIf you modified any of the core API endpoints, make sure to run the tests to ensure they still work as expected. Or if you are committing breaking changes, please adjust them and add a note why this breaking change is necessary.
See Testing
GET /health– Health checkGET /pastes/{paste_id}– Retrieve a pasteGET /pastes/legacy/{paste_id}– Retrieve a legacy pastePOST /pastes– Create a new paste
Full API documentation available at /docs when running.
See Option 2: Production Setup in the Quick Start section above for deployment instructions.
Make sure to configure the following in your .env file:
- ✅ Set strong database credentials (
POSTGRES_USER,POSTGRES_PASSWORD) - ✅ Configure appropriate rate limits
- ✅ Set
APP_DEBUG=falseandAPP_RELOAD=false - ✅ Configure trusted hosts properly (
TRUSTED_HOSTS) - ✅ Set up proper CORS domains (
APP_CORS_DOMAINS) - ✅ Use a secure bypass token (
APP_BYPASS_TOKEN) - ✅ Configure minimum storage requirements (
APP_MIN_STORAGE_MB) - ✅ Set appropriate worker count (
APP_WORKERS)