{"id":13683087,"url":"https://github.com/Drarig29/ts-json-db","last_synced_at":"2025-04-30T12:33:20.111Z","repository":{"id":42907492,"uuid":"250621725","full_name":"Drarig29/ts-json-db","owner":"Drarig29","description":"A Node.js database using JSON file as storage. The result of requests are typed!","archived":false,"fork":false,"pushed_at":"2022-03-26T09:53:37.000Z","size":174,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T06:39:10.177Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Drarig29.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-27T19:01:14.000Z","updated_at":"2024-09-21T13:57:30.000Z","dependencies_parsed_at":"2022-09-19T17:32:07.353Z","dependency_job_id":null,"html_url":"https://github.com/Drarig29/ts-json-db","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drarig29%2Fts-json-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drarig29%2Fts-json-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drarig29%2Fts-json-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drarig29%2Fts-json-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Drarig29","download_url":"https://codeload.github.com/Drarig29/ts-json-db/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251701832,"owners_count":21629901,"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":[],"created_at":"2024-08-02T13:01:59.903Z","updated_at":"2025-04-30T12:33:19.833Z","avatar_url":"https://github.com/Drarig29.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# ts-json-db\n\nA Node.js database using JSON file as storage. The result of requests are **typed**!\n\nIt's a wrapper around [node-json-db](https://github.com/Belphemur/node-json-db) which does the main job about the \"database\". This package is inspired by [RESTyped](https://github.com/rawrmaan/restyped) and its autocomplete and type checks.\n\n![Demo](https://i.imgur.com/q3uLHJW.gif)\n\n[![npm](https://img.shields.io/npm/v/ts-json-db.svg)](https://www.npmjs.com/package/ts-json-db)\n[![Downloads](https://img.shields.io/npm/dt/ts-json-db.svg)](https://www.npmjs.com/package/ts-json-db)\n\n## Installation\n\nAdd `ts-json-db` to your existing Node.js project.\n\n```bash\nnpm install ts-json-db\n```\n\n## Usage\n\n```typescript\nimport TypedJsonDB, { ContentBase, Dictionary } from \"ts-json-db\";\n\ninterface Restaurant {\n    name: string\n    chef: string,\n    memberCount: number,\n    turnOver: number\n}\n\ninterface Login {\n    username: string,\n    password: string\n};\n\ninterface ContentDef extends ContentBase {\n    paths: {\n        '/login': {\n            entryType: \"single\",\n            valueType: Login\n        },\n        '/restaurants': {\n            entryType: \"array\",\n            valueType: Restaurant\n        },\n        '/teams': {\n            entryType: \"dictionary\",\n            valueType: string\n        }\n    }\n}\n\nlet db = new TypedJsonDB\u003cContentDef\u003e(\"config.json\");\nlet result = db.get(\"/login\");\n\nconsole.log(result);\n```\n\nYou can see in the `example` folder to find usage examples.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDrarig29%2Fts-json-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDrarig29%2Fts-json-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDrarig29%2Fts-json-db/lists"}