{"id":23840322,"url":"https://github.com/damianmcclure/jsalphadb","last_synced_at":"2026-05-03T23:32:53.583Z","repository":{"id":57283994,"uuid":"116453037","full_name":"damianmcclure/jsalphadb","owner":"damianmcclure","description":"Database system for NodeJS \u0026 Port of phpAlphaDB","archived":false,"fork":false,"pushed_at":"2021-02-15T06:42:58.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-03-30T09:20:31.670Z","etag":null,"topics":["database","javascript","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/damianmcclure.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-01-06T04:25:19.000Z","updated_at":"2023-04-11T15:22:04.000Z","dependencies_parsed_at":"2022-09-10T09:55:16.847Z","dependency_job_id":null,"html_url":"https://github.com/damianmcclure/jsalphadb","commit_stats":null,"previous_names":["mcclureski/jsalphadb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damianmcclure%2Fjsalphadb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damianmcclure%2Fjsalphadb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damianmcclure%2Fjsalphadb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damianmcclure%2Fjsalphadb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damianmcclure","download_url":"https://codeload.github.com/damianmcclure/jsalphadb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240125030,"owners_count":19751622,"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":["database","javascript","nodejs"],"created_at":"2025-01-02T17:31:14.312Z","updated_at":"2026-05-03T23:32:48.564Z","avatar_url":"https://github.com/damianmcclure.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsalphadb\nSimple flat-file database system for NodeJS \u0026amp; Port of phpAlphaDB\nVersion: 1.0.3\n\n## Installation\nI recommend you install from NPM\u003cbr\u003e\n`npm install jsalphadb`\u003cbr\u003e\n\u003cbr\u003e\nPut this at the top of your javascript file.\n\n```js\nvar key = \"Something\"; // The secret key, though theres no point to changing it.\nvar ext = \".4db\"; // The extension of the database.\n\nconst jsAlphaDB = require(\"jsalphadb\");\nconst db = new jsAlphaDB(key, ext);\n```\nMake sure node is allowed to write to the filesystem.\n\n## Description\nThis is a Node.js remake of the flatfile database system made by HeapOverride called phpAlphaDB.\nThe purpose is to create a basic, easy to learn and use flat database system for JavaScript\n\nThis was made when I was in my JavaScript infancy, so I did a lot of things wrong and wrote a lot of messy code.\nSince I saw there were still weekly downloads, I decided I should maintain it again and give it a little clean-up.\n\n## Docs\nThere is the legacy fully synchronous version still in the program, and it's exactly the same syntax as before. However, I will always recommend you use promises as they are non-blocking.\n\n```js\nconst Alpha = require(\"jsalphadb\");\n\n// make a new database instance\nconst db = new Alpha(\"test\");\nconst table = \"my table\";\n\n// create a table\ndb.create(table); // will be \"my_table\" on the filesystem, returns true or false if it was successful in creating it.\n\n// add some data\ndb.write(table, `id=${Date.now()} name=${db.en(\"John Smith\")} role=admin`); // each of these returns true or false if it was successful in writing it.\ndb.write(name, `id=${Date.now()} name=${db.en(\"James Kenny\")} role=user`); // since we have spaces in the name, we need to encode it for it to be stored properly.\ndb.write(name, `id=${Date.now()} name=${db.en(\"Jim Johnson\")} role=user`);\n\n// get some data\nconst rows = db.read(name, \"role=admin\", \"name role\"); // will return James Kenny and Jim Johnson rows, with name and role. excluses the id row cuz we didn't select it.\nfor(const row of rows){\n    // extract the data from the rows\n    const name = db.de(db.column(row, \"name\")); // since we have encoded the name, we need to decode it now.\n    const role = db.column(row, \"role\"); // role is plaintext\n}\n\n// delete some data\ndb.rowdelete(name, `name=${db.en(\"Jim Johnson\")}`); // will remove the Jim Johnson row in our table.\n\n// all of the same stuff but with promises\n(async () =\u003e {\n    const db = new Alpha.promises(\"test\");\n    const table = \"my async table\";\n\n    await db.create(table);\n\n    await db.write(table, `id=${Date.now()} name=${db.en(\"John Smith\")} role=admin`);\n    await db.write(name, `id=${Date.now()} name=${db.en(\"James Kenny\")} role=user`);\n    await db.write(name, `id=${Date.now()} name=${db.en(\"Jim Johnson\")} role=user`);\n\n    const rows = await db.read(name, \"role=admin\", \"name role\");\n    for await(const row of rows){\n        const name = await db.de(db.column(row, \"name\"));\n        const role = await db.column(row, \"role\");\n    }\n\n    // delete some data\n    await db.rowdelete(name, `name=${db.en(\"Jim Johnson\")}`);\n})();\n```\n\n## License\nWTFPL - http://www.wtfpl.net/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamianmcclure%2Fjsalphadb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamianmcclure%2Fjsalphadb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamianmcclure%2Fjsalphadb/lists"}