Skip to content

Architecture

Prashant Maurya edited this page Jul 19, 2026 · 1 revision

Architecture

Tech Stack

Backend

Java 21 Spring Boot 3.2 Spring Security + JWT Spring Data JPA / Hibernate MySQL Maven

Frontend

React 18 (Vite) Tailwind CSS Axios React Router DOM

System Diagram

React Frontend (port 5173) │ HTTP / REST ▼ Spring Boot Backend (port 8080) │ JPA ▼ MySQL Database

Project Structure

nestify-pg-management/ ├── src/main/java/com/nestify/pg/ │ ├── config/ → Security and CORS config │ ├── controller/ → REST API endpoints │ ├── entity/ → JPA entities │ ├── repository/ → Spring Data repositories │ ├── service/ → Business logic │ └── util/ → JWT utility ├── frontend/ │ ├── src/ │ │ ├── pages/ → React pages │ │ ├── api.js → Axios client │ │ └── AuthContext.jsx → JWT auth state │ └── vite.config.js └── pom.xml

Authentication Flow

User logs in via /auth/login with username/password. Backend validates credentials, generates a signed JWT. Frontend stores the JWT (via AuthContext.jsx) and attaches it to every subsequent request via an Axios interceptor. Backend validates the JWT on protected routes and enforces role-based access (ADMIN vs TENANT) using Spring Security.

Design Notes / Suggested Improvements

Consider moving secrets (JWT signing key, DB password) into environment variables instead of application.properties, using something like Spring's @Value + a .env/application-prod.properties profile. Add a service layer interface + implementation split for easier unit testing. Consider global exception handling via @ControllerAdvice for consistent API error responses.

Clone this wiki locally