A light, blazingly fast, and security-focused Pastebin microservice engineered in C++17, powered by Crow, Asio, and SQLite3. Features Zero-Knowledge Client-Side AES-256 Encryption, Prism.js Syntax Highlighting, π₯ Burn After Reading, and a sleek Slate Glassmorphism UI.
Containerized with Docker and deployed on Render.
π Live Application: https://pastevault-tbl1.onrender.com/
- π Client-Side Zero-Knowledge Encryption: Optional password protection uses AES-256 (CryptoJS) directly in the browser. Text is encrypted before leaving the clientβthe C++ backend and SQLite database store only scrambled ciphertext and never see plaintext or passwords.
- β‘ Automatic Prism.js Syntax Highlighting: Dynamic language detection and syntax highlighting for C++, Python, JavaScript, HTML, SQL, CSS, and more with Prism.js dark themes.
- π₯ "Burn After Reading" One-Time Pastes: Optional single-view pastes that automatically self-destruct and purge permanently from SQLite the instant they are retrieved.
- π Top-Down Toast Notifications & Quick Actions: Modern floating toast popup on creation with direct share-link copying and a 1-click "Copy Content" button for viewers.
- π Slate Glassmorphism UI: Modern developer-focused design inspired by Vercel and Linear, complete with ambient background glows, responsive layouts, and custom scrollbars.
- RESTful C++ Backend: Structured routing supporting
POST(create),GET(retrieve), andDELETE(explicit deletion) with JSON request/response payloads. - SQLite Persistence: Thread-safe C++ database wrapper using parameterized prepared statements to prevent SQL injection.
- Auto-Expiration Handling: Flexible TTL (Time-To-Live) support (5 minutes, 1 hour, 1 day, or permanent) with automatic expiration checks and database cleanup.
- Dynamic Base62 ID Generator: Short 7-character unique identifier generation using C++
<random>(std::mt19937). - Automated Cloud Pipeline: Containerized multi-stage Docker build pipeline deployed to Render with zero-downtime auto-deploys via GitHub webhooks.
- Language: C++17
- HTTP Framework: Crow Framework (built on Asio)
- Database: SQLite3
- Build System: CMake 3.14+ (using
FetchContentfor automated dependency management)
- UI & Styling: HTML5, Modern CSS3 (CSS Variables, Backdrop Filters, Glassmorphism, Custom Scrollbars)
- Encryption: CryptoJS (AES-256 Client-Side)
- Code Highlighting: Prism.js (Core + Autoloader)
- Scripting: Vanilla JavaScript (ES6+
async/awaitwithfetch&Clipboard API)
- Containerization: Multi-stage Docker
- Hosting: Render Cloud Platform
PasteVault/
βββ CMakeLists.txt # Root build configuration
βββ Dockerfile # Multi-stage container build spec
βββ pastevault.db # SQLite persistent storage (auto-generated)
βββ include/ # Header includes
βββ src/
β βββ main.cpp # Server entry point & static file routing
β βββ database/
β β βββ DatabaseManager.hpp
β β βββ DatabaseManager.cpp # SQLite C++ wrapper, migration & prepared statements
β βββ handlers/
β β βββ PasteHandler.hpp
β β βββ PasteHandler.cpp # ID generation, TTL/Burn logic & JSON handling
β βββ routes/
β βββ Router.hpp # Crow REST API endpoints definition
βββ public/
βββ index.html # Single-page UI layout & Toast containers
βββ style.css # Glassmorphism dark slate styling & Prism overrides
βββ app.js # Client routing, AES encryption/decryption & clipboard actions
POST /api/paste{
"content": "Hello world from PasteVault!",
"ttl_minutes": 60,
"is_encrypted": false,
"burn_after_reading": false
}{
"content": "U2FsdGVkX1+x9b...",
"ttl_minutes": -1,
"is_encrypted": true,
"burn_after_reading": true
}Note: Set
ttl_minutesto-1for permanent or burn-after-reading pastes.
{
"id": "RCOtjlQ",
"is_encrypted": true,
"burn_after_reading": true,
"created_at": 1784874104,
"expires_at": -1
}GET /api/paste/<paste_id>{
"id": "RCOtjlQ",
"content": "U2FsdGVkX1+x9b...",
"is_encrypted": true,
"burn_after_reading": true,
"created_at": 1784874104,
"expires_at": -1
}Note: If
burn_after_readingistrue, this request returns the payload and deletes the row from SQLite immediately.
DELETE /api/paste/<paste_id>{
"message": "Paste deleted successfully"
}- GCC / G++ (supporting C++17)
- CMake (v3.14+)
- SQLite3 library installed locally
git clone https://github.com/<YOUR_USERNAME>/PasteVault.git
cd PasteVaultmkdir build && cd build
cmake ..make # Linux/Mac
# OR
mingw32-make # Windows MinGW# Run from project root so static public files load correctly
cd ..
./build/pastevaultOpen http://localhost:18080/ in your web browser.
Build and run locally using Docker:
docker build -t pastevault .
docker run -p 18080:18080 pastevaultDistributed under the MIT License. See LICENSE for more information.