Skip to content

Add GitHub OAuth with Better Auth, D1, and Octokit#2

Merged
stylessh merged 1 commit into
mainfrom
stylessh/github-auth
Apr 7, 2026
Merged

Add GitHub OAuth with Better Auth, D1, and Octokit#2
stylessh merged 1 commit into
mainfrom
stylessh/github-auth

Conversation

@stylessh
Copy link
Copy Markdown
Owner

@stylessh stylessh commented Apr 7, 2026

Summary

  • Adds GitHub OAuth authentication using Better Auth with the tanstackStartCookies plugin for TanStack Start
  • Sets up Cloudflare D1 database with Drizzle ORM (user, session, account, verification tables) and initial migration
  • Adds Octokit integration to fetch GitHub API on behalf of authenticated users (stored access tokens)
  • Implements login page, protected route layout, dashboard, and a repo list on the home page to verify API access

Setup

  1. Create a GitHub OAuth App (callback: http://localhost:3000/api/auth/callback/github)
  2. Create D1 database: npx wrangler d1 create quickhub-db and update database_id in wrangler.jsonc
  3. Copy .dev.vars.example to .dev.vars and fill in credentials
  4. Apply migration: npx wrangler d1 migrations apply quickhub-db --local

@stylessh stylessh merged commit 8ed6797 into main Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant