{"id":20671151,"url":"https://github.com/allnulled/simplest-db","last_synced_at":"2025-07-29T05:04:13.847Z","repository":{"id":57681360,"uuid":"470642295","full_name":"allnulled/simplest-db","owner":"allnulled","description":"Small synchronous database implementation for node.js and browsers.","archived":false,"fork":false,"pushed_at":"2022-03-16T19:29:33.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T16:55:24.102Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allnulled.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-16T15:28:15.000Z","updated_at":"2023-03-03T23:36:41.000Z","dependencies_parsed_at":"2022-09-13T20:30:55.448Z","dependency_job_id":null,"html_url":"https://github.com/allnulled/simplest-db","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/allnulled/simplest-db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fsimplest-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fsimplest-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fsimplest-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fsimplest-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allnulled","download_url":"https://codeload.github.com/allnulled/simplest-db/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fsimplest-db/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267632858,"owners_count":24118748,"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-07-29T02:00:12.549Z","response_time":2574,"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":[],"created_at":"2024-11-16T20:25:30.394Z","updated_at":"2025-07-29T05:04:13.821Z","avatar_url":"https://github.com/allnulled.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simplest-db\n\nSmall synchronous database implementation for node.js and browsers.\n\n[![NPM](https://nodeico.herokuapp.com/@allnulled/simplest-db.svg)](https://www.npmjs.com/@allnulled/simplest-db)\n\n## 1. Installation\n\n```sh\n~$ npm i -s @allnulled/simplest-db\n```\n\n## 2. How it works\n\nThis script works the same for `node.js` and `browser`.\n\nWhat the script is thought for, is to be used as `synchronous database` for both `javascript` environments.\n\nOn the `node.js` side, it works with files and the `require(\"fs\")` API.\n\nOn the `browser` side, it works with `localStorage` API.\n\n## 3. Usage\n\n### 3.1. Install:\n\nIn node.js you rely on `require` function and the `node_modules` of the `npm`.\n\nIn browser you need to import `simplest-db.js` by a script tag like:\n\n```html\n\u003cscript src=\"/path/to/some/cdn/network/and/find/simplest-db.js\"\u003e\u003c/script\u003e\n```\n\nIf case you use `webpack` or `browserify` or some tool to pack your browser scripts, you can use `import` and `require` syntax too with `\"simplest-db\"` parameter.\n\n### 3.2. Import:\n\nIn node.js:\n\n```js\nconst SimplestDB = global.SimplestDB || require(\"@allnulled/simplest-db\");\n```\n\nIn browser:\n\n```js\nconst SimplestDB = window.SimplestDB;\n```\n\nNote: the `import` syntax of ES6 will also work.\n\n### 3.3. Create database:\n\n```js\nconst db = SimplestDB.create({\n    schema: \"Unique schema id\",\n    attributes: { /* custom schema attributes */ },\n    tables: {\n        fichero: {\n            attributes: { /* custom table attributes */ }.\n            columns: {\n                ruta: {\n                    attributes: { /* custom column attributes */ },\n                    is_type: \"string\",\n                }\n            }\n        }\n    }\n});\n```\n\n### 3.4. Insert into database:\n\n```js\ndb.insert(\"fichero\", {\n    ruta: \"/root/index.js\",\n    contenido: \"console.log('hi!!!')\"\n});\n```\n\n### 3.5. Select from database:\n\n```js\ndb.select(\"fichero\", f =\u003e {\n    return f.ruta \u0026\u0026 f.ruta.startsWith(\"/root/\");\n});\n```\n\n### 3.6. Update from database:\n\n```js\ndb.update(\"fichero\", 1, {\n    contenido: \"console.log('bye!')\"\n});\n```\n\n### 3.7. Delete from database:\n\n```js\ndb.delete(\"fichero\", 1);\n```\n\n## 4. Features\n\nSome **enjoyable** features:\n\n- Fully synchronous API.\n- Browser (`localStorage`) and node.js (`require(\"fs\")`) support.\n\nSome **missing** features:\n\n- NO support for automatic column checkings, only for table checking. To do so, override `validateRow` method.\n\n### 4.1. Extra features\n\nSince version `1.0.3`, `@allnulled/simplest-db` comes with 2 extra APIs: **Cache API** and **Filesystem API**.\n\nThe **Filesystem API**:\n\n- Included API for files at: `SimplestDB.getFS()`.\n  - Contains a `SimplestDB` instance with `\"system\"` as schema (so: `./sdb_modules/system.data.json` or `localStorage.SDB_STORAGE_FOR_system`).\n  - Accepts tables: `fs`.\n  - Accepts columns: `fs.path`, `fs.contents`, `fs.metadata`.\n\nThe **Cache API**:\n\n- Included API for cache at: `SimplestDB.getCache()`.\n  - Contains a `SimplestDB` instance with `\"system\"` as schema too (so also: `./sdb_modules/system.data.json` or `localStorage.SDB_STORAGE_FOR_system`).\n  - Accepts tables: `cache`.\n  - Accepts columns: `cache.key`, `cache.value`.\n\n## 5. License\n\nNo license.\n\n## 6. Why?\n\nTo have another awesome javascript database. Synchronous. Light. Simpler.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallnulled%2Fsimplest-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallnulled%2Fsimplest-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallnulled%2Fsimplest-db/lists"}