Application Configuration
Relevant source files
The following files were used as context for generating this wiki page:The PayMaster application configuration is managed across both the backend and frontend, defining project structure, dependencies, runtime behavior, and user interface styling. The backend relies on a standard Spring Boot setup configured via Maven, while the frontend uses a centralized JavaScript object for behavioral settings and CSS custom properties for theming.
Backend Configuration
The backend is a Spring Boot application built with Maven. Its configuration is primarily defined by the project's pom.xml and the main application class.
Project Dependencies and Properties
The core dependencies and project metadata are defined in pom.xml. The project uses Java 21 and is built upon the Spring Boot framework version 3.2.0.
Sources: pom.xml:17, pom.xml:10
The following diagram illustrates the key dependencies and their roles in the application.
Sources: pom.xml:21-72
Key dependencies are summarized in the table below:
| Group ID | Artifact ID | Description |
|---|---|---|
org.springframework.boot | spring-boot-starter-web | Provides support for building web applications, including RESTful applications, using Spring MVC. |
org.springframework.boot | spring-boot-starter-data-jpa | Provides support for using Java Persistence API (JPA) with Spring Data and Hibernate. |
org.springframework.boot | spring-boot-starter-thymeleaf | Provides server-side Java template engine for web and standalone environments. |
org.springframework.boot | spring-boot-starter-validation | Provides support for bean validation using Hibernate Validator. |
com.h2database | h2 | An in-memory database used for development and testing, configured with runtime scope. |
org.projectlombok | lombok | A library to reduce boilerplate code for model/data objects (e.g., getters, setters). |
com.github.mfathi91 | persian-date-time | A library for handling Persian (Jalali) calendar dates and times. |
Sources: pom.xml:22-61
Application Entry Point
The application is bootstrapped by the PayMasterApplication class. The @SpringBootApplication annotation enables auto-configuration, component scanning, and other core Spring Boot features. The main method uses SpringApplication.run() to launch the application.
Sources: src/main/java/com/paymaster/backend/PayMasterApplication.java:8-15
@SpringBootApplication
public class PayMasterApplication {
/**
* متد اصلی (main) که برنامه Spring Boot را راهاندازی میکند.
* @param args آرگومانهای خط فرمان.
*/
public static void main(String[] args) {
SpringApplication.run(PayMasterApplication.class, args);
}
}
Sources: src/main/java/com/paymaster/backend/PayMasterApplication.java:8-18
Frontend Configuration
The frontend configuration is managed through a combination of JavaScript for behavior and CSS for styling. External libraries like Bootstrap, Bootstrap Icons, and Chart.js are loaded via a CDN.
Sources: src/main/resources/templates/fragments/layout.html:8-13, src/main/resources/templates/fragments/layout.html:120-122
JavaScript Configuration
A global CONFIG object in app.js centralizes frontend settings, making them easy to manage and modify.
const CONFIG = {
apiBaseUrl: '/api',
debounceDelay: 300,
animationDuration: 300,
toastDuration: 5000,
dateFormat: 'YYYY/MM/DD',
currency: 'ریال',
locale: 'fa-IR'
};
Sources: src/main/resources/static/js/app.js:11-20
| Property | Value | Description |
|---|---|---|
apiBaseUrl | '/api' | The base path for all client-side API requests. |
debounceDelay | 300 | The delay in milliseconds for debouncing events like live search and validation. |
animationDuration | 300 | The duration in milliseconds for UI animations. |
toastDuration | 5000 | The duration in milliseconds for which toast notifications are displayed. |
dateFormat | 'YYYY/MM/DD' | The standard date format used in the application. |
currency | 'ریال' | The default currency symbol/name. |
locale | 'fa-IR' | The locale used for number and date formatting. |
Sources: src/main/resources/static/js/app.js:11-20
API Endpoint Configuration
The ApiService object within app.js defines the client-side interface for backend API endpoints. All requests are prefixed with the apiBaseUrl from the CONFIG object.
The following sequence diagram shows how the frontend validates a national code by calling a configured API endpoint.
The primary API endpoints configured on the client-side are:
| Method | Endpoint | Function | Description |
|---|---|---|---|
| GET | /check-national-code | checkNationalCode | Checks if a national code is valid and unique. |
| GET | /check-mobile | checkMobile | Checks if a mobile number is unique. |
| GET | /calculate-installments | calculateInstallments | Calculates installment details based on principal, rate, and months. |
| GET | /convert-date | convertDate | Converts a Persian date string to another format (not fully detailed). |
| GET | /search-customers | searchCustomers | Searches for customers based on a query string. |
Sources: src/main/resources/static/js/app.js:267-308, src/main/resources/templates/contracts/form.html:257-269
Styling and Theming
The application's visual theme is defined in style.css using CSS custom properties (variables) under the :root selector. This allows for easy customization of colors, shadows, and other stylistic elements.
:root {
/* Primary Colors */
--pm-primary: #3498db;
--pm-primary-dark: #2980b9;
--pm-primary-light: #5dade2;
/* Status Colors */
--pm-success: #2ecc71;
--pm-warning: #f39c12;
--pm-danger: #e74c3c;
--pm-info: #17a2b8;
/* Neutral Colors */
--pm-dark: #2c3e50;
--pm-gray: #7f8c8d;
--pm-light: #ecf0f1;
--pm-white: #ffffff;
}
Sources: src/main/resources/static/css/style.css:11-30
These variables are then used throughout the stylesheet to maintain a consistent look and feel. For example, the primary button style uses --pm-primary:
.btn-primary {
background-color: var(--pm-primary);
border-color: var(--pm-primary);
}
Sources: src/main/resources/static/css/style.css:300-303
Summary
The application's configuration is well-structured, separating backend dependencies, frontend logic, and visual styling. The pom.xml file serves as the single source of truth for backend dependencies and build settings. On the frontend, app.js provides a centralized CONFIG object for behavioral parameters and API endpoints, while style.css uses custom properties for a flexible and maintainable theming system. This separation of concerns simplifies maintenance and future development.