{"id":13409668,"url":"https://github.com/danawoodman/sveltekit-auth-example","last_synced_at":"2025-04-19T12:07:28.669Z","repository":{"id":61656020,"uuid":"536890157","full_name":"danawoodman/sveltekit-auth-example","owner":"danawoodman","description":"An example SvelteKit app implementing a simple authentication system.","archived":false,"fork":false,"pushed_at":"2022-12-06T02:04:25.000Z","size":438,"stargazers_count":108,"open_issues_count":5,"forks_count":11,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-23T23:16:53.478Z","etag":null,"topics":["auth","authentication","daisyui","demo","javascript","svelte","sveltekit","tailwindcss","typescript"],"latest_commit_sha":null,"homepage":"https://sveltekit-auth-example.pages.dev","language":"TypeScript","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/danawoodman.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":"2022-09-15T06:19:14.000Z","updated_at":"2024-12-10T21:46:29.000Z","dependencies_parsed_at":"2023-01-24T08:45:14.171Z","dependency_job_id":null,"html_url":"https://github.com/danawoodman/sveltekit-auth-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danawoodman%2Fsveltekit-auth-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danawoodman%2Fsveltekit-auth-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danawoodman%2Fsveltekit-auth-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danawoodman%2Fsveltekit-auth-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danawoodman","download_url":"https://codeload.github.com/danawoodman/sveltekit-auth-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246156025,"owners_count":20732357,"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":["auth","authentication","daisyui","demo","javascript","svelte","sveltekit","tailwindcss","typescript"],"created_at":"2024-07-30T20:01:02.645Z","updated_at":"2025-03-30T21:31:49.919Z","avatar_url":"https://github.com/danawoodman.png","language":"TypeScript","funding_links":[],"categories":["Svelte","JavaScript/TypeScript","Top PocketBase-specific Projects (\u003e100 stars)"],"sub_categories":["Svelte"],"readme":"# SvelteKit Auth Example\n\n![image](https://user-images.githubusercontent.com/157695/190524032-cc22bf37-de46-4d9b-aa05-1c2ef7fca60f.png)\n\n\u003e An example SvelteKit app implementing a variety of authentication backends\n\n[**View the demo**](https://sveltekit-auth-example.pages.dev)\n\n**NOTE: this is very much a work in progress!**\n\nThis project is designed as a sample implementation reference for getting authentication setup using SvelteKit. At this stage, I'd recommend just using it as something to refer to when building out your own app.\n\n### Tools:\n\n- SvelteKit\n- TypeScript\n- TailwindCSS\n- DaisyUI for basic UI components\n- svelte-fa for FontAwesome icons\n- neverthrow for elegantly handling exceptions\n\n### Features:\n\n- Form actions to login and signup\n- Store the users's auth token in a cookie\n- Fetch the user in the `handle` hook in `hooks.server`\n- Implementation of a basic session store\n- Use route (groups) to protect pages\n- Authenticate API endpoints via an auth token (`Authorization: Bearer \u003cTOKEN\u003e` header)\n- Log out\n\n## Setup\n\n```shell\nnpm install\n```\n\n## Development\n\n```shell\nnpm run dev\n\n# Run with debug logging:\nDEBUG=\"app:*\" npm run dev\n```\n\nTo debug in the browser, open up the `Console` in DevTools and type:\n\n```js\nlocalStorage.debug = \"app:*\";\n```\n\n### Using auth adapters\n\nThis project is built in a way to abstract the authentication layer so that you can pick and choose which type of auth you want to use.\n\nRight now, we support the following auth adapters:\n\n- `cookie` - Stores users and the auth token in a cookie. The is purely for demo purposes as it means we don't need any backend. You should NOT use this in production.\n- `pocketbase` - Uses [PocketBase](https://pocketbase.io) as the backend. All you need to do is follow their setup guide and then run `./pocketbase serve` and you should be up and running.\n\nYou can enable the adapter you want by commenting out the adapter you want in `src/lib/auth/index.ts`. Make sure all other adapters are commented out.\n\nThen just configure your adapter backend and run the dev server!\n\n## License\n\nMIT\n\n## Credits\n\nCopyright Dana Woodman 2022\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanawoodman%2Fsveltekit-auth-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanawoodman%2Fsveltekit-auth-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanawoodman%2Fsveltekit-auth-example/lists"}