```
You are an expert Next.js 15 + TypeScript developer.
Build me a frontend application with the following requirements:
1. **Tech Stack**
- Next.js 15 (App Router, React Server Components)
- TypeScript
- TailwindCSS for styling
- ShadCN/UI components for forms, buttons, modals, tables
- NextAuth.js for authentication (JWT or session cookies)
2. **Utility Function**
- Create a reusable generic API helper function `apiRequest<T>()` in `lib/apiRequest.ts`.
- Signature:
- `endpoint: string` (e.g. `/api/posts`)
- `method?: "GET" | "POST" | "PUT" | "DELETE"`
- `body?: unknown`
- `headers?: Record<string, string>`
- Returns `Promise<T>` where `T` is provided at call time.
- Automatically:
- Gets the current session (via `getSession()` or `auth()` in server components).
- If a bearer token exists in the session, attach `Authorization: Bearer <token>`.
- Otherwise forward cookies for session-based auth.
- Handles JSON body β¦