A full-stack authentication template with Go backend (Fiber) and Next.js 15 frontend (NextAuth v5).
- Google OAuth Integration - Seamless sign-in with Google
- JWT Authentication - Secure session management with refresh tokens
- User Management - CRUD operations and user directory
- CORS Protection - Environment-aware configuration
- PostgreSQL Database - Robust data persistence with GORM
cd backend
go mod download
# Set up .env with DATABASE_URL, JWT_SECRET, INTERNAL_SYNC_TOKEN
go run main.gocd frontend
npm install
# Set up .env.local with Google OAuth credentials
npm run dev- Backend: Go + Fiber + PostgreSQL + GORM
- Frontend: Next.js 15 + NextAuth v5 + TypeScript + Tailwind CSS
- Authentication: JWT + HTTP-only cookies + Google OAuth
POST /auth/internal/sso-sync- SSO synchronizationGET /users/bulk- Get all users (authenticated)GET /users/:id- Get specific user (authenticated)
- JWT validation and revocation
- Environment-specific CORS
- Secure headers
DATABASE_URL=postgresql://user:pass@localhost:5432/db
JWT_SECRET=your-secret
INTERNAL_SYNC_TOKEN=your-token
ENV=developmentGOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-secret
NEXTAUTH_SECRET=your-secret
API_BASE=http://localhost:8080- Set
ENV=production - Configure
FRONTEND_PROD_URL - Environment-specific database configs
Built with Go, Fiber, Next.js, and NextAuth