Skip to content

gpbot-org/Dustbin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ—‘๏ธ Dustbin - Advanced Pastebin Platform

A modern, feature-rich pastebin platform with AI-powered assistance, syntax highlighting, and comprehensive API support.

โœจ Features

  • ๐ŸŽจ Syntax Highlighting - Support for 99+ programming languages
  • ๐Ÿค– AI Assistant - Language detection, code explanation, and completion
  • ๐Ÿ“ Live Preview - Markdown, HTML, and SVG preview functionality
  • ๐Ÿ”— REST API - Complete API system with comprehensive documentation
  • โฐ Paste Expiration - Set automatic deletion times (10 minutes to 1 month)
  • ๐Ÿ”’ Privacy Controls - Public and private pastes
  • ๐Ÿ‘ค User Accounts - Registration, login, and paste history
  • ๐Ÿ” Search - Find public pastes by title or content
  • ๐Ÿ“ฑ Mobile Friendly - Responsive design works on all devices
  • ๐Ÿด Fork Pastes - Create copies of existing pastes
  • ๐Ÿ“Š Statistics - View counts and user stats
  • ๐Ÿ“ฅ Download - Save pastes as files
  • ๐Ÿš€ Unlimited Creation - No rate limiting restrictions

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8+
  • pip (Python package manager)

Installation

  1. Clone the repository

    git clone https://github.com/gpbot-org/Dustbin.git
    cd Dustbin
  2. Create virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Initialize database

    python create_db.py
  5. Run the application

    python app.py
  6. Access the application

๐Ÿค– AI Features Setup (Optional)

To enable full AI features (code completion, enhanced language detection):

  1. Get Hugging Face API Token

  2. Set Environment Variable

    export HUGGINGFACE_API_TOKEN=your_token_here
  3. Restart the application

    python app.py

๐Ÿ“ Project Structure

Dustbin/
โ”œโ”€โ”€ ๐Ÿ“„ app.py                 # Main Flask application
โ”œโ”€โ”€ ๐Ÿค– ai_helper.py          # AI integration module
โ”œโ”€โ”€ ๐Ÿ—„๏ธ create_db.py          # Database initialization
โ”œโ”€โ”€ ๐Ÿ“‹ requirements.txt      # Python dependencies
โ”œโ”€โ”€ ๐ŸŽจ static/               # CSS, JS, and assets
โ”œโ”€โ”€ ๐Ÿ“„ templates/            # HTML templates
โ”œโ”€โ”€ ๐Ÿ”ง highlight/            # Language configurations
โ”œโ”€โ”€ ๐Ÿ“š docs/                 # Documentation files
โ”‚   โ”œโ”€โ”€ README.md
โ”‚   โ”œโ”€โ”€ API_SYSTEM.md
โ”‚   โ”œโ”€โ”€ FEATURES_IMPLEMENTED.md
โ”‚   โ””โ”€โ”€ PREVIEW_FEATURES.md
โ””โ”€โ”€ ๐Ÿงช tests/               # Test suite
    โ”œโ”€โ”€ test_all_apis.py    # Comprehensive API tests
    โ”œโ”€โ”€ test_ai_features.py # AI functionality tests
    โ”œโ”€โ”€ test_preview.py     # Preview feature tests
    โ”œโ”€โ”€ run_tests.py        # Test runner
    โ””โ”€โ”€ ...

๐Ÿ”— API Usage

Quick Examples

Create a paste:

curl -X POST http://127.0.0.1:5000/api/v1/pastes \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Hello World",
    "content": "print(\"Hello from API!\")",
    "language": "python",
    "is_public": true
  }'

Get paste content:

curl http://127.0.0.1:5000/api/v1/pastes/abc123

AI language detection:

curl -X POST http://127.0.0.1:5000/api/ai/detect-language \
  -H "Content-Type: application/json" \
  -d '{"code": "function hello() { console.log(\"Hi!\"); }"}'

Complete API documentation: http://127.0.0.1:5000/docs

๐Ÿงช Testing

Run All Tests

cd tests
python run_tests.py

Run Specific Tests

# API functionality
python tests/test_all_apis.py

# AI features
python tests/test_ai_features.py

# Preview functionality
python tests/test_preview.py

Test Results

  • Overall Success Rate: 85.7% (6/7 test files passing)
  • API Tests: 88.2% success rate (15/17 tests)
  • Core API: 100% success rate (7/7 tests)
  • AI Features: 85.7% success rate (6/7 tests)
  • Preview Features: 100% success rate (all formats working)

๐Ÿ“š Documentation

  • API Documentation: /docs - Interactive API reference
  • Feature Guide: docs/FEATURES_IMPLEMENTED.md
  • Preview Guide: docs/PREVIEW_FEATURES.md
  • API System: docs/API_SYSTEM.md

๐Ÿ› ๏ธ Development

Adding New Languages

  1. Edit highlight/languages.json
  2. Add language configuration with Pygments lexer
  3. Restart the application

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests: python tests/run_tests.py
  5. Submit a pull request

๐Ÿ”ง Configuration

Environment Variables

  • HUGGINGFACE_API_TOKEN - Enable full AI features
  • SECRET_KEY - Flask secret key (auto-generated if not set)
  • DATABASE_URL - Database connection string (defaults to SQLite)

Features Toggle

  • Rate Limiting: Removed for better UX
  • AI Features: Work with/without API token
  • Preview: Automatic for Markdown, HTML, SVG
  • Authentication: Optional for most features

๐ŸŽฏ Use Cases

  • Developers: Code sharing with syntax highlighting and AI assistance
  • Teams: Collaborative code review and sharing
  • Education: Teaching with live code examples and explanations
  • Documentation: Markdown preview for README files and docs
  • Prototyping: Quick HTML/CSS/SVG testing and sharing

๐Ÿ”ฎ Roadmap

  • API key authentication
  • Webhook support
  • Bulk operations
  • Advanced search with filters
  • Official SDKs (Python, JavaScript, Go)
  • Real-time collaborative editing
  • More AI models integration

๐Ÿ“„ License

This project is open source. See the repository for license details.

๐Ÿค Support

  • Issues: GitHub Issues
  • Documentation: /docs endpoint
  • API Help: Interactive docs at /docs

Built with โค๏ธ for the developer community

About

A modern, feature-rich pastebin service built with Python Flask. Share code snippets, logs, and text with syntax highlighting, expiration options, and user accounts.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors