Reusable Next.js dashboard with Google OAuth, data ingestion, and Vercel deployment.
# 1. Install dependencies
npm install
# 2. Set up environment
cp .env.local.example .env.local
# Fill in your Google OAuth credentials and allowed domains/emails# 3. Run dev server
npm run dev- Go to Google Cloud Console
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
http://localhost:3000/api/auth/callback/google - Copy Client ID and Secret to
.env.local - Generate NEXTAUTH_SECRET:
openssl rand -base64 32
Parse Excel or PDF files into JSON:
# Excel
npx tsx src/scripts/ingest.ts data.xlsx public/data/output.json
# PDF
npx tsx src/scripts/ingest.ts report.pdf public/data/output.jsonConfigure via environment variables (no code changes needed):
| Variable | Example | Description |
|---|---|---|
ALLOWED_DOMAINS | @techolution.com,@google.com | Comma-separated domain suffixes |
ALLOWED_EMAILS | user@external.com | Comma-separated individual emails |
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Set env vars
vercel env add GOOGLE_CLIENT_ID
vercel env add GOOGLE_CLIENT_SECRET
vercel env add NEXTAUTH_SECRET
vercel env add NEXTAUTH_URL
vercel env add ALLOWED_DOMAINS
vercel env add ALLOWED_EMAILSAdd https://your-project.vercel.app/api/auth/callback/google to Google OAuth authorized redirect URIs.
src/
app/
layout.tsx — Root layout (nav, auth, analytics)
page.tsx — Dashboard home (customize this)
login/page.tsx — Login page
api/auth/[...nextauth]/ — Auth config
components/
Navigation.tsx — Top nav (edit NAV_ITEMS and APP_NAME)
SessionProvider.tsx — Auth wrapper
lib/
data.ts — Data loading utilities
scripts/
ingest.ts — Excel/PDF → JSON parser
middleware.ts — Route protection
public/data/ — Static JSON data files
- Navigation: Edit
NAV_ITEMSandAPP_NAMEinsrc/components/Navigation.tsx - Pages: Add new routes in
src/app/ - Styling: Edit CSS variables in
src/app/globals.css - Data: Put JSON files in
public/data/or create API routes for protected data