{"id":16991964,"url":"https://github.com/alectrocute/fastify-nedb-auth-boilerplate","last_synced_at":"2026-04-04T16:33:30.204Z","repository":{"id":106113062,"uuid":"261872367","full_name":"alectrocute/fastify-nedb-auth-boilerplate","owner":"alectrocute","description":"a simple API boilerplate for server-side auth with fastify and nedb 💡","archived":false,"fork":false,"pushed_at":"2020-05-06T21:01:14.000Z","size":1983,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-08T20:57:21.558Z","etag":null,"topics":["api","auth","authentication","boilerplate","db","example","express","fastify","javascript","js","nedb","node","nodejs","server","user"],"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/alectrocute.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-06T20:33:30.000Z","updated_at":"2022-11-26T21:08:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"46ce04f7-da0a-42bb-8ad4-fa90b42c1e26","html_url":"https://github.com/alectrocute/fastify-nedb-auth-boilerplate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alectrocute/fastify-nedb-auth-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alectrocute%2Ffastify-nedb-auth-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alectrocute%2Ffastify-nedb-auth-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alectrocute%2Ffastify-nedb-auth-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alectrocute%2Ffastify-nedb-auth-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alectrocute","download_url":"https://codeload.github.com/alectrocute/fastify-nedb-auth-boilerplate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alectrocute%2Ffastify-nedb-auth-boilerplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31405704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"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":["api","auth","authentication","boilerplate","db","example","express","fastify","javascript","js","nedb","node","nodejs","server","user"],"created_at":"2024-10-14T03:27:54.376Z","updated_at":"2026-04-04T16:33:30.174Z","avatar_url":"https://github.com/alectrocute.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# fastify-nedb-auth-boilerplate\n\na simple API boilerplate for server-side auth with fastify and nedb 💡\n\nIf you hate databases that run binaries and are comfortable with JS - then this boilerplate may be for you.\n\nIt also features ~~shoddy~~ best password security practices (so even if baddies get that sweet, [sweet static-file nedb database](https://github.com/louischatriot/nedb), it'll just have a bunch of [salted hashes]([https://en.wikipedia.org/wiki/Salt_(cryptography)](https://en.wikipedia.org/wiki/Salt_(cryptography)))).\n\n## Ingredients\n\n* [fastify](https://www.fastify.io/)\n* [fastify-cookie](https://github.com/fastify/fastify-cookie)\n* [fastify-session](https://www.npmjs.com/package/fastify-session)\n* [nedb](https://github.com/louischatriot/nedb)\n\n## Getting Started\n\nAssuming you have any version of Node.js installed...\n\n#### Clone and install dependencies\n\n```bash\ngit clone https://github.com/alectrocute/fastify-nedb-auth-boilerplate.git boilerplate;\ncd boilerplate;\nnpm i;\n```\n\n\u003chr\u003e\n\n#### Config\n\nIn the file `config.js` –\n\n```js\n{\n   // sessions\n   secret: \"ExCL45zXxL5LuAWqcFswQBvX11FiKYNRoawivW8KjH0UuKJDLysYMkhgwkrh\",\n   cookieName: \"boilerplate_cookie_example\",\n   // nedb compaction rate\n   compactInterval: 5000,\n   // for fastify server\n   hostname: \"localhost\",\n   port: 3000,\n }\n```\n\n#### Run\n\n```bash\nnpm run serve\n```\n\n\n## Endpoints\n\n#### POST /api/register\n\nRegisters an account.\n\nExpects JSON, payload example:\n\n```js\n{\n  \"email\": \"ceo@ecorp.com\",\n  \"password\": \"hunter1\"\n  \"passwordConfirm\": \"hunter1\"\n}\n```\n\n\u003chr\u003e\n\n#### POST /api/login\n\nAuthenticates and creates a session for the user.\n\nExpects JSON, payload example:\n\n```js\n{\n  \"email\": \"ceo@ecorp.com\",\n  \"password\": \"hunter1\"\n}\n```\n\n\u003chr\u003e\n\n#### PUT /api/account\n\nModifies details in the authenticated user's database entry.\n\nExpects JSON, payload example:\n\n```js\n{\n  \"email\": \"ceo@ecorp.com\",\n  \"key\": \"meta.subscriberActive\",\n  \"value\": \"true\"\n}\n```\n\n\u003chr\u003e\n\n#### GET /api/session\n\nReturns the server-persisted session of the requester, if any.\n\nReturns JSON, payload example:\n\n```js\n200\n\n{\n  \"email\": \"ceo@ecorp.com\",\n  \"salt\": \"3rh808j0n#2f9\"\n}\n```\n\n\u003chr\u003e\n\n#### GET /api/logout\n\nRemoves the requester's session, if any.\n\nReturns JSON, payload example:\n\n```js\n200\n\n{\n  \"res\": \"true\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falectrocute%2Ffastify-nedb-auth-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falectrocute%2Ffastify-nedb-auth-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falectrocute%2Ffastify-nedb-auth-boilerplate/lists"}