Production-oriented auth starter for projects that need a strong account system from day one.
This repository is intentionally not a minimal boilerplate. It is an opinionated auth starter with:
- email-first accounts
- optional OAuth login
- email verification
- password reset
- JWT access tokens
- Redis-backed refresh sessions
- baseline rate limiting
- observability-ready backend defaults
Use this template when authentication and member management should be part of the real product foundation.
Good fit:
- customer-facing web products
- collaboration tools with invitations and protected deep links
- services that want email login plus optional OAuth convenience
- teams that are comfortable with MySQL and Redis as default infra
Less ideal:
- throwaway prototypes
- projects that want no Redis dependency
- products that want OAuth-only identity and nothing else
- Email is the primary account identifier.
- OAuth is optional convenience, not the only supported access path.
- Protected routes should preserve
returnTo. - Post-login navigation should use
returnTofirst, then the configured authenticated home path. - Bundled authenticated pages are examples, not mandatory product structure.
- The default frontend auth protection model is client-side for authenticated app areas.
- Kotlin + Spring Boot 4
- Spring Security
- Spring Modulith boundaries
- MySQL + Flyway
- Redis for refresh sessions, verification tokens, password reset tokens, and rate limiting
- email verification and password reset flows
- optional Google / Naver / Kakao OAuth
- Actuator + Micrometer + Prometheus + Grafana
- unit tests and integration tests
- Next.js 16 + React 19
- next-intl
- TanStack Query
- Zustand
- auth pages for login, signup, forgot password, reset password, verify email, and OAuth callback
returnTosupport for protected pages and invitation-style deep links- sample authenticated account pages
auth-template/
|-- backend/
| |-- src/main/kotlin
| |-- src/main/resources
| |-- src/test/kotlin
| |-- docker-compose.yml
| |-- docker-compose.storage.yml
| |-- .env.example
| `-- OBSERVABILITY.md
|-- frontend/
| |-- src
| |-- messages
| |-- public
| |-- .env.example
| |-- AUTH_MODEL.md
| `-- README.md
`-- README.md
- copy
backend/.env.exampletobackend/.env - copy
frontend/.env.exampletofrontend/.env.local
cd backend
docker compose up -d mysql redisOptional observability:
cd backend
docker compose --profile observability up -d prometheus grafanaOptional object storage:
cd backend
docker compose -f docker-compose.yml -f docker-compose.storage.yml up -d minioBackend:
cd backend
./gradlew bootRunFrontend:
cd frontend
pnpm install
pnpm devBackend unit tests:
cd backend
./gradlew testBackend integration tests:
cd backend
./gradlew integrationTestFrontend:
cd frontend
pnpm build- Redis is a core dependency in this starter.
- OAuth is optional, but email login remains the baseline path.
- OAuth and HIBP external lookup can be controlled with explicit feature flags.
- The current OAuth locale and return-to handoff uses the server session during the OAuth round-trip.
- The bundled
dashboardroute is a sample authenticated area and should usually be replaced in a real project. - Authenticated route protection in the frontend is intentionally CSR-first. Server-component or SSR-protected product pages need extra project-specific work.