A modern Next.js 15 application built with React 19, TypeScript, and Tailwind CSS, providing the user interface for the COA Hub platform with Google OAuth authentication.
- Framework: Next.js 15.4.4 (App Router)
- React: 19.1.0
- TypeScript: 5
- UI Library: shadcn/ui with Radix UI primitives
- Styling: Tailwind CSS v4
- State Management: Zustand 5.0.8
- Data Fetching: TanStack React Query v5.90.5
- Authentication: NextAuth.js v5.0.0-beta.29
- Forms: React Hook Form + Zod validation
- Build Tool: Turbopack (development)
- Node.js (LTS version, v18+ recommended)
- npm package manager
- COA Hub Backend running on http://localhost:3000
- Google OAuth credentials (same as backend)
git clone https://github.com/SAMAHAN-Systems-Development/coa-hub-frontend
cd coa-hub-frontendnpm installCreate a .env.local file in the root directory:
# Windows
copy .env.example .env.local
# Linux/Mac
cp .env.example .env.localAdd the following environment variables:
# Backend API URL
NEXT_PUBLIC_API_URL=http://localhost:8000
# NextAuth Configuration
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=<generated-secret>
# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secretnode -e "console.log(require('crypto').randomBytes(32).toString('base64'))"Copy the output and use it for NEXTAUTH_SECRET.
npm run devOpen http://localhost:3000 in your browser.
The page will auto-reload when you make changes to the code.
| Command | Description |
|---|---|
npm install |
Install dependencies |
npm run dev |
Start development server with Turbopack |
npm run build |
Create optimized production build |
npm start |
Run production server |
npm run lint |
Check for linting issues |
npm run format |
Auto-format code with Prettier |
npm run format:check |
Verify code formatting |
coa-hub-frontend/
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── admin/ # Admin dashboard
│ │ ├── api/ # API routes (NextAuth)
│ │ ├── blastzone/ # Blast zone page
│ │ ├── login/ # Login page
│ │ ├── page.tsx # Home page
│ │ ├── layout.tsx # Root layout
│ │ └── globals.css # Global styles
│ ├── components/
│ │ ├── auth/ # Authentication components
│ │ ├── layout/ # Layout components
│ │ ├── shared/ # Shared UI components
│ │ └── ui/ # shadcn/ui components
│ ├── lib/
│ │ ├── api/ # API client functions
│ │ ├── config/ # Configuration
│ │ ├── hooks/ # Custom React hooks
│ │ ├── stores/ # Zustand state stores
│ │ ├── types/ # TypeScript types
│ │ ├── zod/ # Zod validation schemas
│ │ └── utils.ts # Utility functions
│ ├── hooks/ # Additional custom hooks
│ ├── providers/ # Context providers
│ ├── auth.ts # NextAuth configuration
│ └── middleware.ts # Next.js middleware
├── public/ # Static assets
├── .env.local # Environment variables (not committed)
├── next.config.ts # Next.js configuration
├── tailwind.config.ts # Tailwind CSS configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Dependencies and scripts
Ensure the backend API is running before starting the frontend:
cd ../coa-hub-backend
npm run start:devIn a separate terminal:
cd coa-hub-frontend
npm run devBefore committing changes:
# Check formatting
npm run format:check
# Auto-fix formatting
npm run format
# Check linting
npm run lintnpm run buildThis creates an optimized production build in the .next directory.
npm startThe production server runs on http://localhost:3000.
- Static pages - Pre-rendered at build time
- Dynamic pages - Rendered on-demand
- API routes - Serverless functions
This project uses shadcn/ui. To add new components:
npx shadcn@latest add button
npx shadcn@latest add dialog
npx shadcn@latest add formComponents are added to src/components/ui/ and can be customized.
Use utility classes for styling:
<div className="flex items-center gap-4 rounded-lg bg-slate-100 p-4">
<Button variant="outline">Click me</Button>
</div>Global styles in src/app/globals.css:
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
}
}- Verify backend is running on http://localhost:3000
- Check
NEXT_PUBLIC_API_URLin.env.local - Inspect network requests in browser DevTools
- Ensure
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRETmatch backend - Verify redirect URI in Google Console:
http://localhost:3000/api/auth/callback/google - Check
NEXTAUTH_URLis set correctly
- Ensure
.env.localis in the root directory - Restart development server after changes
- Check for syntax errors in
.env.local
- Stop other processes using port 3000
- Or change port:
npm run dev -- -p 3001
- Clear Next.js cache:
rm -rf .next - Delete node_modules and reinstall:
rm -rf node_modules && npm install - Check TypeScript errors:
npx tsc --noEmit
- Ensure server and client render the same content
- Check for invalid HTML nesting
- Avoid using browser-only APIs during SSR
Prettier configuration in .prettierrc:
- Semi-colons: Yes
- Quotes: Double
- Tab width: 2 spaces
- Trailing commas: ES5
- Print width: 80