How kshitijomkar/starter works
Purpose and Entry Points
Vortex is a full-stack authentication starter: a Next.js App Router UI fronts a Spring Boot REST API that persists users and issues JWTs. Browser entry routes include landing, login, signup, and protected-style dashboard pages under frontend/src/app/page.tsx, frontend/src/app/login/page.tsx, and frontend/src/app/dashboard/page.tsx. Backend startup is backend/src/main/java/com/example/demo/DemoApplication.java.
Frontend Application Layer
The frontend is a TypeScript/Next.js application using the App Router, global layout, and Tailwind styling. Its route components own browser-facing login/signup requests and JWT session handling via local storage, while the dashboard consumes that client session state. Key UI boundaries are frontend/src/app/layout.tsx, frontend/src/app/signup/page.tsx, and frontend/src/app/dashboard/page.tsx.
Frontend-to-API Boundary
Next.js is configured as the browser-facing API proxy: /auth/* requests are rewritten to the Spring Boot backend, avoiding direct client coupling to backend hostnames for those routes. The frontend API/runtime configuration is in frontend/next.config.mjs and frontend/.env.example; backend API handling begins in backend/src/main/java/com/example/demo/controller/AuthController.java.
Authentication and Security Pipeline
Signup/login requests enter the auth controller, are validated/mapped to request models, delegated to JWT/password services and persistence, then return an authentication response. Spring Security is stateless: JwtAuthenticationFilter extracts and validates bearer tokens before protected request processing; SecurityConfig defines route authorization and filter-chain behavior. Core paths: backend/src/main/java/com/example/demo/config/SecurityConfig.java, backend/src/main/java/com/example/demo/config/JwtAuthenticationFilter.java, and backend/src/main/java/com/example/demo/service/JwtService.java.
Backend API and Error Boundary
Spring Boot exposes REST endpoints for authentication plus operational/basic endpoints. Controllers are the HTTP boundary; centralized exception handling produces consistent failures rather than leaking persistence/service errors. Health is explicitly available for platform checks, and Swagger/OpenAPI is configured as an API discovery boundary. Paths: backend/src/main/java/com/example/demo/controller/AuthController.java, backend/src/main/java/com/example/demo/controller/HealthController.java, and backend/src/main/java/com/example/demo/exception/GlobalExceptionHandler.java.
Persistence Model
The backend follows a controller → service → repository flow for user identity data. User is the persistence entity, UserRepository is the Spring Data access boundary, and the auth service flow stores BCrypt-hashed passwords rather than raw credentials. Database configuration supports environment-provided PostgreSQL or MySQL connections, with H2 in-memory fallback. Paths: backend/src/main/java/com/example/demo/model/User.java, backend/src/main/java/com/example/demo/repository/UserRepository.java, and backend/src/main/resources/application.properties.
Runtime, Infrastructure, and Operations
The frontend runs on Node.js/Next.js (documented port 5000); the backend runs Java/Spring Boot with Maven (port 8080). JWT secret and database credentials are environment-driven; Docker Compose is present for local multi-service infrastructure. Production targets include Vercel for Next.js and Render or Java/Docker hosting for the API. Logging is configured through backend/src/main/resources/logback-spring.xml; deployment composition is rooted at docker-compose.yml.
Main entry points: page.tsx App Routes · DemoApplication.java Spring Boot Application · AuthController.java Auth Controller · next.config.mjs Auth Rewrite Proxy
Components 19
Next.js Frontend
Browser-facing App Router application.
- App Routes · Landing, login, signup, and dashboard pages.
frontend/src/app/page.tsx - Global Layout
frontend/src/app/layout.tsx - Signup Page · Sends signup requests and stores JWT session state.
frontend/src/app/signup/page.tsx - Dashboard Page · Consumes browser session state.
frontend/src/app/dashboard/page.tsx - Auth Rewrite Proxy · Rewrites browser /auth requests to the API.
frontend/next.config.mjs - Frontend Environment
frontend/.env.example
Spring Boot API
Stateless authentication API and security pipeline.
- Spring Boot Application
backend/src/main/java/com/example/demo/DemoApplication.java - Security Filter Chain · Defines stateless authorization and filter ordering.
backend/src/main/java/com/example/demo/config/SecurityConfig.java - JWT Authentication Filter · Validates bearer tokens before protected processing.
backend/src/main/java/com/example/demo/config/JwtAuthenticationFilter.java - Auth Controller · HTTP boundary for signup and login.
backend/src/main/java/com/example/demo/controller/AuthController.java - Health Endpoint · Platform health-check boundary.
backend/src/main/java/com/example/demo/controller/HealthController.java - Auth & JWT Service · Hashes passwords, authenticates users, and issues JWTs.
backend/src/main/java/com/example/demo/service/JwtService.java - Global Error Handler · Converts service and persistence failures to API responses.
backend/src/main/java/com/example/demo/exception/GlobalExceptionHandler.java
Data & Operations
Identity persistence and runtime infrastructure.
- User Repository
backend/src/main/java/com/example/demo/repository/UserRepository.java - User Identity · Persistent user identity with BCrypt-hashed credentials.
backend/src/main/java/com/example/demo/model/User.java - Identity Database · Environment-selected user store.
backend/src/main/resources/application.properties - Backend Logging
backend/src/main/resources/logback-spring.xml - Local Compose Stack · Local multi-service infrastructure.
docker-compose.yml
Other components
- Browser
Connections 19
- Browser → App Routes: renders
- App Routes → Global Layout: uses
- App Routes → Signup Page: includes
- App Routes → Dashboard Page: navigates to
- Signup Page → Auth Rewrite Proxy: /auth requests
- Auth Rewrite Proxy → Auth Controller: proxies
- Frontend Environment → Auth Rewrite Proxy: configures
- Spring Boot Application → Security Filter Chain: installs
- Security Filter Chain → JWT Authentication Filter: orders
- JWT Authentication Filter → Auth Controller: allows authenticated requests
- Auth Controller → Auth & JWT Service: delegates login/signup
- Auth & JWT Service → User Repository: loads and stores users
- User Repository → User Identity: maps
- User Repository → Identity Database: persists
- Auth Controller → Global Error Handler: failures handled by
- Spring Boot Application → Health Endpoint: exposes
- Spring Boot Application → Backend Logging: uses
- Local Compose Stack → Spring Boot Application: runs API
- Local Compose Stack → Auth Rewrite Proxy: runs frontend