SpringWeb is a full-stack enterprise application built with Spring Boot 3.5.5 that combines modern web technologies with traditional business management needs. The system features a unique profile-based authentication system with visual user cards and provides comprehensive modules for managing products, orders, suppliers, transactions, and more.
- Visual Profile Cards: Users authenticate by selecting their profile card and entering a 2-digit access code
- Secure Session Management: Server-side session handling with automatic timeout
- Khmer Language Support: Full bilingual support with beautiful Khmer typography using Koh Santepheap font
- No Traditional Passwords: Simplified yet secure authentication approach
- Product Management: Comprehensive inventory tracking with categories and suppliers
- Order Processing: Full order lifecycle management with status tracking
- Supplier Management: Vendor information and relationship management
- Financial Transactions: Payment processing and transaction history
- Category Management: Product categorization and organization
- Reporting System: Business analytics and insights
- Glassmorphism Interface: Stunning glass-effect design with backdrop blur
- Responsive Layout: Optimized for desktop, tablet, and mobile devices
- Emerald Green Theme: Professional color scheme with subtle gradients
- Material Design Icons: Clean and consistent iconography
- Smooth Animations: Engaging micro-interactions and transitions
- RESTful API Design: Clean separation between frontend and backend
- JPA/Hibernate ORM: Robust database abstraction layer
- Spring Security Integration: Built-in security features and CSRF protection
- Thymeleaf Templates: Server-side rendering with dynamic content
- Modular Structure: Scalable and maintainable codebase
graph TD
subgraph Client Layer
B[Browser] --> |HTTP Request| F[Front Controller - DispatcherServlet]
end
subgraph Controller Layer
F --> |Forward Request| C1[WebController]
F --> |REST Request| C2[ProductController]
F --> |REST Request| C3[CategoryController]
F --> |REST Request| C4[OrderController]
F --> |REST Request| C5[SupplierController]
F --> |REST Request| C6[TransactionController]
end
subgraph Service Layer
C1 --> |Business Logic| S1[Services]
C2 --> |Business Logic| S1
C3 --> |Business Logic| S1
C4 --> |Business Logic| S1
C5 --> |Business Logic| S1
C6 --> |Business Logic| S1
end
subgraph Repository Layer
S1 --> |Data Access| R1[ProductRepository]
S1 --> |Data Access| R2[CategoryRepository]
S1 --> |Data Access| R3[OrderRepository]
S1 --> |Data Access| R4[SupplierRepository]
S1 --> |Data Access| R5[TransactionRepository]
end
subgraph Database Layer
R1 --> |JPA/Hibernate| DB[(MySQL Database)]
R2 --> |JPA/Hibernate| DB
R3 --> |JPA/Hibernate| DB
R4 --> |JPA/Hibernate| DB
R5 --> |JPA/Hibernate| DB
end
subgraph View Layer
C1 --> |Model Data| V1[Thymeleaf Templates]
V1 --> |Render| H[HTML/CSS/JS]
H --> |Response| B
end
subgraph REST API Layer
C2 --> |JSON Response| B
C3 --> |JSON Response| B
C4 --> |JSON Response| B
C5 --> |JSON Response| B
C6 --> |JSON Response| B
end
- Client Request: Browser sends HTTP request (page load or AJAX)
- Front Controller: DispatcherServlet receives and routes request
- Controller Processing:
- Web requests β WebController (Thymeleaf views)
- API requests β REST Controllers (JSON responses)
- Service Layer: Handles business logic and transactions
- Repository Layer: Manages data access through JPA
- Database Layer: Stores and retrieves data using MySQL
- Response Generation:
- Web pages: Thymeleaf templates render HTML
- API calls: Controllers return JSON responses
sequenceDiagram
participant Client
participant Security
participant Controller
participant Service
participant Database
Client->>Security: Request with Session
alt Not Authenticated
Security->>Client: Redirect to Login
else Authenticated
Security->>Controller: Forward Request
Controller->>Service: Process Request
Service->>Database: Data Operation
Database->>Service: Data Response
Service->>Controller: Process Response
Controller->>Client: Return Response
end
graph LR
subgraph Frontend
JS[Dashboard.js] --> |AJAX Calls| API
end
subgraph Backend
API[REST API] --> |Request| C[Controllers]
C --> |Process| S[Services]
S --> |Query| DB[(Database)]
DB --> |Data| S
S --> |Stats| C
C --> |JSON| API
end
API --> |Response| JS
http://localhost:10000/api
http://localhost:9999/api/v1
// Fetch Dashboard Stats
GET /api/v1/dashboard/stats
fetch('http://localhost:9999/api/v1/dashboard/stats')
// Example Response
{
"totalSales": "α‘α’α£,α€α₯α¦",
"totalOrders": "α’α£α€",
"activeProducts": "α€α₯α¦",
"recentTransactions": [
{
"id": "TR001",
"amount": "α‘α’α α α",
"date": "α’α α’α€-α α‘-α‘α₯",
"type": "ααΆαααα"
}
]
}// Fetch Categories
GET /api/v1/categories
fetch('http://localhost:9999/api/v1/categories')
// Example Response
{
"categories": [
{
"id": "CAT001",
"name": "αααα’αα",
"description": "ααααααααααααα"
},
{
"id": "CAT002",
"name": "ααααααα",
"description": "ααΉαααααααααααααα"
},
{
"id": "CAT003",
"name": "ααα αΌαα’αΆα αΆα",
"description": "α’αΆα αΆαααααααα»α"
}
]
}// Fetch Suppliers
GET /api/v1/suppliers
fetch('http://localhost:9999/api/v1/suppliers')
// Example Response
{
"suppliers": [
{
"id": "SUP001",
"name": "αααα»αα αα»α ααα·αα",
"contact": "α α’α£ α’α£α€ α₯α¦α§",
"address": "ααααΆαααααΈ"
},
{
"id": "SUP002",
"name": "α’αααααααΈ αα»ααΆ",
"contact": "α α‘α’ α£α€α₯ α¦α§α¨",
"address": "αα½αααα"
}
]
}// Fetch Products
GET /api/v1/products
fetch('http://localhost:9999/api/v1/products')
// Example Response
{
"products": [
{
"id": "PRD001",
"name": "ααΆαααααΎα",
"price": "α’α α α α",
"stock": "α₯α "
},
{
"id": "PRD002",
"name": "αααααα
α»α",
"price": "α£α α α α",
"stock": "α£α "
}
]
}// Fetch Orders
GET /api/v1/orders
fetch('http://localhost:9999/api/v1/orders')
// Example Response
{
"orders": [
{
"id": "ORD001",
"customer": "αα»ααΆ",
"total": "α₯α α α α α",
"status": "αααα
αα"
},
{
"id": "ORD002",
"customer": "αααααΆ",
"total": "α£α α α α α",
"status": "αααα»αααΉα"
}
]
}// Fetch Users
GET /api/v1/users
fetch('http://localhost:9999/api/v1/users')
// Example Response
{
"users": [
{
"id": "USR001",
"name": "αα»ααΆ",
"role": "α’αααααααααααα",
"status": "ααααα"
},
{
"id": "USR002",
"name": "αααααΆ",
"role": "α’αααααα",
"status": "ααααα"
}
]
}// Fetch Transactions
GET /api/v1/transactions
fetch('http://localhost:9999/api/v1/transactions')
// Example Response
{
"transactions": [
{
"id": "TRX001",
"type": "ααΆαααα",
"amount": "α‘α’α α α α",
"date": "α’α α’α€-α α‘-α‘α₯"
},
{
"id": "TRX002",
"type": "ααΆααα·α",
"amount": "α₯α α α α α",
"date": "α’α α’α€-α α‘-α‘α€"
}
]
}// Fetch Reports
GET /api/v1/reports/{type}
fetch('http://localhost:9999/api/v1/reports/sales')
// Example Response
{
"reportType": "αααΆαααΆαααααα",
"period": "ααααααΆ α’α α’α€",
"data": [
{
"date": "α’α α’α€-α α‘-α‘α₯",
"sales": "α‘α’α α α α α",
"items": "α’α "
}
]
}// Fetch Settings
GET /api/v1/settings
fetch('http://localhost:9999/api/v1/settings')
// Example Response
{
"settings": {
"companyName": "α αΆαααααααα·α",
"phone": "α α’α£ α’α£α€ α₯α¦α§",
"address": "ααααααα",
"currency": "ααα",
"language": "ααααα"
}
}- 200: Successful operation
- 401: Authentication required
- 403: Access forbidden
- 404: Resource not found
- 500: Server error
Before running the application, ensure you have:
- Java 21 or higher installed
- Maven 3.6+ (or use included wrapper)
- Git for version control
- MySQL Server 8.0+ (optional, H2 available for development)
- Modern web browser (Chrome, Firefox, Safari, Edge)
-
Clone the Repository
git clone https://github.com/yourusername/SpringWeb.git cd SpringWeb -
Configure Database
- Create MySQL database:
CREATE DATABASE java_spring_boot_db;
- Update
application.propertieswith your database credentials:spring.datasource.url=jdbc:mysql://localhost:3306/java_spring_boot_db spring.datasource.username=your_username spring.datasource.password=your_password
- Create MySQL database:
-
Build and Run
# Using Maven Wrapper ./mvnw clean install ./mvnw spring-boot:run # Or using installed Maven mvn clean install mvn spring-boot:run
-
Access the Application
- Open your browser and navigate to:
http://localhost:10000 - Default credentials will be displayed on the login page
- Open your browser and navigate to:
netsh advfirewall firewall add rule name="SpringBoot8084" dir=in action=allow protocol=TCP localport=8084
Each menu item uses Material Icons and provides quick access to core modules.
-
Logo:
- Company/application branding element
- Acts as a home button/link
-
Dashboard
dashboard:- Main overview screen
- Shows key metrics and analytics
- First screen after login
-
Categories
local_offer:- Manage product categories
- Organize products into groups
- Tag and classify items
-
Suppliers
local_shipping:- Manage vendor information
- Track supplier relationships
- Handle supplier contracts
-
Products
inventory_2:- Manage product catalog
- Track inventory levels
- Handle product details
-
Orders
shopping_cart:- Process customer orders
- Track order status
- Manage fulfillment
-
Transactions
credit_card:- Track payment records
- Monitor financials
- Handle payments
-
Reports
bar_chart:- Generate business reports
- View analytics/trends
- Export data
-
Settings
settings:- System configuration
- User preferences
- Application settings
- Framework: Spring Boot 3.5.5
- Java Version: Java 21 (LTS)
- Database: MySQL 8.0+ / H2 (development)
- ORM: Hibernate 6.6.26 with JPA
- Template Engine: Thymeleaf
- Build Tool: Maven 3.6+
- Application Server: Embedded Tomcat 10.1.44
- Languages: HTML5, CSS3, JavaScript (ES6+)
- Styling: Custom CSS with CSS Grid and Flexbox
- Fonts: Google Fonts (Ubuntu, Koh Santepheap)
- Icons: Material Icons + Font Awesome
- UI Framework: Custom glassmorphism components
- IDE: Compatible with IntelliJ IDEA, Eclipse, VS Code
- Version Control: Git
- Package Management: Maven Central Repository
- Testing: JUnit 5, Spring Boot Test
- Real-time Statistics: Key performance indicators and metrics
- Total products, orders, and revenue tracking
- Category-wise product distribution
- Stock status and low stock alerts
- Revenue analysis with trends
- Interactive Charts: Beautiful visualizations using Chart.js
- Revenue line graph with total and net revenue
- Category distribution pie chart
- Stock status bar chart
- Transaction type and payment method analysis
- User Welcome: Personalized greeting in both English and Khmer
- Quick Actions: Direct access to frequently used features
- System Status: Server health and database connection status
- Real-time Updates: Dynamic data refresh without page reload
- Added comprehensive dashboard with real-time analytics
- Implemented automatic invoice generation for orders
- Enhanced stock management with low stock alerts
- Added support for multiple payment methods
- Improved transaction tracking and reporting
- Enhanced UI with responsive design and better user experience
- Inventory Tracking: Real-time stock levels and alerts
- Category Organization: Hierarchical product categorization
- Supplier Integration: Link products to suppliers
- Price Management: Dynamic pricing with history tracking
- Bulk Operations: Import/export product data
- Order Lifecycle: From creation to delivery tracking
- Customer Management: Customer information and history
- Order Status Tracking: Real-time status updates
- Invoice Generation: Automated invoice creation
- Payment Integration: Multiple payment method support
- Vendor Database: Complete supplier information
- Contact Management: Multiple contact persons per supplier
- Performance Tracking: Supplier rating and history
- Purchase Orders: Automated PO generation
- Communication Log: Interaction history tracking
- Payment Processing: Multiple payment methods
- Transaction History: Complete audit trail
- Refund Management: Easy refund processing
- Financial Reporting: Revenue and expense tracking
- Tax Management: Tax calculation and reporting
- Sales Reports: Detailed sales analytics
- Inventory Reports: Stock levels and movement
- Financial Reports: Profit/loss statements
- User Activity: System usage analytics
- Export Capabilities: PDF, Excel, CSV exports
- Visual Authentication: Select profile card instead of typing username
- 2-Digit Access Codes: Simple yet secure authentication
- Session Management: Automatic session timeout and renewal
- CSRF Protection: Built-in cross-site request forgery protection
- XSS Prevention: Input sanitization and output encoding
- SQL Injection Prevention: Parameterized queries with JPA
- Input Validation: Server-side validation for all inputs
- Secure Headers: HTTP security headers implementation
- Audit Trail: Complete user action logging
- Data Encryption: Sensitive data encryption at rest
- Role-Based Access: Different access levels per user
- Module Permissions: Granular permission system
- Session Security: Secure session token management
- Failed Login Protection: Account lockout after failed attempts