{"id":20944261,"url":"https://github.com/hotkit/fost-beanbag","last_synced_at":"2026-04-29T03:32:26.313Z","repository":{"id":2806347,"uuid":"3807297","full_name":"hotkit/fost-beanbag","owner":"hotkit","description":"Library version of Beanbag","archived":false,"fork":false,"pushed_at":"2020-06-22T02:42:35.000Z","size":1559,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-13T04:16:02.920Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","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/hotkit.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","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":"2012-03-23T10:22:33.000Z","updated_at":"2020-05-25T07:45:46.000Z","dependencies_parsed_at":"2022-09-10T15:11:08.778Z","dependency_job_id":null,"html_url":"https://github.com/hotkit/fost-beanbag","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/hotkit/fost-beanbag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotkit%2Ffost-beanbag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotkit%2Ffost-beanbag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotkit%2Ffost-beanbag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotkit%2Ffost-beanbag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hotkit","download_url":"https://codeload.github.com/hotkit/fost-beanbag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotkit%2Ffost-beanbag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32409105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T02:37:21.628Z","status":"ssl_error","status_checked_at":"2026-04-29T02:36:50.947Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":[],"created_at":"2024-11-18T23:39:56.231Z","updated_at":"2026-04-29T03:32:26.284Z","avatar_url":"https://github.com/hotkit.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Beanbag — A lightweight JSON database #\n\nBeanbag is a very lightweight ACID compliant transactional JSON database. The database itself is one or more JSON files and you interact with it through RESTful calls.\n\nIt's all very experimental so probably best used for fun rather than profit.\n\n\n# Using Beanbag #\n\nThere is no release yet, so you'll need to checkout the develop branch and try from there. After checking out develop re-read this file.\n\n## Running a Beanbag server ##\n\nThere isn't yet a simple Beanbag specific web server. The Beanbag views can be run by configuring them in the `fost-webserver` in the `fost-web` project.\n\nAfter doing a debug (i.e. a default) build the examples can be run from the root of the checkout using (for the wiki example):\n\n    bin/fost-webserver-d -p 8080 usr/share/beanbag/wiki/config-d.json\n\nOr (for the raw JSON editor):\n\n    bin/fost-webserver-d -p 8080 usr/share/beanbag/raw/config-d.json\n\nThe `-p` parameter controls the port the server will appear on.\n\n\n# Server views #\n\nThe main purpose of the Beanbag server views is to allow different ways of mapping URL paths in the request to locations within the JSON structure at the server.\n\n## beanbag.raw ##\n\nThis exposes the configured JSON data in it's entirety and unchanged. A request against the root of the view will return the entire structure, and requests against sub-paths will return the data at that location. If a path component is numeric then it will be interpreted as an array index in a JSON array.\n\nFor example, a path of:\n\n    /path/into/1/structure/\n\nWould appear as the equivalent JavaScript location:\n\n    data['path']['into'][1]['structure']\n\nIf you were to do a `PUT` to a location like this then Beanbag will create objects and arrays as required to fulfil the location. If the data already present won't allow for the type of index access your path implies then an error will be returned.\n\nWithin the view configuration there needs to be a `html` key which contains either a `template` key or a `static` key. In either case the value is a file location that provides the HTML view. If it is `static` then it is always served as is. If it is `template` then the following substitutions are made:\n\n1. `[[path]]` --- The representation of the file path the server sees as JSON data.\n2. `[[data]]` --- The representation of the JSON data at the location specified by the path.\n3. `[[etag]]` --- The ETag value for the data.\n\nFor examples see the raw and GTF demos.\n\n### Media types ###\n\nBoth `application/json` and `text/html` are supported. To receive an `application/json` response then:\n\n1. Use `application/json` in the Accept header before `text/html`. Currently, only response codes of 2xx will return JSON. Note that this means a 404 will always return `text/html`\n2.  Add `__=` to the query string. This will force JSON to be produced, but it will be returned as `text/plain` to aid in debugging from a browser.\n\n### Request methods ###\n\nCurrently `GET`, `PUT` and `DELETE` are supported. `PUT` is used for both creation of new locations inside the JSON and for updating of current values. Conditional `PUT`s (i.e. use of `If-Modified`) can be used to ensure that data has not already been changed. Clients should use the `ETag` header for this purpose. `DELETE` can also be used conditionally to ensure that recently updated information is not deleted.\n\n`PATCH` can be used against a beanbag to provide a set of transforms that are executed against the beanbag. Each transform is described by a JSON object which are collected together into an array. An empty transform list used as a `PATCH` body looks like this:\n\n    {\n        \"@context\": \"http://www.kirit.com/beanbag/patch\",\n        \"transforms\": []\n    }\n\nEach operation is a JSON object that includes a `@context` key telling us which operation to perform and then the other keys depend on the operation. Any paths are relative to the position in the beanbag that the URL path specifies.\n\nWhen the operations are executed either all or none of them transform the beanbag data -- that is, all of the operations run atomically.\n\n\n#### Add : Change counter ####\n\nAdd a number. If the path location is empty then the amount is placed at that location, otherwise it is added to that location.\n\n    {\n        \"!\": \"op:add\",\n        \"path\": [\"path\", \"to\", \"counter\"],\n        \"amount\": 3\n    }\n\n#### Created : Set the current time if it's not already set ####\n\nSets the current time at the requested position, but only if there is nothing at that location already.\n\n    {\n        \"!\": \"op:created\",\n        \"path\": [\"path\", \"to\", \"created\", \"timestamp\"]\n    }\n\n#### Now : Set current time ####\n\nThe current time is placed into the requested position in ISO format.\n\n    {\n        \"!\": \"op:now\",\n        \"path\"; [\"path\", \"to\", \"time\"]\n    }\n\n#### Remove : Remove content at the location ####\n\nRemoves the content at the requested location. There must be content there or this will fail.\n\n    {\n        \"!\": \"op:remove\",\n        \"path\"; [\"path\", \"to\", \"remove\"]\n    }\n\n\n#### Set : Set location content ####\n\nThe passed in data is unconditionally set to the specified value.\n\n    {\n        \"!\": \"op:set\",\n        \"path\": [\"path\", \"to\", \"set\"],\n        \"value\": {\"example\": \"value\"}\n    }\n\n\n## beanbag.structured ##\n\nThis exposes the JSON data in a more structured format designed to be more scalable. A JSON object is always returned for all locations and the data is placed into the `data` key. For atoms and arrays the actual data itself is replaced by a JSON object that describes where it can be found.\n\n\n# Development #\n\nThis project uses git flow. Don't forget to do `git flow init -d` after you clone it.\n\nThe `./configure` script is used to pull changes and source for the other libraries that are needed. This can be run each time upstream changes are wanted, but it does not attempt to update the main repository view.\n\nYou can then build the software by running `./compile`.\n\nA full example sequence is below:\n\n    git clone git@github.com:KayEss/beanbag.git\n    cd beanbag\n    git flow init -d\n    ./configure\n    ./compile\n    bin/fost-webserver-d -p 8080 usr/share/beanbag/wiki/config-d.json\n\nOpening a browser to show http://localhost:8080/ should show this text.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhotkit%2Ffost-beanbag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhotkit%2Ffost-beanbag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhotkit%2Ffost-beanbag/lists"}