The POS System Backend is a RESTful API that supports the frontend operations of a Point of Sale system. This backend service manages customer, order, and inventory data, providing essential functionalities such as creating, reading, updating, and deleting records, and securing endpoints using authentication.
- Project Description
- Features
- Technologies
- Installation
- Usage
- API Documentation
- Contributing
- License
- Contact
- Manage customer records
- Process orders and track inventory
- Update item quantities
- Apply discounts and calculate totals
- Secure endpoints with authentication
- Built-in validation for request payloads
- Loggers for application event tracking
- Backend Framework: Spring Boot, Spring WebMVC
- ORM: Spring Data JPA, Hibernate 6.6.0
- Database: MySQL 8.0.33
- Mapping: ModelMapper 3.2.1
- Build Tool: Maven 4.0.0
- Application Server: Apache Tomcat 10
- JDK: OpenJDK 17
- Java 17 (OpenJDK 17)
- Maven
- MySQL 8.0.33
- Apache Tomcat 10
-
Clone the repository - Backend
https://github.com/ApsaraWitharana/AAD-Assignment-Spring-Pos-System-Backend.git
Clone the repository - Frontend
https://github.com/ApsaraWitharana/AAD-Assignment-Spring-Pos-Frontend.git
-
Configure the database
- Create a MySQL database named
pos_system - Update the
application.propertiesfile with your MySQL credentials
DriverManagerDataSource dmds = new DriverManagerDataSource(); dmds.setDriverClassName("com.mysql.cj.jdbc.Driver"); dmds.setUrl("jdbc:mysql://localhost:3306/pos_spring?createDatabaseIfNotExist=true"); dmds.setUsername("your_username"); dmds.setPassword("your_password"); return dmds;
- Create a MySQL database named
-
Build the project
mvn clean install
-
Deploy to Tomcat
- Ensure Tomcat is installed and running.
- Copy the generated WAR file from the
targetdirectory to the Tomcatwebappsdirectory. - Restart Tomcat.
After installation, run the server by starting Tomcat. The API will be available at http://localhost:8080/.
The back-end code is organized to follow best practices and maintainability. Important directories and files include:
src/main/java: Contains Java classes.src/main/resources/schema: Database schema.src/main/resources/logback-spring.xml: Logger configuration.src/main/webapp/WEB-INF/: Configuration files for the JavaEE application.
(src/main/java/lk.ijse.gdse68/pos_system_back_end)
- config: Contains configuration classes, such as security filters and logging filters, responsible for setting up the security mechanisms (e.g., JWT filters) and logging functionality across the application.
- controller: Contains classes defining the API endpoints and services.
- sevice: Business Objects - classes that encapsulate business logic.
- dao: Data Access Objects - classes responsible for database interactions.
- entity: Entity classes representing database tables.
- dto: Data Transfer Objects - classes used for data exchange between layers.
- exception: Contains custom exception classes that handle different types of errors throughout the application..
- customObject: Contains custom object classes, which are utility classes or specific objects that don’t necessarily fit into other categories. .
- util: Utility classes that provide common functionalities or helper methods used across the application..
To set up and run the POS system locally, follow these steps:
- Clone the repository.
- Set up the back-end dependencies.
- Configure the database connection.
- Deploy the JavaEE application on the Apache Tomcat server.
- Spring Boot 3.3.3: Used for building and deploying the POS system as a RESTful API.
- Spring Data JPA 3.3.3: Provides JPA support for database interaction.
- Hibernate 6.6.0: Object-relational mapping tool to manage database entities.
- ModelMapper 3.2.1: Framework for mapping between object models.
- Spring WebMVC: Handles the HTTP requests and responses.
- MySQL Connector: Java-based driver for connecting to MySQL databases. (Version 8.0.33)
- JNDI: Java API for managing database connections efficiently through connection pooling, enhancing performance and scalability.
- Maven 4.0.0: Build automation and project management tool.
- Logback: Logging framework for logging application events.
The API will be available at http://localhost:8080/.
For detailed API documentation, please refer to the project’s Swagger UI and Postman collections.
- Customer API documentation URL: Postman Customer API Documentation
- Item API documentation URL: Postman Item API Documentation
- Order API documentation URL: Postman Order API Documentation
This project is licensed under the MIT License. See the LICENSE file for details.