{"id":49409169,"url":"https://github.com/rukodb/ruko","last_synced_at":"2026-04-28T23:43:38.722Z","repository":{"id":57463178,"uuid":"195313070","full_name":"rukodb/ruko","owner":"rukodb","description":"A simple-to-use, in-memory JSON database","archived":false,"fork":false,"pushed_at":"2022-02-02T03:22:30.000Z","size":14,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-28T23:43:37.822Z","etag":null,"topics":["database","flask","json","memory-json-database","python","ruko-server"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/rukodb.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":"2019-07-05T00:07:00.000Z","updated_at":"2022-05-13T18:34:41.000Z","dependencies_parsed_at":"2022-09-12T13:22:27.014Z","dependency_job_id":null,"html_url":"https://github.com/rukodb/ruko","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rukodb/ruko","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rukodb%2Fruko","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rukodb%2Fruko/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rukodb%2Fruko/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rukodb%2Fruko/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rukodb","download_url":"https://codeload.github.com/rukodb/ruko/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rukodb%2Fruko/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32404340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","flask","json","memory-json-database","python","ruko-server"],"created_at":"2026-04-28T23:43:38.229Z","updated_at":"2026-04-28T23:43:38.716Z","avatar_url":"https://github.com/rukodb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ruko\n\n*A simple-to-use, in-memory JSON database*\n\nMany small to medium sized database applications require the use of a database for\npersistent storage of a small amount of data (up to a few gigabytes). While tools like\nRedis provide simple O(1) key value stores, larger applications easily become\noverly complicated due to the flat nature of key value stores along with JSON being a second\nclass citizen. Ruko aims to solve this problem by being a fast, in-memory JSON database\nwhere all requests are O(1) (or O(n) if it has to build an index). Learn more about it below.\n\n## Usage\n\nStart ruko server process:\n```bash\nruko-server\n```\n\nExample Python code:\n```python\nfrom ruko import RDict\n\ndb = RDict.client()\nnotes = db['notes']\n\ndef get_notes():\n    return notes.get()\n\ndef create_note(title, note):\n    notes.append({\n        'title': title,\n        'note': note\n    })\n    return notes[-1]()\n\ndef get_note_by_title(title):\n    return notes.by('title')[title]()\n```\n\nIf you are using [Flask](https://palletsprojects.com/p/flask/), checkout [Flask-Ruko](https://github.com/rukodb/flask-ruko).\n\n### Details\n\n#### Requests\n\nRuko consists of a json database backend and a native feeling Python\ninterface. Requests consist of a key location and a request type. Requests\nare only performed via one of the following:\n - `.get()`: This immediately performs a request, returning the default value or `None` as expected in Python\n - `()`: Calling an index performs the request\n - `.append()`, `.keys()`, `len(x)`, `y in x`, etc. Performing an operation on an  `RDict` performs a request\n - `['key'] = ...` Item assignment performs a request\n \n For example, each of these lines performs one request:\n \n  - `db['users']['abc'].get('name', 'john')`\n  - `abc_user = db['users']['abc']()`\n  - `db['users']['abc']['devices'].append({'name': 'def'})`\n  - `db['users']['abc'] = {'devices': {'name': 'def'}}`\n\n**Difference between `.get()` and `()`:**\n\nWhen using `.get`, it returns a default value if no vaue is present. `()`, however,\nraises `KeyError` (or the default error class) if the value is not present.\n\n#### Get by\n\nAdditionally, you can search for a value inside a list or a dictionary based on its attributes:\n\n```python\nusers = db['users']\nusers[()] = [\n    {'name': 'John', 'email': 'john325@gmail.com'},\n    {'name': 'Sam', 'email': 'sam151@yahoo.com'},\n    {'name': 'Kelly', 'email': 'kelly12@gmail.com'}\n]  # Assign the current object via [()] = ...\n\nusers.by('name')['Sam']()  # {'name': 'Sam', 'email': 'sam151@yahoo.com'}\n```\n \n #### Mappings\nSometimes various objects that reside in different locations need to be\naggregated and searched. This is where mappings come into play. For\nexample:\n\n ```python\nusers = db['users']\nusers.append({\n    'name': 'John',\n    'email': 'john325@gmail.com',\n    'devices': [\n        {'id': 'abc', 'name': \"John's first device\"},\n        {'id': 'def', 'name': \"John's second device\"}\n    ]\n})\nusers.append({\n    'name': 'Sam',\n    'email': 'sam151@yahoo.com',\n    'devices': [\n        {'id': 'ghi', 'name': \"Sam's first device\"},\n        {'id': 'jkl', 'name': \"Sam's second device\"}\n    ]\n})\ndevices = db.create_mapping('devices', 'users.*.devices.*')\n\ndevices.by('id')['ghi'].get()  # {'id': 'ghi', 'name': \"Sam's first device\"}\n```\n\n## Installation\n\n - Compile and install [ruko-server](https://github.com/rukodb/ruko-server_cpp)\n - Install the `ruko` python package:\n \n ```bash\n pip install ruko\n ```\n\n## Contributing\n\nRuko is in active development and encourages contributions from anyone.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frukodb%2Fruko","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frukodb%2Fruko","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frukodb%2Fruko/lists"}