Hasty Briefsbeta

Bilingual

Trifecta Technology - Bert Hubert's writings

a day ago
  • Trifecta is a small open-source image sharing site built with modern C++, database, and web technologies, aiming to be trustworthy and self-hosted.
  • The codebase is minimal: 1200 lines of C++ and 400 lines of JavaScript, with few dependencies, and a Docker image under 2 MB.
  • SQLiteWriter and nlohmann::json provide a type-safe, straightforward bridge between SQL and JSON, avoiding complex ORMs.
  • Alpine.js is used as a minimal JavaScript framework for easy data binding between HTML and JSON without heavy preprocessing.
  • cpp-httplib is a single-file HTTP library used for the web server, with TLS support but run behind nginx for security.
  • Trifecta-lib extracts common user/session management to support multiple projects, with automated API endpoints and error handling.
  • Meson build system offers a balanced approach to dependency management, making it easy but not too easy to add dependencies.
  • Docker images are built from scratch, resulting in a very small image (<2 MB), and Watchtower can automate updates.
  • doctest is used for unit testing, including launching the actual web server for API tests.
  • argparse provides command-line argument parsing, and {fmt} offers modern string formatting, now part of recent C++ standards.
  • No image parsing is done in Trifecta to avoid security risks from memory-unsafe image libraries; future sandboxing may be added.