Secure, shareable clipboard for teams and individuals.
- Overview
- Key Features
- Tech Stack
- Getting Started
- Configuration
- Usage Guide
- Contributing
- Community & Support
- License
ClipBin is a Flask-based web application for storing and sharing code snippets, configuration fragments, and other plaintext securely. It supports authenticated workflows for teams while also allowing anonymous users to create temporary clips with password protection.
- Dark theme interface for comfortable reading.
- Anonymous and authenticated clip creation flows.
- Optional password protection with end-to-end encryption.
- Expiring links with configurable retention periods.
- Custom aliases for easy-to-remember URLs.
- File upload support for vetted text-based formats.
- User dashboard with clip management and exports.
- REST-style API endpoints for automation.
- Python 3.10 or later
- pip 22+
- (Optional) Virtual environment tooling such as
venvorpipenv
Clone the repository and install dependencies:
git clone https://github.com/alight659/ClipBin
cd ClipBin
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txtStart the Flask application:
python3 app.pyBy default the server listens on http://127.0.0.1:5000. Enable debug mode locally by editing app.py and starting the app with app.run(debug=True).
| Variable | Description | Default |
|---|---|---|
SECRET_KEY |
Session encryption key used by Flask. Must be set in production. | None (Flask will raise if unset) |
MAX_CONTENT_LENGTH |
Maximum upload size for clips and files. | 1.5 MB |
Set environment variables in your shell before launching the app, for example:
export SECRET_KEY="change-me"The application stores data in clipbin.db, an SQLite database created on first run. Back up this file for persistence.
Or use the Makefile for easier development:
# Start development server
make dev
# Install dependencies
make install
# Run tests quickly
make test-fast
# View all available commands
make helpTo enable debugging mode, edit app.py
app.run(debug=True)This project includes a comprehensive test suite using pytest. The tests cover:
- Unit Tests: Individual function testing for utility modules
- Integration Tests: Complete workflow testing
- Database Tests: SQLite operations and data integrity
- Security Tests: XSS, SQL injection prevention
- API Tests: REST API endpoints
The easiest way to run tests is using the provided Makefile:
# View all available commands
make help
# Run all working tests (recommended)
make test-fast
# Run tests with coverage report
make test-coverage
# Run specific test categories
make test-unit # Unit tests only
make test-integration # Integration tests only
# Quick commands
make q # Quick test (alias for test-fast)
make qc # Quick test with coverageInstall test dependencies (already included in requirements.txt):
pip install -r requirements.txtRun all tests:
python -m pytestRun tests with coverage report:
python -m pytest --cov=. --cov-report=htmlRun specific test categories:
# Run only unit tests
python -m pytest tests/test_additional.py tests/test_sqlite.py
# Run integration tests
python -m pytest tests/test_integration.py
# Run with verbose output
python -m pytest -vUse the convenient test runner script:
# Run all tests with coverage
python run_tests.py
# Run fast tests without coverage
python run_tests.py --fast
# Generate HTML coverage report
python run_tests.py --html-report
# Run only unit tests
python run_tests.py --type unitThe project maintains high test coverage standards:
- Target Coverage: 90% minimum, 100% preferred
- Current Coverage:
additional.py: 100%sqlite.py: 100%app.py: Comprehensive route and functionality testing
View detailed coverage reports:
# Generate HTML report
python -m pytest --cov=. --cov-report=html
open htmlcov/index.html # View in browserTests are organized in the tests/ directory:
test_additional.py: Utility function teststest_sqlite.py: Database operation teststest_app.py: Flask application route teststest_integration.py: End-to-end workflow testsconftest.py: Test configuration and fixtures
- Visit the home page and create a clip by entering a title and body or uploading a supported file.
- Optionally set a password, mark the clip as editable, choose an expiration window, or supply a custom URL alias.
- Share the resulting link. A separate
/rawendpoint is available for plaintext retrieval, and/download/<id>exposes the content as a file. - Create an account to unlock the dashboard, manage existing clips, and export content as JSON, CSV, or plain text.
Contributions that improve documentation, add features, or streamline the user experience are welcome. To get started:
- Review the Contributing Guidelines and Code of Conduct.
- Fork the repository and create a feature branch referencing the related issue.
- Write clear commit messages and include tests or documentation updates when they apply.
- Open a pull request explaining the motivation and testing performed.
Need inspiration? Check the issue tracker for help wanted and good first issues.
Questions, bug reports, or feature ideas are encouraged. Reach the maintainers at [email protected] or open a GitHub issue.
ClipBin is released under the MIT License.