{"id":16180818,"url":"https://github.com/elmarti/camadb","last_synced_at":"2025-09-08T23:34:41.560Z","repository":{"id":40652114,"uuid":"411979983","full_name":"elmarti/camadb","owner":"elmarti","description":"A NoSQL embedded database written in Typescript","archived":false,"fork":false,"pushed_at":"2023-10-27T18:33:02.000Z","size":1410,"stargazers_count":32,"open_issues_count":10,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-04T12:02:13.251Z","etag":null,"topics":["database","electron","embedded-database","indexeddb","nodejs","nosql","nosql-database","typescript"],"latest_commit_sha":null,"homepage":"","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/elmarti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-30T08:16:18.000Z","updated_at":"2025-08-23T19:14:27.000Z","dependencies_parsed_at":"2023-02-18T15:16:05.887Z","dependency_job_id":null,"html_url":"https://github.com/elmarti/camadb","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/elmarti/camadb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmarti%2Fcamadb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmarti%2Fcamadb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmarti%2Fcamadb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmarti%2Fcamadb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elmarti","download_url":"https://codeload.github.com/elmarti/camadb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmarti%2Fcamadb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231177,"owners_count":25245675,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"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","electron","embedded-database","indexeddb","nodejs","nosql","nosql-database","typescript"],"created_at":"2024-10-10T06:10:07.631Z","updated_at":"2025-09-08T23:34:41.531Z","avatar_url":"https://github.com/elmarti.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CamaDB\n\nCamaDB is a NoSQL embedded database written in pure TypeScript for Node, Electron and browser-based environments.\n\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\n## Why?\nI was struggling to find a solution for Electron-based projects that deal with larger datasets in the main thread.\n\n- I had issues getting SQLite to work with webpack due to its native build\n- SQLite doesn't (by default) return native JS data types (Dates in particular)\n- Other NoSQL embedded databases seem to be largely abandoned\n- Most other NoSQL embedded databases seem to be limited by V8's hard string length limits\n\n## Goals\n- Fast querying/insertion/manipulation of data, up to 1 million rows\n- Frictionless integration with all JS runtimes\n- Rich API \n- Full TypeScript support\n- Simplicity and versatility - This is built for storing data in dynamic structures\n\n## Current state\nThis is still under active development and a few features are missing:\n- Indexes - We're finding that this is fast even without these, but every little helps\n- Rich text search \n\n## Getting started\n[Documentation](https://elmarti.github.io/camadb/classes/Collection.html)\n### Installing\n```\nyarn add reflect-metadata\nyarn add camadb\n```\nOR \n```\nnpm install reflect-metadata --save\nnpm install camadb --save\n```\n\n### Initializing the database\nAll of these config options are optional:\n- `path` - Where you want the data to be stored - default is `./.cama` or `cama` for indexeddb and localstorage\n- `persistenceAdapter` - How you want to persist your data - `fs`, `indexeddb`, `localstorage` or `inmemory`\n- `logLevel` - info or debug\n```\n  import { Cama } from 'camadb'\n  const database = new Cama({\n    path: './.cama',\n    persistenceAdapter: 'fs',\n    logLevel: 'debug'\n  });\n```\n\n### Initializing a collection\n- Use the columns field to add specific data types for rows. This does _need_ to be done for each column, but is essential for date objects\n- Indexes aren't currently implemented, but the lookup is still very fast across 10 million rows\n```\n const collection = await database.initCollection('test', {\n    columns: [{\n      type:'date',\n      title:'date'\n    }],\n    indexes: [],\n  });\n```\n\n### Insert one\n```\n await collection.insertOne({\n    _id: 'test',\n    name: 'Dummy field',\n    description: `Data`,\n  });\n```\n### Insert many\n```\n  await collection.insertMany([{\n       _id: 'test',\n       name: 'Dummy field',\n       description: `Data`,\n  }]);\n\n```\n\n### Find many \nCamaDB uses a MongoDB style query language, powered by [SiftJS](https://github.com/crcn/sift.js/). Have a look at that project to see the full capabilities of that library.\n```\n const findResult = await collection.findMany({\n    _id: {\n      $gte: 50000,\n    },\n  },\n    {\n      sort:{\n        desc: x =\u003e x._id\n      },\n      offset: 100,\n      limit: 100\n    });\n```\n\n### Updating\nAgain we use a MongoDB style language for data updates, for this we use  [obop](https://github.com/kawanet/obop)\n```\n  await collection.updateMany({\n    _id:3\n  }, {\n    $set: {\n      steve:\"steve\"\n    }\n  });\n```\n\n### Aggregation\nWe use [Mingo](https://github.com/kofrasa/mingo) for aggregation - currently lookup commands aren't supported.\n```\n const aggregationResult = await collection.aggregate([{\n    $match:{\n      _id:3\n    }\n  }]);\n``` \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felmarti%2Fcamadb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felmarti%2Fcamadb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felmarti%2Fcamadb/lists"}