{"id":25098163,"url":"https://github.com/gamebear64/folderdb","last_synced_at":"2025-07-06T19:33:52.034Z","repository":{"id":249394797,"uuid":"831401321","full_name":"GameBear64/FolderDB","owner":"GameBear64","description":"Filesystem based database focused on lightweight data storage and easy data preview","archived":false,"fork":false,"pushed_at":"2025-06-19T14:03:19.000Z","size":2273,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-19T15:20:44.174Z","etag":null,"topics":["bun","database","document-oriented","filesystem","javascript","json","no-server","nosql","npm","simple"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@gambar/folder-db","language":"JavaScript","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/GameBear64.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-20T12:50:47.000Z","updated_at":"2025-06-19T14:03:23.000Z","dependencies_parsed_at":"2024-09-08T14:03:49.195Z","dependency_job_id":"de3d720e-332f-4fdf-8aa8-18c47fa36145","html_url":"https://github.com/GameBear64/FolderDB","commit_stats":null,"previous_names":["gamebear64/folderdb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GameBear64/FolderDB","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameBear64%2FFolderDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameBear64%2FFolderDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameBear64%2FFolderDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameBear64%2FFolderDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GameBear64","download_url":"https://codeload.github.com/GameBear64/FolderDB/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GameBear64%2FFolderDB/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263960107,"owners_count":23536023,"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":["bun","database","document-oriented","filesystem","javascript","json","no-server","nosql","npm","simple"],"created_at":"2025-02-07T18:19:54.558Z","updated_at":"2025-07-06T19:33:51.997Z","avatar_url":"https://github.com/GameBear64.png","language":"JavaScript","readme":"# FolderDB\n\n\u003e Filesystem based database focused on lightweight data storage and easy data preview\n\n![NPM Version](https://img.shields.io/npm/v/%40gambar%2Ffolder-db)\n![NPM Downloads](https://img.shields.io/npm/d18m/%40gambar%2Ffolder-db)\n\n![Coverage](https://img.shields.io/badge/coverage-%3E95%25-green)\n![Issues](https://img.shields.io/github/issues/GameBear64/FolderDB)\n![Stars](https://img.shields.io/github/stars/GameBear64/FolderDB?style=flat)\n\n![Made With Love](https://img.shields.io/badge/Made%20With-Love-red)\n\n\n**Build using [Bun](https://bun.sh/) on [Debian](https://www.debian.org/), published to [NPM](https://www.npmjs.com/package/@gambar/folder-db).**  \n*(should work on windows and node too)*\n\n\u003cbr\u003e\n\n# Table of contents\n\n- [Installation](#installation)\n- [Documentation](#documentation)\n- [Basic usage](#basic-usage)\n- [Real world example](#real-world-example)\n- [Purpose](#purpose)\n\n\u003cbr\u003e\n\n# Installation\n\n```sh\nnpm i @gambar/folder-db\n```\n\n```js\nimport FolderDB, { CaseFormat } from '@gambar/folder-db';\n// or\nconst FolderDB = require('@gambar/folder-db').default;\nconst { CaseFormat } = require('@gambar/folder-db').enums;\n```\n\n```js\nconst db = new FolderDB({ dbPath: './db' });\n```\n\n\u003cbr\u003e\n\n# Documentation\n\n- [**Schemas**](./docs/Schemas.md)\n---\n- [**Class**](./docs/Class.md)\n- [**Read**](./docs/Read.md)\n- [**Write**](./docs/Write.md)\n---\n- [**Numbers**](./docs/Numbers.md)\n- [**Strings**](./docs/Strings.md)\n- [**Arrays**](./docs/Arrays.md)\n- [**Objects**](./docs/Objects.md)\n---\n- [**General**](./docs/General.md)\n- [**Time**](./docs/Time.md)\n---\n- [**Enums**](./docs/Enums.md)\n\n\u003cbr\u003e\n\n# Basic usage\n```js\nconst FolderDB = require('@gambar/folder-db').default;\nconst db = new FolderDB({ dbPath: './db' });\n\n//create a folder to store your users\ndb.createFolder(\"users\");\n\n//add new user\ndb.get(\"users\").createFile(\"random_id_or_hash\", { name: \"GamBar\" });\n\n//update username of user\ndb.get(\"users\")\n  .get(\"random_id_or_hash\")\n  .get(\"name\")\n  .set(\"Gamriel\");\n\n//add a a new field to user\ndb.get(\"users.random_id_or_hash\").set(\"job_title\", \"Software developer\");\n\n//add a timestamp\ndb.get('users.random_id_or_hash').setTimestamp('updated_at');\n\n//read the user\nconst myUser = db.get('users.random_id_or_hash').data;\nconsole.log(myUser);\n```\n\n\u003cbr\u003e\n\n\n# Real world example\n### database.js\n```js\nconst FolderDB = require('@gambar/folder-db').default;\n\nmodule.exports = new FolderDB({ dbPath: './db', mergeInstances: true });\n```\n\n### Register\n```js\nconst hash = shortHash(req.body.email);\n\nconst userFile = await db.get('users').get(hash).data;\nif (userFile) return res.status(409).json('User with this email already exists');\n\ndb.get('users').createFile(hash, {\n  ...req.body,\n  password: bcrypt.hashSync(req.body.password, 10),\n});\n\nres.cookie('jwt', createJWTCookie({ id: hash }), { httpOnly: true });\nres.status(201).json();\n```\n\n### Login\n```js\nconst hash = shortHash(req.body.email);\n\nconst userFile = await db.get('users').get(hash).data;\nif (!userFile) return res.status(404).json('User with this email does not exist');\n\nconst validPassword = await bcrypt.compare(req.body.password, userFile.password);\nif (!validPassword) return res.status(403).json('Incorrect password');\n\nres.cookie('jwt', createJWTCookie({ id: hash }), { httpOnly: true });\nres.status(200).json();\n```\n\n### GET /User\n```js\nconst userFile = await db.get('users').get(req.authUser.id).data;\nreturn res.status(200).json(userFile);\n```\n\n# Purpose\n\nI really like MongoDB, the document structure is great! But It needs a constantly running service, my projects don't need all that.  \nI really like SQLite, everything contained in one file is amazing! But SQL relations don't feel right to me, especially pivot tables.  \nBoth need separate apps to visualize my data.\n\nFolderDB is my solution to these problems im having, no services needed, no extra apps needed and its all locally stored.  \nSeeds and dumps can be easily done. It can be only local with `.gitignore`. And changes can be done fast trough the code editor.  \nExactly what I need for my small applications.  \n\nThis is not an enterprise solution of course, its a solution that will help me do my silly little websites/discord bots/projects.  \nContributors are welcome, if you like the idea and want to imporve it with me, make a PR or even better - contact me and let's talk!  \n\n---\n\n\u003cbr\u003e\nThank you for checking out my project.\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n---","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgamebear64%2Ffolderdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgamebear64%2Ffolderdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgamebear64%2Ffolderdb/lists"}