{"id":28413134,"url":"https://github.com/tonaxis/tona-db-mini","last_synced_at":"2026-07-11T12:31:31.016Z","repository":{"id":294960931,"uuid":"988586115","full_name":"Tonaxis/tona-db-mini","owner":"Tonaxis","description":"Tona-DB mini is a JavaScript library for simulating small local databases in JSON","archived":false,"fork":false,"pushed_at":"2025-11-02T04:01:37.000Z","size":403,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-02T06:03:01.385Z","etag":null,"topics":["database","file-based","json","jsondb","lightweight","lowdb","minimal","node","offline","storage","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/tona-db-mini","language":"TypeScript","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/Tonaxis.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-22T19:10:50.000Z","updated_at":"2025-11-02T04:01:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"f5c2ffa0-fefe-4fe6-93ea-cbcfd4e1b410","html_url":"https://github.com/Tonaxis/tona-db-mini","commit_stats":null,"previous_names":["tonaxis/tona-db-mini"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Tonaxis/tona-db-mini","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tonaxis%2Ftona-db-mini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tonaxis%2Ftona-db-mini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tonaxis%2Ftona-db-mini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tonaxis%2Ftona-db-mini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tonaxis","download_url":"https://codeload.github.com/Tonaxis/tona-db-mini/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tonaxis%2Ftona-db-mini/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35362871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["database","file-based","json","jsondb","lightweight","lowdb","minimal","node","offline","storage","typescript"],"created_at":"2025-06-03T03:47:03.937Z","updated_at":"2026-07-11T12:31:30.999Z","avatar_url":"https://github.com/Tonaxis.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ca href=\"https://github.com/tonaxis/tona-db-mini\"\u003e\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/Tonaxis/tona-db-mini/main/docs/images/tona_db_mini_logo_dark.svg\" alt=\"Logo of Tona DB mini\" width=\"450px\"\u003e\n  \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/Tonaxis/tona-db-mini/main/docs/images/tona_db_mini_logo_light.svg\" alt=\"Logo of Tona DB mini\" width=\"450px\"\u003e\n  \u003cimg alt=\"Logo of Tona DB mini\" width=\"450px\" src=\"https://raw.githubusercontent.com/Tonaxis/tona-db-mini/main/docs/images/tona_db_mini_logo_light.svg\"\u003e\n\u003c/picture\u003e\n\u003c/a\u003e\n\n**A simple library to store and retrieve JSON data**\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n[![GitHub release](https://img.shields.io/github/v/release/tonaxis/tona-db-mini)](https://github.com/tonaxis/tona-db-mini/releases)\n![](https://img.shields.io/badge/Typescript-5.8.3-3178C6?style=flat-circle\u0026logo=typescript\u0026logoColor=3178C6)\n\u003c/div\u003e\n\n\n## Summary\n- [Summary](#summary)\n- [Explanation](#explanation)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usages](#usages)\n  - [Basic Usage](#basic-usage)\n  - [Add data to collection](#add-data-to-collection)\n  - [Get data from collection](#get-data-from-collection)\n  - [Update data in collection](#update-data-in-collection)\n  - [Delete data from collection](#delete-data-from-collection)\n  - [Filters](#filters)\n- [Compatibility](#compatibility)\n  - [Example in CommonJS](#example-in-commonjs)\n\n\n\n## Explanation\n**Tona DB mini** is a Node module written in TypeScript that provides the ability to store, update, and retrieve data persistently, much like a database would. It is designed to be simple to use and quick to set up, making it easy to integrate into a small project that requires data persistence without the need to implement a traditional and complex database.\nData is stored in JSON format, which makes it easy to manipulate and migrate between projects. The module simulates a non-relational database with a system of **collections**.\n\u003e Note: This project still under development. Many features are planned for future releases.\n\n## Installation\nSimply run the following command to install the module from npm:\n\n```shell\nnpm install tona-db-mini\n```\n\n## Configuration\nTo configure the module, you can create a configuration file named `tdb-mini.config.json` in the root directory of your project. This file should contain the following properties:\n\n```json\n{\n  \"dbPath\": \"./tdb-mini-data\",\n  \"prettyJson\": false\n}\n```\n\n- `dbPath` - The path to the database folder.\n- `prettyJson` - A boolean value that determines whether the JSON data should be formatted with indentation.\n\n## Usages\n\n### Basic Usage\n```ts\nimport db from \"tona-db-mini\";\n\n// Create your type for your collection\ntype User = {\n  name: string;\n  age: number;\n};\n\nconst users = db.collection\u003cUser\u003e(\"users\");\n\n// Add a new user\nusers.add({ name: \"John Doe\", age: 30 });\n\n// Get user by name\nconst user = users.get({ name: \"John Doe\" });\n```\n\n### Add data to collection\nTo add data to a collection, you can use the `add` method.\nThe `add` method takes an object or an array of objects as an argument.\n\n```ts\nimport db from \"tona-db-mini\";\n\n// Create your type for your collection\ntype User = {\n  name: string;\n  age: number;\n};\n\nconst users = db.collection\u003cUser\u003e(\"users\");\n\n// Add a new user\nusers.add({ name: \"John Doe\", age: 30 });\n\n// Add multiple users\nusers.add([{ name: \"Jane Doe\", age: 25 }, { name: \"Bob Smith\", age: 35 }]);\n```\n\n### Get data from collection\nTo get data from a collection, you can use the `get` method.\nThe `get` method takes an [Filter](#filters) as an argument. If no filter is provided, it will return all data from the collection.\n\n```ts\nimport db from \"tona-db-mini\";\n\n// Create your type for your collection\ntype User = {\n  name: string;\n  age: number;\n};\n\nconst users = db.collection\u003cUser\u003e(\"users\");\n\n// Get data from collection\nconst specificUser = users.get({ name: \"John Doe\" });\n\n// Get all data from collection\nconst allUsers = users.get();\n```\n\n### Update data in collection\nTo update data in a collection, you can use the `update` method.\nThe `update` method takes a [Filter](#filters) and a partial data object as arguments.\n\n```ts\nimport db from \"tona-db-mini\";\n\n// Create your type for your collection\ntype User = {\n  name: string;\n  age: number;\n};\n\nconst users = db.collection\u003cUser\u003e(\"users\");\n\n// Update data in collection\nusers.update({ name: \"John Doe\" }, { age: 31 });\n```\n\n\n### Delete data from collection\nTo delete data from a collection, you can use the `del` method.\nThe `del` method takes an [Filter](#filters) as an argument. If no filter is provided, it will delete all data from the collection.\n\n```ts\nimport db from \"tona-db-mini\";\n\n// Create your type for your collection\ntype User = {\n  name: string;\n  age: number;\n};\n\nconst users = db.collection\u003cUser\u003e(\"users\");\n\n// Delete data from collection\nusers.del({ name: \"John Doe\" });\n\n// Delete all data from collection\nusers.del();\n```\n\n### Filters\nYou can use a filter to specify which data you want to **get**, **update**, or **delete** from a collection. The filter can be an object or a predicate function.\n\n```ts\nimport db from \"tona-db-mini\";\n\n// Create your type for your collection\ntype User = {\n  name: string;\n  age: number;\n};\n\nconst users = db.collection\u003cUser\u003e(\"users\");\n\n// Get user with name \"John Doe\"\nconst specificUser = users.get({ name: \"John Doe\" });\n\n// Get users with age greater than 30\nconst olderUsers = users.get((user) =\u003e user.age \u003e 30);\n```\n\n## Compatibility\n\n**Tona DB mini** is a very flexible JavaScript/TypeScript module: it works in **Node.js** (backend, scripts, serverless), in **Deno**, with the older **CommonJS** format (`require`), and even with a **TypeScript runtime** like `tsx` without a build step. In short, it fits smoothly into most modern or existing stacks.\n\n| Environment / stack      | Supported? | Usage notes                                   |\n| ------------------------ | ---------- | --------------------------------------------- |\n| **Node.js**              | ✅          | Backend apps, scripts, serverless             |\n| **Deno**                 | ✅          | URL imports, secure runtime                   |\n| **CommonJS** (`require`) | ✅          | No need to migrate to ES Modules              |\n| **TS runtime (tsx)**     | ✅          | Run TypeScript directly, no build step needed |\n\n\n### Example in CommonJS\n\n```js\nconst db = require(\"tona-db-mini\").default;\n\nconst users = db.collection(\"users\");\n\n// Add a new user\nusers.add({ name: \"John Doe\", age: 30 });\n\n// Get user by name\nconst user = users.get({ name: \"John Doe\" });\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonaxis%2Ftona-db-mini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftonaxis%2Ftona-db-mini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonaxis%2Ftona-db-mini/lists"}