{"id":28301026,"url":"https://github.com/champ96k/quanta_db","last_synced_at":"2025-06-16T07:32:21.188Z","repository":{"id":293836231,"uuid":"985239714","full_name":"champ96k/quanta_db","owner":"champ96k","description":"High-performance NoSQL local database built entirely in Dart","archived":false,"fork":false,"pushed_at":"2025-06-05T08:14:52.000Z","size":5477,"stargazers_count":27,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T05:44:22.114Z","etag":null,"topics":["dart","dart-lang","dart-library","dart-package","dartlang","db","flutter","flutter-apps","flutter-database","flutter-plugin","local-database","localstorage"],"latest_commit_sha":null,"homepage":"https://quantadb.netlify.app/","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/champ96k.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-17T10:55:43.000Z","updated_at":"2025-06-05T08:14:53.000Z","dependencies_parsed_at":"2025-05-17T13:23:16.451Z","dependency_job_id":"257240bf-c63d-4e8e-9456-57ff019dedc5","html_url":"https://github.com/champ96k/quanta_db","commit_stats":null,"previous_names":["champ96k/quanta_db"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/champ96k/quanta_db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/champ96k%2Fquanta_db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/champ96k%2Fquanta_db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/champ96k%2Fquanta_db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/champ96k%2Fquanta_db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/champ96k","download_url":"https://codeload.github.com/champ96k/quanta_db/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/champ96k%2Fquanta_db/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259399438,"owners_count":22851629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","dart-lang","dart-library","dart-package","dartlang","db","flutter","flutter-apps","flutter-database","flutter-plugin","local-database","localstorage"],"created_at":"2025-05-23T19:12:16.321Z","updated_at":"2025-06-16T07:32:21.179Z","avatar_url":"https://github.com/champ96k.png","language":"Dart","readme":"# QuantaDB\n\n[![Sponsor](https://img.shields.io/badge/Sponsor-%F0%9F%92%96-blueviolet)](https://github.com/sponsors/champ96k)\n\n\u003ciframe src=\"https://github.com/sponsors/champ96k/button\" title=\"Sponsor champ96k\" height=\"32\" width=\"114\" style=\"border: 0; border-radius: 6px;\"\u003e\u003c/iframe\u003e\n\n[![Pub Version](https://img.shields.io/pub/v/quanta_db.svg)](https://pub.dev/packages/quanta_db)\n[![License](https://img.shields.io/github/license/champ96k/quanta_db)](https://github.com/champ96k/quanta_db/blob/master/LICENSE)\n[![Dart CI](https://github.com/champ96k/quanta_db/actions/workflows/dart.yml/badge.svg)](https://github.com/champ96k/quanta_db/actions/workflows/dart.yml)\n[![codecov](https://codecov.io/gh/champ96k/quanta_db/branch/master/graph/badge.svg)](https://codecov.io/gh/champ96k/quanta_db)\n[![Documentation](https://img.shields.io/badge/Documentation-API-blue)](https://quantadb.netlify.app/)\n\n\u003e ⚠️ **BETA RELEASE**  \n\u003e This project is currently in **beta**. While it's functional and available for use, it may still undergo changes. Please use with caution in production environments and report any bugs or issues.\n\n📚 **Documentation**: Visit our [documentation site](https://quantadb.netlify.app/) for detailed guides and API references.\n\nA high-performance, type-safe NoSQL database for Dart and Flutter applications.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/champ96k/quanta_db/master/logo.png\" alt=\"QuantaDB Logo\" width=\"400\"/\u003e\n\u003c/p\u003e\n\n## Features\n\n- 🚀 **Performance**: Optimized for speed with LSM-Tree storage\n- 🔒 **Type Safety**: Compile-time type checking and validation\n- 🔄 **Reactive**: Real-time data synchronization\n- 📊 **Query Engine**: Powerful querying capabilities\n- 🔄 **Transactions**: ACID-compliant transactions\n- 📈 **Scalability**: Efficient handling of large datasets\n- 🛠 **Developer Experience**: Annotation-driven code generation\n- 🔄 **Schema Migrations**: Automatic schema version management\n- ✅ **Field Validation**: Built-in validation with custom rules\n- 🔐 **Access Control**: Field-level visibility control\n- 🔄 **Relationships**: Support for one-to-many and many-to-many relationships\n\n## Installation\n\nAdd this to your package's `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  quanta_db: ^0.0.6\n```\n\nYou can install packages from the command line:\n\n```bash\n$ dart pub get\n```\n\n## Quick Start\n\n```dart\nimport 'package:quanta_db/quanta_db.dart';\n\nvoid main() async {\n  // Open the database\n  final db = await QuantaDB.open('my_database');\n\n  // Define your model\n  @QuantaEntity(version: 1)\n  class User {\n    @QuantaId()\n    final String id;\n\n    @QuantaField(required: true)\n    final String name;\n\n    @QuantaIndex()\n    final String email;\n\n    User({required this.id, required this.name, required this.email});\n  }\n\n  // Insert data\n  final user = User(id: '1', name: 'John', email: 'john@example.com');\n  await db.put('user:1', user);\n\n  // Query data\n  final queryEngine = QueryEngine(db.storage);\n  final users = await queryEngine.query\u003cUser\u003e(\n    Query\u003cUser\u003e().where((user) =\u003e user.name.startsWith('J'))\n  );\n  print('Users: $users');\n\n  // Close the database\n  await db.close();\n}\n```\n\n## Usage\n\n### Basic Operations\n\n```dart\n// Open database\nfinal db = await QuantaDB.open('my_database');\n\n// Put data\nawait db.put('key', {'name': 'value'});\n\n// Get data\nfinal data = await db.get('key');\n\n// Delete data\nawait db.delete('key');\n\n// Close database\nawait db.close();\n```\n\n### Using Annotations\n\nQuantaDB provides a rich set of annotations for defining your data models:\n\n#### Entity Annotations\n\n```dart\n@QuantaEntity(version: 1)\nclass User {\n  @QuantaId()\n  final String id;\n\n  @QuantaField(required: true)\n  final String name;\n}\n```\n\n#### Index Annotations\n\n```dart\n@QuantaIndex()\nfinal String email;\n\n@QuantaCompositeIndex(fields: ['firstName', 'lastName'])\nfinal String fullName;\n```\n\n#### Relationship Annotations\n\n```dart\n@QuantaHasMany(targetEntity: Post, foreignKey: 'userId')\nfinal List\u003cPost\u003e posts;\n\n@QuantaManyToMany(targetEntity: Group)\nfinal List\u003cGroup\u003e groups;\n```\n\n### Type Support\n\nThe code generator supports a comprehensive range of data types:\n\n#### Primitive Types\n\n```dart\nfinal String name;\nfinal int age;\nfinal double score;\nfinal bool isActive;\nfinal DateTime createdAt;\n```\n\n#### Complex Types\n\n```dart\nfinal List\u003cString\u003e tags;\nfinal Map\u003cString, dynamic\u003e metadata;\nfinal Set\u003cString\u003e permissions;\n```\n\n#### Enums\n\n```dart\nenum UserType { admin, user, guest }\n\nfinal UserType? userType;\n```\n\n### Field Validation\n\n```dart\n@QuantaField(\n  required: true,\n  min: 0,\n  max: 120,\n  pattern: r'^[a-zA-Z]+$'\n)\nfinal String name;\n```\n\n### Reactive Fields\n\n```dart\n@QuantaReactive()\nfinal DateTime lastLogin;\n\n// Watch for changes\nfinal queryEngine = QueryEngine(db.storage);\nfinal stream = queryEngine.watch\u003cUser, User\u003e(\n  Query\u003cUser\u003e().where((user) =\u003e user.lastLogin != null)\n);\nawait for (final user in stream) {\n  print('User logged in at: ${user.lastLogin}');\n}\n```\n\n## Performance\n\nQuantaDB is designed for speed. Here are benchmark results comparing QuantaDB's performance for 10,000 operations:\n\n| Operation | QuantaDB | Hive  | SQLite |\n| --------- | -------- | ----- | ------ |\n| Write     | 30ms     | 216ms | 3290ms |\n| Read      | 9ms      | 8ms   | 299ms  |\n| Batch     | 15ms     | 180ms | 2800ms |\n| Query     | 25ms     | 45ms  | 150ms  |\n\n**As you can see, QuantaDB demonstrates significantly faster performance across all operations.**\n\n**[Check out the benchmark code here](https://github.com/champ96k/quanta_db/blob/master/example/demo_example/lib/complete_example.dart)** to run it yourself and see the details.\n\n## Why QuantaDB?\n\nExisting local databases for Dart/Flutter often have external dependencies or performance limitations. QuantaDB aims to overcome these challenges by implementing a Log-Structured Merge Tree (LSM-Tree) storage engine from scratch in pure Dart, coupled with an annotation-driven code generation system for a developer-friendly experience.\n\nOur goals include:\n\n- Achieving competitive read and write performance.\n- Providing a simple and intuitive API.\n- Ensuring data durability and consistency.\n- Supporting complex data models with relationships and indexing.\n- Offering a reactive query system for real-time updates.\n\n## Architecture\n\nQuantaDB is built with a layered architecture to separate concerns and improve maintainability. The core of the database is the LSM-Tree storage engine.\n\n### High-Level Architecture\n\nBelow is a high-level overview of the QuantaDB architecture:\n\n![QuantaDB High-Level Architecture](https://raw.githubusercontent.com/champ96k/quanta_db/master/design_diagram.png)\n\n- **Application Layer**: Provides the public API and integrates with the annotation and code generation systems.\n- **Core Engine Layer**: Contains the central logic for query processing, LSM storage management, and transactions.\n- **Storage Layer**: Implements the core storage components like MemTable, SSTable Manager, Bloom Filters, and Compaction.\n- **Platform Layer**: Interacts with the underlying file system and utilizes isolate workers for background tasks.\n\n### Data Flow\n\nHere's a diagram illustrating the typical data flow within QuantaDB:\n\n![QuantaDB Data Flow](https://raw.githubusercontent.com/champ96k/quanta_db/master/design_flow.png)\n\n- Data enters through the API.\n- Queries are processed by the Query Engine.\n- Write operations go through the MemTable and are eventually flushed to SSTables.\n- Read operations utilize Bloom Filters and the MemTable before hitting SSTables.\n- Compaction runs in the background to merge and optimize SSTables.\n\n## Additional Information\n\n- [Documentation](https://quantadb.netlify.app/)\n- [API Reference](https://pub.dev/documentation/quanta_db/latest/)\n- [GitHub Repository](https://github.com/champ96k/quanta_db)\n- [Issue Tracker](https://github.com/champ96k/quanta_db/issues)\n- [Discussions](https://github.com/champ96k/quanta_db/discussions)\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\n- **Tushar Nikam** - [LinkedIn](https://www.linkedin.com/in/tushar-nikam-dev/)\n\n## Contributors\n\n### Code Contributors\n\n\u003ca href=\"https://github.com/champ96k/quanta_db/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=champ96k/quanta_db\" /\u003e\n\u003c/a\u003e\n\n### Issue Contributors\n\n\u003ca href=\"https://github.com/champ96k/quanta_db/issues\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/issues/champ96k/quanta_db\" alt=\"Total Issues\" /\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/champ96k/quanta_db/issues?q=is%3Aissue+is%3Aclosed\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/issues-closed/champ96k/quanta_db\" alt=\"Closed Issues\" /\u003e\n\u003c/a\u003e\n\n\u003cbr\u003e\n\n\u003e View all contributors and their issues on our [GitHub Issues page](https://github.com/champ96k/quanta_db/issues)\n\n---\n\nMade with ❤️ by the QuantaDB Team\n\n![Visitor Count](https://visitor-badge.laobi.icu/badge?page_id=champ96k.quanta_db)\n","funding_links":["https://github.com/sponsors/champ96k","https://github.com/sponsors/champ96k/button"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchamp96k%2Fquanta_db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchamp96k%2Fquanta_db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchamp96k%2Fquanta_db/lists"}