-# Tiny DB
+## Quick Preview
+
+```dart
+import 'package:tiny_db/tiny_db.dart';
+
+final db = TinyDb(MemoryStorage());
+
+await db.insert({'name': 'Alice', 'age': 30, 'city': 'NYC'});
+await db.insert({'name': 'Bob', 'age': 25, 'city': 'NYC'});
+
+final nycUsers = await db.defaultTable.search(where('city').equals('NYC'));
+print(nycUsers.length); // 2
+```
+
+## The Magic
+
+### Use Case 1: Clean Local Database
+
+```dart
+import 'package:tiny_db/tiny_db.dart';
+
+final db = TinyDb(MemoryStorage());
+
+// Just add your data - plain maps, no schema needed
+await db.insert({'name': 'Alice', 'age': 30, 'city': 'NYC', 'role': 'developer'});
+await db.insert({'name': 'Bob', 'age': 25, 'city': 'SF', 'role': 'designer'});
+await db.insert({'name': 'Charlie', 'age': 35, 'city': 'NYC', 'role': 'developer'});
+
+// Query it like a real database
+final nycDevs = await db.defaultTable.search(
+ where('city').equals('NYC').and(where('role').equals('developer'))
+);
+
+print('NYC developers: ${nycDevs.length}'); // 2
-## Overview
+for (final dev in nycDevs) {
+}
+// Alice, age 30
+// Charlie, age 35
+```
+ **Clean. Simple. No schema.**
+
+ > **Try it:** [example/use_case_1_local_db.dart](example/use_case_1_local_db.dart)
-**Tiny DB** is a modern, ultra-lightweight NoSQL database for Dart and Flutter, inspired by the beloved [Python TinyDB](https://tinydb.readthedocs.io/en/latest/). With over 80% feature parity and several unique enhancements, it brings the power and flexibility of document-oriented storage to your Dart and Flutter apps—no server required!
+ ### Use Case 2: Optional — Fetch API JSON and Query Instantly
-- 🚀 **Feature-rich:** Supports advanced queries, update operations, and deep equality for robust data handling.
-- 🧠 **In-memory & JSON file storage:** Choose blazing-fast ephemeral memory mode or persistent, human-readable JSON file storage—switch at any time.
-- 🔄 **Familiar, expressive API:** Inspired by Python TinyDB, but fully Dart-idiomatic and enhanced for Dart and Flutter developers.
-- 🎯 **Embeddable & portable:** Works everywhere Dart or Flutter runs. In-memory mode is pure Dart (no native code). JSON file storage for Flutter apps uses the standard `path_provider` plugin for safe device storage.
+ Note: TinyDb is Maps-first and works without any preexisting JSON. You can optionally ingest JSON from APIs or files when needed.
-Whether you need a simple embedded database for prototyping, testing, or production apps, Tiny DB offers a clean, intuitive, and powerful solution.
+ ```dart
+ import 'dart:convert';
+import 'package:http/http.dart' as http;
+import 'package:tiny_db/tiny_db.dart';
-Wondering how Tiny DB compares to SharedPreferences, Isar, Hive, or SQLite? See our [detailed comparison](doc/comparison.md).
+final db = TinyDb(MemoryStorage());
+
+// Fetch JSON from any API
+final response = await http.get(
+ Uri.parse('https://api.github.com/users/vento007/repos')
+);
+final repos = jsonDecode(response.body) as List;
+
+// Make it queryable
+for (final repo in repos) {
+ await db.insert(repo);
+}
+
+// Query nested data, complex conditions - instantly
+final dartPackages = await db.defaultTable.search(
+ where('language').equals('Dart').and(where('stargazers_count').greaterThan(3))
+);
+
+print('Found ${dartPackages.length} popular Dart packages!');
+for (final pkg in dartPackages) {
+ print('${pkg['name']}: ${pkg['stargazers_count']}');
+}
+// flexible_tree_layout: 6
+// riverpod_mvcs_example: 5
+// tiny_db: 4
+```
+
+
+## What is tiny_db?
+
+ A lightweight, document-oriented NoSQL database for Dart & Flutter. Think of it as **SQLite for JSON** - powerful queries without the SQL.
+
+- **Instant Queries**: Insert Maps and query immediately; optionally ingest JSON from APIs or files
+- **No Schema**: Works with any JSON structure - dynamic and flexible
+- **20+ Query Operators**: Nested paths, regex, logical operators, list operations
+- **Dual Storage**: In-memory (fast) or persistent JSON files (human-readable)
+- **Pure Dart**: Works on mobile, desktop, web, and server
+- **Battle-Tested**: 264+ automated tests, 80%+ feature parity with Python TinyDB
+{{ ... }}
## Table of Contents
-- [Features](#features)
+- [Real-World Use Cases](#real-world-use-cases)
- [Installation](#installation)
-- [Quick Start](#quick-start)
-- [API Overview](#api-overview)
-- [Advanced Usage](#advanced-usage)
-- [List & Update Operations](#list--update-operations)
+- [Quick Start Examples](#quick-start-examples)
+ - [Remote API Caching](#1-remote-api-caching)
+ - [Basic CRUD Operations](#2-basic-crud-operations)
+ - [Persistent Storage](#3-persistent-storage)
+- [Complete Query Guide](#complete-query-guide)
+- [Complete Update Operations](#complete-update-operations)
+- [Advanced Examples](#advanced-examples)
+ - [Nested Path Queries](#nested-path-queries)
+ - [Complex Logical Conditions](#complex-logical-conditions)
+ - [List Operations](#list-operations)
+ - [Regex Searches](#regex-searches)
+ - [Custom Test Functions](#custom-test-functions)
- [Storage Backends](#storage-backends)
-- [Dependency Injection & App Integration](#dependency-injection--app-integration)
-- [Testing](#testing)
-- [Contributing](#contributing)
-- [Roadmap](#roadmap)
+- [API Reference](#api-reference)
+- [Practical Patterns](#practical-patterns)
+- [Examples Index](#examples-index)
+- [Comparison with Alternatives](#comparison-with-alternatives)
- [Credits](#credits)
- [License](#license)
-- [Comparisons vs SharedPreferences, Isar, Hive, SQLite](#comparisons)
-