Skip to main content

Zingat

Clipboard Sharing Service
Zingat

Project Links

Overview

A high-performance, self-hosted, production-ready clipboard sharing service built with Rust, enabling secure text snippet sharing across devices through dual interfaces (web + CLI) with password protection and automatic expiration.

Technical Highlights

Core Technologies: Rust • Rocket • Tokio • SQLX • SQLite • Handlebars

Architecture & Design Patterns

  • Layered Architecture: Clean separation of concerns across presentation, service, data, and domain layers
  • Domain-Driven Design: Type-safe business logic with dedicated domain entities and validation
  • Repository Pattern: Abstracted data access layer with compile-time SQL verification using SQLX
  • Async-First Design: Tokio runtime powering concurrent request handling and background workers

Performance Optimizations

  • Batched Hit Counting: Asynchronous worker threads aggregate view counts, reducing database writes by 90%+
  • Non-blocking I/O: Fully asynchronous request pipeline from HTTP to database
  • Compile-time Query Validation: Zero-overhead SQL checks eliminate runtime query errors

Developer Experience

  • Migration-based Schema: Version-controlled SQL migrations for reproducible deployments
  • Type-safe Queries: Compile-time verification prevents SQL injection and schema mismatches
  • Connection Pooling: Efficient resource utilization under high concurrency
  • Build System: Cargo with environment configuration
  • Error Handling: Comprehensive error handling using Rust's Result types and custom error propagation.
  • Modular design enabling independent testing of each layer.
  • Zero-copy optimizations where applicable
  • Structured logging for observability
zingat-diagram