A lightweight, self-hosted web application for storing and sharing code snippets. Built with Go and designed for simplicity and ease of deployment.
CipherBin provides a clean, minimal interface for creating, viewing, and managing code snippets with automatic expiration. It features user authentication, session management, and a responsive design that works on all devices.
Live Demo: cipherbin.onrender.com
- Snippet Management - Create, view, and list code snippets with customizable expiration (1 day, 1 week, or 1 year)
- Author Attribution - Snippets display author names for authenticated users
- Auto-Linking - URLs in snippet content are automatically converted to clickable links
- User Authentication - Secure signup and login with bcrypt password hashing
- Account Management - User account section with password change functionality
- Session Management - Persistent sessions stored in PostgreSQL with automatic cleanup
- CSRF Protection - Built-in cross-site request forgery protection
- TLS Support - HTTPS enabled for secure connections
- Docker Ready - Full Docker and Docker Compose support for easy deployment
| Component | Technology |
|---|---|
| Backend | Go 1.24+ |
| Router | chi |
| Templates | templ |
| Database | PostgreSQL |
| Sessions | SCS with Postgresql store |
| Forms | go-playground/form |
CipherBin/
├── cmd/
│ └── web/ # Application entrypoint, handlers, routes, middleware
├── internal/
│ └── models/ # Database models and queries
├── ui/
│ ├── html/ # templ templates
│ └── static/ # CSS, JavaScript, images
├── setup.sql # Database schema
├── Dockerfile
└── docker-compose.yaml
- Go 1.24 or higher
- Postgres 8.0
- templ CLI (for template generation)
The easiest way to run CipherBin is with Docker Compose:
docker-compose up -dThis starts both the Postgres database and the web application. Access the app at http://localhost:8080.
To stop the services:
docker-compose down| Flag | Default | Description |
|---|---|---|
-addr |
:4000 |
HTTP server address |
-dsn |
- | Postgres data source name |
CipherBin uses three tables:
- snippets - Stores snippet content with title, creation date, and expiration
- users - User accounts with hashed passwords
- sessions - Session tokens for authenticated users
See setup.sql for the complete schema.
For development with hot reload, use Air:
airConfiguration is provided in .air.toml.
go test ./... Contributions are welcome. Please open an issue to discuss proposed changes before submitting a pull request.
This project is open source. See the repository for license details.