A full-stack web application built using Spring Boot (Java) for the backend and React for the frontend. This system simulates a real-time ticketing platform with support for multithreading, vendors, and customers. The application includes a configuration panel, vendor and customer management, and a real-time dashboard.
- Real-Time Simulation: Vendors release tickets, and customers retrieve them in real-time.
- Thread Management: Start, stop, and manage vendor/customer threads.
- Custom Configuration: Set the ticket pool size, release rate, and retrieval rate.
- H2 Database Integration: An in-memory database for storing configuration and entity details.
- Real-Time Dashboard: Real-time ticket availability updates by polling.
- REST APIs: Provides endpoints for managing configuration, vendors, customers, and threads.
- Dynamic UI: Configuration management, vendor/customer forms, and a real-time dashboard.
- Axios for API Requests: Communicates with the backend to fetch and update data.
- Custom CSS Styling: Ensures a clean and intuitive user experience.
- Spring Boot: REST APIs and WebSocket communication.
- H2 Database: In-memory database for persistence.
- Java Concurrency: Multithreaded ticket pool simulation.
- Maven: Dependency management and build tool.
- Swagger: API documentation and testing.
- Lombok: Reduces boilerplate code in Java classes.
- Jackson: JSON serialization and deserialization.
- React: Dynamic and responsive user interface.
- Axios: For making API requests.
- CSS: Custom styles for a clean and intuitive UI.
- npm: Package manager for Node.js.
- recharts: Real-time charting library.
Before you begin, ensure you have the following installed on your system:
- IntelliJ IDE (recommended)
- Git
- Postman (for API testing)
- Minimum 8GB RAM
src
└── main
└── java
└── org
└── ticketsimulation
├── config
│ └── WebConfig
├── controller
│ ├── ConfigurationController
│ ├── CustomerController
│ ├── ResetDatabaseController
│ ├── ThreadController
│ ├── TicketPoolController
│ └── VendorController
├── dto
│ └── TicketDTO
├── fileHandlerUtility
│ └── JsonFileHandler
├── model
│ ├── Configuration
│ ├── Customer
│ ├── Ticket
│ ├── TicketPool
│ └── Vendor
├── repository
│ ├── CustomerRepository
│ └── VendorRepository
├── service
│ ├── CustomerService
│ ├── TicketPoolService
│ └── VendorService
└── thread
├── CustomerThread
├── VendorThread
└── TicketSimulationApplication
src
├── assets
│ ├── components
│ │ ├── ConfigurationForm.jsx
│ │ ├── CustomerForm.jsx
│ │ ├── CustomerList.jsx
│ │ ├── ResetButton.jsx
│ │ ├── ThreadControlButtons.jsx
│ │ ├── TicketPoolDashboard.jsx
│ │ ├── VendorForm.jsx
│ │ └── VendorList.jsx
│ └── styles
│ ├── ResetButton.css
│ ├── TicketPoolDashboard.css
│ ├── App.css
│ ├── App.jsx
│ ├── index.css
│ └── main.jsx
├── .gitignore
├── eslint.config.js
├── index.html
├── package-lock.json
├── package.json
├── README.md
└── vite.config.js
-
Navigate to Backend Directory:
cd backend
-
Build the Project:
mvn clean install
-
Run the Application:
mvn spring-boot:run
-
Access the Backend:
- API Documentation (if Swagger is enabled):
http://localhost:8080/swagger-ui.html
- H2 Console:
http://localhost:8080/h2-console
- API Documentation (if Swagger is enabled):
-
Navigate to Frontend Directory:
cd simulation-Backend
-
Install Dependencies:
npm install
-
Start the Development Server:
npm start
-
Access the Frontend:
- Open your browser at
http://localhost:3000
- Open your browser at
- Global Settings: Configure simulation parameters (Default value = previous value)
- Set system constraints:
- Save/Update Configuration
- Add Vendor: Register new ticket vendors
- Vendor List: View and manage registered vendors
- Add Customer: Register new customers
- Customer List: View registered customer profiles
- Start Simulation: Initiate ticket simulation
- Pause Simulation: Temporarily halt ongoing simulation
- Reset Simulation: Clear all current simulation data
- Real-time Dashboard:
- Ticket pool status
- Current simulation metrics
- Performance graphs
- Interactive line charts for ticket distribution
- Real-time update indicators
- GET
/api/configuration
: Fetch current configuration. - PUT
/api/configuration
: Update configuration.
- GET
/api/vendors
: Fetch all vendors. - POST
/api/vendors
: Add a new vendor.
- GET
/api/customers
: Fetch all customers. - POST
/api/customers
: Add a new customer.
- POST
/api/threads/start
: Start all threads. - POST
/api/threads/stop
: Stop all threads.
- GET:
/api/ticket-pool
Real-time ticket availability updates.
Run unit tests for the backend:
mvn test
Run tests for the frontend:
npm test
To reset the database:
- Stop the backend server.
- Restart the backend server.
- Package the Spring Boot application:
mvn clean package
- Deploy the generated
.jar
file to your preferred server.
- Build the React app:
npm run build
- Serve the
build
folder using a static file server like Nginx, Apache, or a cloud provider.
This project is licensed under the MIT License.
- Spring Boot Documentation: https://spring.io/projects/spring-boot
- React Documentation: https://reactjs.org/docs/getting-started.html