- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4
Add user accounts, domain ownership verification, expiry notifications #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Draft
      
      
            jakejarvis
  wants to merge
  19
  commits into
  main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
feat/accounts
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Draft
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            19 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      96f8332
              
                Add Better Auth integration with user, session, account, and verifica…
              
              
                jakejarvis 518c162
              
                Update .env.example to include NEXT_PUBLIC_APP_URL and enhance AppHea…
              
              
                jakejarvis f201795
              
                Add authentication middleware and create login and dashboard pages
              
              
                jakejarvis a290b2c
              
                Add test router and implement authentication middleware for session m…
              
              
                jakejarvis 0276c53
              
                Add user_domains table and verification method enum to database schema
              
              
                jakejarvis 727dcfa
              
                Add domains router for domain ownership verification and implement ve…
              
              
                jakejarvis c05fc2b
              
                Add email service integration with Resend for domain registration exp…
              
              
                jakejarvis 918fba7
              
                Add email templates for password reset and email verification
              
              
                jakejarvis 119ee49
              
                Integrate magic link authentication and simplify user menu sign-in flow
              
              
                jakejarvis e2b85aa
              
                Add domain snapshots and notification log/preferences tables to datab…
              
              
                jakejarvis 54257c7
              
                Add notification system for domain changes, including email templates…
              
              
                jakejarvis babec1a
              
                Refactor dashboard page to use client-side session management and enh…
              
              
                jakejarvis 242505b
              
                Refactor routing imports to use custom useRouter hook across componen…
              
              
                jakejarvis 17a6932
              
                Remove unused authentication demo and test pages to streamline the ap…
              
              
                jakejarvis 2be6ed1
              
                Add @react-email/render dependency, remove magic link example, and up…
              
              
                jakejarvis a031568
              
                Enhance section revalidation by converting domains to registrable for…
              
              
                jakejarvis d16cd24
              
                Implement login page with Better Auth integration, including magic li…
              
              
                jakejarvis 508f82a
              
                Refactor copy functionality to use custom hook for clipboard operatio…
              
              
                jakejarvis 9718faa
              
                Add settings page with account and notification management; implement…
              
              
                jakejarvis File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
          Some comments aren't visible on the classic Files Changed page.
        
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import { toNextJsHandler } from "better-auth/next-js"; | ||
| import { auth } from "@/lib/auth/config"; | ||
|  | ||
| export const { GET, POST } = toNextJsHandler(auth.handler); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| import { serve } from "inngest/next"; | ||
| import { inngest } from "@/lib/inngest/client"; | ||
| import { checkExpirations } from "@/lib/inngest/functions/check-expirations"; | ||
| import { sectionRevalidate } from "@/lib/inngest/functions/section-revalidate"; | ||
|  | ||
| // opt out of caching per Inngest docs | ||
| export const dynamic = "force-dynamic"; | ||
|  | ||
| export const { GET, POST, PUT } = serve({ | ||
| client: inngest, | ||
| functions: [sectionRevalidate], | ||
| functions: [sectionRevalidate, checkExpirations], | ||
| }); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| "use client"; | ||
|  | ||
| import { DomainList } from "@/components/dashboard/domain-list"; | ||
| import { useRouter } from "@/hooks/use-router"; | ||
| import { useSession } from "@/lib/auth/client"; | ||
|  | ||
| export default function DashboardPage() { | ||
| const { data: session, isPending } = useSession(); | ||
| const router = useRouter(); | ||
|  | ||
| // Show loading state while checking auth | ||
| if (isPending) { | ||
| return ( | ||
| <div className="container mx-auto max-w-6xl px-4 py-6"> | ||
| <div className="space-y-6"> | ||
| <div className="flex items-center justify-between"> | ||
| <div className="space-y-2"> | ||
| <div className="h-9 w-48 animate-pulse rounded-md bg-muted" /> | ||
| <div className="h-4 w-64 animate-pulse rounded bg-muted" /> | ||
| </div> | ||
| </div> | ||
| <div className="h-96 animate-pulse rounded-xl bg-muted" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|  | ||
| if (!session) { | ||
| router.push("/login?redirect=/dashboard"); | ||
| return null; | ||
| } | ||
|  | ||
| return ( | ||
| <div className="container mx-auto max-w-6xl px-4 py-6"> | ||
| <div className="space-y-6"> | ||
| <div className="flex items-center justify-between"> | ||
| <div> | ||
| <h1 className="font-semibold text-3xl tracking-tight"> | ||
| My Domains | ||
| </h1> | ||
| <p className="text-muted-foreground text-sm"> | ||
| Monitor and manage your verified domains | ||
| </p> | ||
| </div> | ||
| </div> | ||
|  | ||
| <DomainList /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| "use client"; | ||
|  | ||
| import { useQuery } from "@tanstack/react-query"; | ||
| import { notFound, useParams } from "next/navigation"; | ||
| import { VerificationInstructions } from "@/components/dashboard/verification-instructions"; | ||
| import { VerificationInstructionsSkeleton } from "@/components/dashboard/verification-instructions-skeleton"; | ||
| import { useRouter } from "@/hooks/use-router"; | ||
| import { useSession } from "@/lib/auth/client"; | ||
| import { useTRPC } from "@/lib/trpc/client"; | ||
|  | ||
| export default function VerifyDomainPage() { | ||
| const params = useParams<{ id: string }>(); | ||
| const { data: session, isPending: sessionPending } = useSession(); | ||
| const trpc = useTRPC(); | ||
| const router = useRouter(); | ||
|  | ||
| // Fetch user domain details (call hooks before any conditional returns) | ||
| const { | ||
| data: userDomain, | ||
| isPending: domainPending, | ||
| isError, | ||
| } = useQuery(trpc.domains.getForVerification.queryOptions({ id: params.id })); | ||
|  | ||
| // Wait for session | ||
| if (sessionPending) { | ||
| return ( | ||
| <div className="container mx-auto max-w-3xl px-4 py-6"> | ||
| <VerificationInstructionsSkeleton /> | ||
| </div> | ||
| ); | ||
| } | ||
|  | ||
| if (!session) { | ||
| router.push("/login?redirect=/dashboard"); | ||
| return null; | ||
| } | ||
|  | ||
| if (domainPending) { | ||
| return ( | ||
| <div className="container mx-auto max-w-3xl px-4 py-6"> | ||
| <VerificationInstructionsSkeleton /> | ||
| </div> | ||
| ); | ||
| } | ||
|  | ||
| if (isError || !userDomain) { | ||
| notFound(); | ||
| } | ||
|  | ||
| // If already verified, redirect to dashboard | ||
| if (userDomain.verified) { | ||
| router.push("/dashboard"); | ||
| return null; | ||
| } | ||
|  | ||
| return ( | ||
| <div className="container mx-auto max-w-3xl px-4 py-6"> | ||
| <VerificationInstructions | ||
| userDomainId={userDomain.id} | ||
| domainName={userDomain.domain} | ||
| verificationToken={userDomain.verificationToken} | ||
| /> | ||
| </div> | ||
| ); | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| "use client"; | ||
|  | ||
| import { useSearchParams } from "next/navigation"; | ||
| import { LoginForm } from "@/components/auth/login-form"; | ||
| import { | ||
| Card, | ||
| CardContent, | ||
| CardDescription, | ||
| CardHeader, | ||
| CardTitle, | ||
| } from "@/components/ui/card"; | ||
|  | ||
| /** | ||
| * Login page with Better Auth integration. | ||
| * Supports magic link email and OAuth (GitHub, Google) authentication. | ||
| */ | ||
| export default function LoginPage() { | ||
| const searchParams = useSearchParams(); | ||
| const redirectTo = searchParams.get("redirect") || "/dashboard"; | ||
|  | ||
| return ( | ||
| <div className="container mx-auto flex min-h-screen items-center justify-center p-4"> | ||
| <Card className="w-full max-w-md"> | ||
| <CardHeader> | ||
| <CardTitle>Sign in</CardTitle> | ||
| <CardDescription> | ||
| Choose your preferred sign in method | ||
| </CardDescription> | ||
| </CardHeader> | ||
| <CardContent> | ||
| <LoginForm redirectTo={redirectTo} /> | ||
| </CardContent> | ||
| </Card> | ||
| </div> | ||
| ); | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| "use client"; | ||
|  | ||
| import { redirect } from "next/navigation"; | ||
| import { SettingsLayout } from "@/components/settings/settings-layout"; | ||
| import { useSession } from "@/lib/auth/client"; | ||
|  | ||
| export default function SettingsPage() { | ||
| const { data: session, isPending } = useSession(); | ||
|  | ||
| if (isPending) { | ||
| return ( | ||
| <div className="container mx-auto max-w-4xl px-4 py-6"> | ||
| <div className="space-y-6"> | ||
| <div className="space-y-2"> | ||
| <div className="h-8 w-48 animate-pulse rounded bg-muted" /> | ||
| <div className="h-4 w-96 animate-pulse rounded bg-muted" /> | ||
| </div> | ||
| <div className="h-96 animate-pulse rounded-xl bg-muted" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|  | ||
| if (!session) { | ||
| redirect("/login?redirect=/settings"); | ||
| } | ||
|  | ||
| return ( | ||
| <div className="container mx-auto max-w-4xl px-4 py-6"> | ||
| <div className="space-y-6"> | ||
| <div> | ||
| <h1 className="font-semibold text-3xl tracking-tight">Settings</h1> | ||
| <p className="text-muted-foreground text-sm"> | ||
| Manage your account and notification preferences | ||
| </p> | ||
| </div> | ||
|  | ||
| <SettingsLayout /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.