App Router
Tracera uses the Next.js App Router (introduced in Next.js 13, matured in 16) for file-system based routing with React Server Components.Pages
| Route | File | Auth | Description |
|---|---|---|---|
/ | app/page.tsx | No | Home page — redirects to /dashboard or /login |
/login | app/login/page.tsx | No | Login page with OAuth and magic link options |
/dashboard | app/dashboard/page.tsx | Yes | User profile and dashboard |
Root Layout
The root layout (app/layout.tsx) wraps all pages with:
ThemeProvider— enables dark/light mode switchingAuthProvider— provides authentication context to all client components- Global styles — Tailwind CSS base styles and fonts
Authentication Flow
Home Page (/)
The home page checks authentication status server-side and redirects:
- Authenticated →
/dashboard - Not authenticated →
/login
Login Page (/login)
Displays available authentication options:
- OAuth buttons for configured providers (Google, GitHub, Steam)
- Magic link email form
- Dynamically hides providers that aren’t configured
Dashboard (/dashboard)
Protected page that requires authentication:
- Server-side session check redirects to
/loginif unauthenticated - Displays user profile information
- Shows linked authentication providers
- Theme toggle and logout functionality
Server Actions
Server Actions inapp/actions/auth.ts handle authentication mutations:
| Action | Description |
|---|---|
logout() | Calls backend logout endpoint with CSRF token |
requestMagicLink(email) | Sends magic link request to backend |