Dev.to WebDev šŸ›  Dev šŸ‘ 0 šŸ“– 5 min read

Building a Multi-Tenant POS System with CodeIgniter and MySQL: Architecture, Billing and Shop-Level Data Isolation

Building a Point of Sale (POS) system is not just about creating a billing screen and printing receipts. When the application needs to support multiple shops, different user roles, subscription packages, reports and off

Building a Point of Sale (POS) system is not just about creating a billing screen and printing receipts.

When the application needs to support multiple shops, different user roles, subscription packages, reports and offline operations, the development challenges become much more interesting.

We experienced this while building ThirdEye POS, a web-based shop management and billing application developed using CodeIgniter and MySQL.

The system was designed primarily for Indian sweet shops and retail businesses. The objective was to bring everyday shop operations into one application while allowing a platform administrator to manage multiple shops independently.

In this article, I'll walk through some of the important development considerations behind the project.

1. Understanding the multi-tenant requirement

One of the first decisions in a multi-shop application is how to separate platform administration from individual shop operations.

ThirdEye POS has two main operational levels:

  • Platform level: Manages shops, subscriptions, packages, usage limits and feature availability.
  • Shop level: Handles billing, products, customers, staff, settings and reports.

This separation helps maintain a clear boundary between platform-wide operations and individual business activities.

A shop owner should only be able to access information belonging to their own shop. Similarly, shop staff should only have the permissions required for their responsibilities.

This is why access control and shop-level data separation need to be considered throughout the application, not just on the dashboard.

2. Shop-level data isolation

Multi-tenant applications require careful handling of data access.

For example, when a shop owner requests the billing history, the application must retrieve records belonging to that shop rather than returning data across all shops.

The same principle applies to customers, products, reports and other business records.

A simplified query might look like this:

$shopId = session()->get('shop_id');

$bills = $billModel
    ->where('shop_id', $shopId)
    ->findAll();

This is only an illustrative example. In a production application, the shop identity should be validated through trusted server-side authentication and authorisation logic.

The important principle is that access restrictions should be enforced on the server side. Hiding a menu item or button in the frontend is not sufficient protection.

3. Role-based access control

Not every user should have access to every part of a POS application.

A platform administrator may need to manage subscriptions and shop accounts, while a shop owner needs access to business settings and reports. Cashiers mainly need billing-related functionality.

ThirdEye POS uses separate administrative and shop-level panels with role-based permissions.

This keeps the interface focused and reduces the possibility of users accessing functions outside their responsibilities.

It also makes the application easier to maintain as new features are introduced.

4. Designing a practical billing workflow

Billing is one of the most frequently used features in a POS system.

A cashier should not have to navigate through several unnecessary screens to complete a transaction.

The basic workflow in ThirdEye POS is straightforward:

  1. Select an item.
  2. Enter the quantity or sale amount.
  3. Select the payment method.
  4. Confirm the bill.
  5. Print or share the receipt.

The system supports multiple payment methods, optional customer information and different receipt layouts, including 58mm, 80mm and A4.

We also wanted the billing experience to remain keyboard-friendly, because speed matters when a shop is handling customers continuously.

5. Managing products and bulk data entry

Product management can become a time-consuming task when a shop maintains a large catalogue.

Entering every item individually is not always practical.

ThirdEye POS supports individual item entry, spreadsheet-style bulk entry and CSV import/export.

Depending on the item, product information can include:

  • Item name and short code
  • Selling price and unit
  • SKU and HSN
  • GST details
  • Product image

Bulk data handling makes onboarding and maintaining product information more convenient.

6. Subscription packages and feature control

A multi-shop platform also needs a way to manage different subscription plans.

In ThirdEye POS, the platform administrator can create packages, assign subscriptions, configure usage limits and control which features are available to individual shops.

This makes it possible to support different business requirements without maintaining separate application versions for different customers.

An important consideration here is that subscription restrictions must be enforced on the backend as well as reflected in the user interface.

A disabled feature should not become accessible simply because someone manually calls its URL or endpoint.

7. Reporting and third-party sales

A POS application should provide more than transaction records.

Shop owners need to understand sales performance, payment collections and business activity.

ThirdEye POS includes reports for:

  • Sales
  • Items
  • Staff
  • Payment methods
  • GST
  • Third-party platforms

It also supports recording Zomato and Swiggy sales, commissions, net earnings and payout information.

These records help businesses review external-platform transactions alongside their regular shop sales.

8. Offline billing and PWA functionality

Internet connectivity can be unreliable in some business environments.

A billing application that becomes completely unusable whenever connectivity drops can interrupt daily operations.

ThirdEye POS includes Progressive Web App (PWA) functionality with offline billing and synchronisation support.

Offline operations introduce additional challenges. The application needs to handle locally recorded transactions and synchronise them carefully when connectivity returns.

Duplicate submissions, conflicting updates and incomplete synchronisation are important situations to consider when designing this type of workflow.

9. Security considerations

Since the application handles business information and user accounts, security is an important part of the implementation.

Some of the security measures included in ThirdEye POS are:

  • Password hashing
  • CSRF protection
  • Role-based access
  • Shop-level data separation
  • Login throttling
  • Encrypted integration secrets

These measures work together with proper server-side validation and permission checks.

Security should be part of the application architecture from the beginning rather than something added at the end.

10. Technology stack

The core technology stack used for ThirdEye POS is:

Component Technology
Backend framework CodeIgniter
Database MySQL
Application type Web-based application
Additional capability Progressive Web App

The stack provided a practical foundation for building the billing, shop management and platform administration modules.

Lessons from building ThirdEye POS

Working on this project reinforced a few important development lessons.

Plan for multiple tenants early. Shop-level data separation affects database queries, authentication, permissions and reporting. It is much easier to consider these requirements during the initial design.

Keep frequently used workflows simple. Billing is a daily activity. A complicated interface can slow down the people using the system.

Treat reporting as a core feature. Business owners need useful information, not just a database full of transactions.

Enforce permissions on the backend. Frontend restrictions improve the user experience, but they cannot replace server-side access control.

Think about unreliable connectivity. Offline support requires careful handling of transaction data and synchronisation.

Final thoughts

ThirdEye POS started with a simple objective: make everyday shop operations easier to manage through one web-based application.

But building it involved much more than billing. It required thinking about multi-tenant architecture, user permissions, subscriptions, product management, reporting and offline operations.

For developers working on business applications, these are the kinds of practical challenges that make a project interesting.

A good business application is not defined only by how many features it has. It is defined by how reliably those features work together in the user's daily workflow.

Project: ThirdEye POS

Technology: CodeIgniter and MySQL

Case study: https://softwaresolutions.co.in/case-studies/thirdeye-pos-software

Software development services: https://softwaresolutions.co.in/software-company-barasat

šŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.