tpv

Distributed Point-of-Sale System

I designed and developed the backend of a distributed point-of-sale system serving 100+ retail stores, supporting multi-branch inventory, sales processing, and offline-first operations.

The system was built to allow each store to operate independently, even without internet connectivity, while maintaining bidirectional synchronization with a central server for consolidated reporting.

System Architecture

01. Distributed & Offline-First Design

Each branch operates with its own local instance, enabling sales and inventory management without relying on constant connectivity.

  • Bidirectional synchronization between stores and the central server.
  • Eventual consistency model for global data consolidation.
  • Scheduled reconciliation processes and conflict resolution strategies.
02. Database Modeling

Designed a complex relational database in PostgreSQL to support multiple business domains.

  • Modeled sales, multi-branch inventory, catalog, employees, and customers.
  • Optimized queries for high transaction volumes.
  • Efficient bulk synchronization mechanisms.
03. APIs & Synchronization

Architected REST APIs to handle communication between stores and the central system.

  • Endpoints designed for incremental data transfers.
  • Multi-layer validations to ensure data integrity and consistency.
04. Security & Access Control

Implemented robust authentication and authorization mechanisms to protect system operations.

  • JWT authentication with refresh tokens.
  • Role-based access control (RBAC).

Technical Challenges

01. Consistency in Distributed Environments

One of the main challenges was ensuring data consistency across multiple autonomous branches. An eventual consistency model was implemented with controlled reconciliation mechanisms.

02. Scalability

The system was designed to support growth in both number of stores and transaction volume by optimizing SQL queries and minimizing expensive synchronization operations.

03. Separation of Responsibilities

A clear separation was maintained between end-user authentication and system-to-system communication, improving both security and maintainability.

Project Information

  • Type:Professional Project (Confidential)
  • Role:Backend Engineer
  • Stack:NestJS, PostgreSQL, TypeORM, JWT
  • Focus:Distributed architecture & synchronization