Project Architecture & Patterns
Applications generated by Sprygen follow standard, battle-tested Spring Boot best practices. We enforce a clean layered architecture to maximize maintainability.
Directory Structure
Applications generated by Sprygen follow a clean, layered architecture. For Fullstack projects, this is organized as a Monorepo:
my-project/
├── backend/ # Spring Boot Application
│ └── src/main/java/com/example/app/
│ ├── config/ # Security, CORS, Swagger configs
│ ├── controller/ # REST Endpoints
│ ├── entity/ # JPA Data models
│ ├── mapper/ # MapStruct mapping interfaces
│ ├── repository/ # Spring Data JPA Repositories
│ ├── security/ # JWT filters or Session handlers
│ └── service/ # Business logic
└── frontend/ # Next.js 15 Application (App Router)
└── src/
├── app/ # Page routes (Dashboard, Auth)
├── components/ # Reusable UI components (Sidebar, Layouts)
├── hooks/ # Custom React hooks (useAuth, useFetch)
├── lib/ # API client and type definitions
└── tailwind.config.ts / globals.css (Tailwind CSS v4)
Frontend Stack & Themes
The Next.js frontend is built for performance and a premium feel:
- Tailwind CSS v4: The latest, high-performance styling engine.
- Lucide React: Beautiful icons throughout the dashboard.
- Next Themes: Seamless light and dark mode support out of the box.
- Typed Hooks: Custom hooks (
useAuth,useFetch) provide a consistent way to interact with the backend API. - Dashboard Sidebar: A professional navigation system that automatically shows or hides features based on your backend capabilities (e.g., Swagger for Admins).
MapStruct Integration (Backend)
Sprygen relies unconditionally on MapStruct for Entity ↔ DTO mapping. It automatically generates a @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) interface for every new entity.
This provides compile-time safety and offloads tedious manual mapping logic out of your Services.
Pagination & Dynamic Filtering
Every generated REST endpoint natively supports pagination via Spring’s PageableDefault:
GET /api/v1/products?page=0&size=20&sort=id,desc
Furthermore, endpoints support dynamic field filtering instantly:
GET /api/v1/products?title=Apple&minPrice=500
This is powered by the generated *Specification.java class which dynamically aggregates Predicate lists securely and efficiently.
JPA Auditing
Say goodbye to manual timestamps. All generated entities extend AbstractAuditingEntity which automatically populates:
@CreatedDate@LastModifiedDate@CreatedBy@LastModifiedBy
The accompanying AuditingConfig listens to the Spring Security Context and seamlessly populates the acting user’s identifier when mutations occur.