{"id":13880895,"url":"https://github.com/sdslabs/zap-db","last_synced_at":"2025-10-13T15:43:47.705Z","repository":{"id":51105575,"uuid":"263594155","full_name":"sdslabs/zap-db","owner":"sdslabs","description":"An easy to use JSON database written with ease of setup and memory management of slack bots in mind.","archived":false,"fork":false,"pushed_at":"2022-06-03T19:14:16.000Z","size":166,"stargazers_count":104,"open_issues_count":0,"forks_count":2,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-28T08:04:38.335Z","etag":null,"topics":["bots","database","db","json","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/sdslabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-13T10:11:08.000Z","updated_at":"2024-01-04T16:45:55.000Z","dependencies_parsed_at":"2022-09-04T04:21:22.566Z","dependency_job_id":null,"html_url":"https://github.com/sdslabs/zap-db","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdslabs%2Fzap-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdslabs%2Fzap-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdslabs%2Fzap-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdslabs%2Fzap-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdslabs","download_url":"https://codeload.github.com/sdslabs/zap-db/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248949650,"owners_count":21188120,"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":["bots","database","db","json","typescript"],"created_at":"2024-08-06T08:03:36.939Z","updated_at":"2025-10-13T15:43:42.641Z","avatar_url":"https://github.com/sdslabs.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# zap-db\n\nAn easy to use JSON database written with ease of setup and memory management of slack bots in mind.\n\n[![CI](https://github.com/sdslabs/zap-db/actions/workflows/ci.yml/badge.svg)](https://github.com/sdslabs/zap-db/actions/workflows/ci.yml)  [![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/tterb/atomic-design-ui/blob/master/LICENSEs)  [![Discord](https://discordapp.com/api/guilds/758961084337618944/embed.png)](https://discord.gg/dXkVEgTPu9)\n\n## Concept\n\n1. There's an admin for the database server, only who can\n   create new JSON databases.\n\n2. On creating a new database, the user will receive a token\n   which can be used to make requests to the database server.\n   This user is called the `owner` and there can only be one\n   owner of a JSON database.\n\n3. An owner can later on create more tokens with varying\n   scopes which are `read`, `write`, and `delete`. These\n   child tokens can have any combination of the aforementioned\n   scopes. These can be created in any number of amounts,\n   yet access to them can be revoked by the db owner.\n\n4. Ofcourse, admin can also revoke owner's access to the\n   database and can delete the db as well. It's just common\n   courtesy to send the backup of the database to the owner\n   before demolishing it.\n\n5. Each request should be made with a token in headers of\n   the request. More precisely, the `Authorization` header.\n   The token contains the database information and hence,\n   there is no need to specify the db in routes.\n\n6. Routes should contain the basic `GET /` and `POST /` for\n   reading and writing, along-with `DELETE /` for deleting\n   the database but should also contain `PATCH /` for patch\n   updates. In case of patch, only the JSON specified in the\n   request body is updated.\n\n   For example:\n   ```json\n   {\n      \"name\": \"Thanos\",\n      \"work\": \"Destroy 50% of the universe\",\n   }\n   ```\n   In the above case, a request with the body:\n   ```json\n   {\n      \"work\": \"Save 50% of the universe\"\n   }\n   ```\n   Should just update the `work` part of the JSON.\n\n## Development\n\n1. Clone the repository and `cd` to it.\n\n1. Install dependencies:\n   ```shell\n   $ npm install\n   ```\n\n1. Copy the `sample.config.json` as `config.json` and make\n   required changes:\n   ```shell\n   $ cp sample.config.json config.json\n   ```\n\n\n1. Password in config is the sha256 of the password you want\n   to keep for the admin. Use the following command to hash:\n   ```shell\n   $ npm run hash\n\n   Input your password:\n   \u003e ...\n   ab5df625bc76dbd4e163bed2dd888df828f90159bb93556525c31821b6541d46\n   ```\n\n1. Run the server in watch mode (reloads on file change):\n   ```shell\n   $ npm run watch\n   ```\n\n1. Run `npm run format` to format auto-fixable errors.\n\n1. Run `npm run lint` to check for linting errors.\n\n\nPostman Collection : https://www.getpostman.com/collections/9135694a2a9a2410d3ae\n\n## Got Questions?\n\nHop in to our Discord Server if you have any questions or if you'd like to contribute to the project\n\n## License\n\nThis project is under the MIT license. See NOTICE for thirdparty license notices.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdslabs%2Fzap-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdslabs%2Fzap-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdslabs%2Fzap-db/lists"}