Reflect is a C++ library that makes working with databases feel natural and intuitive. Instead of writing SQL by hand, you define your data using regular C++ structs with simple annotations. The library automatically figures out how to store, retrieve, and manage your data in either SQLite or PostgreSQL databases. It handles creating tables, generating queries, validating that your code matches your database, and even managing database changes over time. This is particularly useful for C++ developers who want the power and type safety of C++ while avoiding the complexity of raw SQL.
How It Works
Instead of writing complex SQL queries by hand, you describe your data once using regular C++ structs and special markers.
You write simple C++ structs with small annotations like 'this is a unique email' or 'this field cannot be empty'.
With one line of code, you connect to either a simple file-based database or a powerful server database.
The library reads your struct definitions and creates matching database tables, indexes, and relationships.
Add new records with a single command, like adding a new user to your system
Search for records using natural conditions like 'find all users with emails ending in @company.com'
Change existing records, with automatic tracking of when records were last updated
The library can verify that your C++ code matches your actual database, catching any mismatches before they cause problems.
Your C++ application talks to your database naturally, with type safety and automatic SQL generation handling all the complexity for you.
Star Growth
Repurpose is a Pro feature
Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.
Unlock RepurposeSimilar repos coming soon.