Skip to content

Latest commit

Β 

History

91 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

App Icon Pahana Edu Online Billing

BUILT USING MVC & 3-TIER ARCHITECTURE, DEPLOYED ON AWS

Β Β Β  Β Β Β  Β Β Β 


☁️ Live Demo on AWS Elastic Beanstalk

πŸ”— Try the Pahana Edu Online Billing Web App: http://pahanaedu-paishanmadusha.eu-north-1.elasticbeanstalk.com/

πŸ§ͺ Demo User Credentials:

Role Email Password Mobile No
Default Admin admin@pahana.com admin123 0700000000
Default Staff staff@pahana.com staff123 0770000000
⚠️ Please do not change these demo credentials in the live environment.

Pahana Edu is a Java-based web application developed as an academic project for a leading bookshop in Colombo, Sri Lanka. The system streamlines operations such as customer management, inventory handling, customer billing, reporting, and user access control. It supports Admin and Staff user roles, integrates with MongoDB, and features a clean, responsive UI built with Bootstrap. The application runs on Apache Tomcat 9 and is deployed using AWS Elastic Beanstalk.

πŸ“‘ Table of Contents


βœ… Features

πŸ” Authentication & User Roles:

  • Admin and Staff Login with role-based access control.
  • Forgot Password feature allows users to reset their password via a registered mobile number.

πŸ‘¨β€πŸ’Ό Admin Features:

  • Manage Users: Add, view, update & delete Admin/Staff accounts.
  • Manage Items: Maintain inventory of books and stationery.
  • View Bills: Access, print, or delete bills generated by staff.
  • Reports: Staff-wise bill counts, revenue reports, and date filters.
  • Audit Logs: Tracks admin and staff login/logout activities.
  • Admin Help Guide: Instructions for using the admin panel.

πŸ‘¨β€πŸ« Staff Features:

  • Add Customer: Register new customers with auto-generated account numbers.
  • Manage Customers: View, edit, delete customer accounts.
  • View Items: Search and filter available books and stationery.
  • Generate Bill: Create bills with selected customer and items.
  • Billing History: View, print, or delete previous bills.
  • Staff Help Guide: Instructions and usage tips for the staff panel.

πŸ”§ Technical Features:

  • MongoDB Connection: Automatically switches between local and production database URIs using environment variables.

πŸ›  Technologies Used

The following technologies are used in this project:

Layer Technologies
Development IntelliJ IDEA (Ultimate Edition).
Frontend HTML5, CSS3, JavaScript, Bootstrap 5, JSTL for JSP.
Backend Java Servlet & JSP, Maven (Build Tool), MongoDB (Localhost & Atlas), SLF4J Logging, JUnit 5 (Testing).
Runtime Apache Tomcat 9.
Deployment AWS Elastic Beanstalk (WAR File Upload), GitHub Actions (CI/CD via Deploy Branch).

πŸ— Project Architecture

The project follows professional Object-Oriented Design principles using both MVC and 3-Tier Architecture. Below is a brief overview of the applied concepts:

πŸ” Encapsulation:

* Model classes (e.g., User, Customer, Bill, etc.) encapsulate data using private fields with public getters and setters.

πŸ” Inheritance & Polymorphism:

* Admin and Staff classes extend the abstract User class, each overriding methods like getRole() to implement role-specific behavior.

🧩 Abstraction:

* The User class is abstract, defining a shared structure for all user types & Interfaces (e.g., BillRepository, etc.) abstract core operations like billing, providing a clear contract for implementations.

🏭 Factory Pattern:

* The method createUserFromDocument() acts as a factory, dynamically returning an instance of Admin or Staff based on the role field from MongoDB documents.

🧡 Singleton Pattern:

* The MongoDBConnection class implements the Singleton Pattern to ensure a single, reusable database connection instance throughout the application.

🧠 Session Management:

* HttpSession is used for maintaining user session data securely across authenticated pages.
pahana-edu-web-app/
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/
β”‚   |    β”œβ”€β”€ java/
β”‚   |    β”‚   └── com.example.pahanaeduwebapp/
β”‚   |    β”‚       β”œβ”€β”€ dao/             # Data Access Objects for database interactions
β”‚   |    β”‚       β”œβ”€β”€ model/           # Representing data models
β”‚   |    β”‚       β”œβ”€β”€ repository/      # Interfaces to abstract data logic
β”‚   |    β”‚       β”œβ”€β”€ servlet/         # Java Servlets handling HTTP requests/responses
β”‚   |    β”‚       └── util/            # Utility classes (e.g., MongoDBConnection)
β”‚   |    β”‚
β”‚   |    β”œβ”€β”€ resources/             
β”‚   |    β”‚
β”‚   |    └── webapp/                  # Web content root (JSPs, static files, and web directories)
β”‚   |        β”œβ”€β”€ admin/               # Admin-specific pages
β”‚   |        β”œβ”€β”€ assets/              # Bootstrap, CSS, JS, images, and other static assets
β”‚   |        β”œβ”€β”€ components/          # Reusable frontend components
β”‚   |        β”œβ”€β”€ staff/               # Staff-specific pages
β”‚   |        β”œβ”€β”€ WEB-INF/          
β”‚   |        β”œβ”€β”€ forgot-password.jsp  # Forgot Password page
β”‚   |        β”œβ”€β”€ index.jsp            # Landing page
β”‚   |        β”œβ”€β”€ login.jsp            # Login page
β”‚   |        └── reset-password.jsp   # Reset-password page
|   └── test/
|        └── java/
|            └── com.example.pahanaeduwebapp/
|                β”œβ”€β”€ dao/             # DAO unit tests
|                └── model/           # Model validation tests
β”œβ”€β”€ .gitignore
β”œβ”€β”€ LICENSE
β”œβ”€β”€ pom.xml
└── README.md

βš™ Setup & Installation

Follow these steps to run the project locally:

πŸ›  Development Environment:, IDE: IntelliJ IDEA (Ultimate Edition), Runtime Server: Apache Tomcat 9, Database: MongoDB (Localhost or Atlas)

1. Clone the Repository

* You can either use IntelliJ IDEA's welcome screen to clone the project or use the terminal:
git clone https://github.com/PAIshanMadusha/pahana-edu-web-app.git
cd pahana-edu-web-app
* IntelliJ IDEA will automatically detect the project structure and download all Maven dependencies upon opening the project.

2. Configure MongoDB

* Install MongoDB Compass or create a cluster on MongoDB Atlas.
* Get the MongoDB connection URI.
* Set the environment variable MONGODB_URI inside IntelliJ IDEA:
* Go to **Run > Edit Configurations > Startup/Connection > Environment Variables & Add: MONGODB_URI=<your_connection_string>

3. Run with Tomcat Server

* After dependencies are loaded and MongoDB is connected, run the project with Apache Tomcat 9.
* Once the configuration is complete, attempt to log in. You should see:
Artifact is deployed successfully
MongoDB Connected Successfully to database: pahana_edu
Default admin created: admin@pahana.com / admin123
* Use the default credentials to log in.

☁ Deployment

Generate a deployable WAR file using the following command:

mvn clean package
* Use this file to deploy the app on:
* Local Apache Tomcat Server, or AWS Elastic Beanstalk (Java Environment).
* Don't forget to set the MONGODB_URI environment variable in the hosting platform.

πŸ–Ό Screenshots

Some screenshots of the system are shown below:

Landing Page Login Page

Admin Dashboard Staff Dashboard

Manage Items View Reports

View Items Generate Bills

Help Guide Bill Details


πŸ“˜ About This Project

This project was developed as part of an assignment for Cardiff Metropolitan University. It is a full-stack web application designed to manage core operations of a bookshop, including user management, item inventory, customer billing, and reporting. The system follows Object-Oriented Programming (OOP) principles and integrates modern development tools and technologies.

πŸ‘¨β€πŸ’» Created by:

Ishan Madhusha
GitHub: PAIshanMadusha

Feel free to explore my work and get in touch if you'd like to collaborate! πŸš€


πŸ“œ License

This project is licensed under the MIT License : See the LICENSE file for details.

About

Pahana Edu is a full-featured Java EE web application built as an educational project for a leading bookshop in Colombo.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages