{"id":50982164,"url":"https://github.com/joscha0/k3s-test","last_synced_at":"2026-06-19T15:33:31.276Z","repository":{"id":365873953,"uuid":"1265084276","full_name":"joscha0/k3s-test","owner":"joscha0","description":"Minimal full-stack authentication demo running in a k3d-managed K3s cluster with dashboard to visualize the requests","archived":false,"fork":false,"pushed_at":"2026-06-19T08:17:21.000Z","size":75,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-19T10:15:56.033Z","etag":null,"topics":["authentication","k3d","k3s","kubernetes"],"latest_commit_sha":null,"homepage":"","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/joscha0.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-10T12:58:18.000Z","updated_at":"2026-06-19T08:17:25.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/joscha0/k3s-test","commit_stats":null,"previous_names":["joscha0/k3s-test"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/joscha0/k3s-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joscha0%2Fk3s-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joscha0%2Fk3s-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joscha0%2Fk3s-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joscha0%2Fk3s-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joscha0","download_url":"https://codeload.github.com/joscha0/k3s-test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joscha0%2Fk3s-test/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34538220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["authentication","k3d","k3s","kubernetes"],"created_at":"2026-06-19T15:33:28.760Z","updated_at":"2026-06-19T15:33:31.269Z","avatar_url":"https://github.com/joscha0.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# K3s Authentication Demo\n\n\u003cimg width=\"2851\" height=\"1638\" alt=\"image\" src=\"https://github.com/user-attachments/assets/14c9237f-d30d-4e0a-8b54-139af8a6bde9\" /\u003e\n\n\nMinimal full-stack authentication demo running in a k3d-managed K3s cluster:\n\n`browser -\u003e k3d nginx serverlb -\u003e Traefik Ingress -\u003e frontend/backend -\u003e MongoDB`\n\nThe generated k3d nginx load balancer maps [http://localhost:8080](http://localhost:8080) to port 80 on the single K3s server. Traefik and Kubernetes Services route and balance application traffic across two frontend and two backend replicas.\n\n## Prerequisites\n\n- Docker\n- k3d\n- kubectl\n- Node.js 24 and pnpm for local development\n\n## Run\n\n```bash\ncp .env.example .env\n# Change every secret value in .env.\n./scripts/up.sh\n./scripts/smoke.sh\n```\n\nDelete the environment with `./scripts/down.sh`. The MongoDB volume belongs to the disposable k3d cluster and is removed with it.\n\nThe scripts generate and use `.kube/k3d-k3s-test.yaml` explicitly. They do not read or modify the host K3s kubeconfig at `/etc/rancher/k3s/k3s.yaml`.\n\n### Make User Admin\n\nOpen MongoDB:\n\n```bash\nkubectl --kubeconfig .kube/k3d-k3s-test.yaml exec -it -n k3s-auth mongodb-0 -- sh -lc \\\n  'mongosh --username \"$MONGO_INITDB_ROOT_USERNAME\" --password \"$MONGO_INITDB_ROOT_PASSWORD\" --authenticationDatabase admin k3s_auth'\n```\n\nMake User Admin\n\n```js\ndb.users.updateOne(\n  { username: \"test\" },\n  { $set: { role: \"admin\", updatedAt: new Date() } },\n);\n```\n\n## Application\n\n- `Hello World` is public.\n- `Hello User` requires a signed-in user.\n- `Hello Admins` requires the `admin` role.\n- `/dashboard` gives admins a live architecture view with pod CPU and memory usage, configured requests and limits, recent request flows, and pod deletion controls.\n- Sign-up creates normal users. The configured bootstrap account is created or promoted to admin whenever a backend pod starts.\n- Access JWTs live for 15 minutes and remain in browser memory. Rotating refresh tokens live for seven days in an HttpOnly, SameSite cookie.\n\nThe dashboard reads pod usage from the K3s Metrics Server. Metrics may briefly show as unavailable while a new pod or the metrics pipeline becomes ready.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoscha0%2Fk3s-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoscha0%2Fk3s-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoscha0%2Fk3s-test/lists"}