Introduction
E-commerce businesses need accurate inventory records to manage products, fulfill orders, handle returns, and maintain product quality. When a business sells electronics, cosmetics, food products, medical supplies, or other traceable goods, tracking only product quantities is often insufficient. Businesses may also need to know which specific unit or production batch was received, stored, shipped, or returned.
A serial number and batch tracking system for e-commerce inventory helps businesses maintain detailed product traceability throughout the inventory lifecycle. Serial numbers identify individual units, while batch or lot numbers group products produced, received, or handled under the same defined batch.
By connecting these identifiers with purchase orders, warehouse locations, sales orders, shipments, and returns, businesses can improve inventory accuracy, simplify product recalls, and investigate quality issues more efficiently.
In this guide, we explain how to build a serial number and batch tracking system for e-commerce inventory, including essential features, database design, API endpoints, technology choices, security practices, and the development process.
What Is a Serial Number and Batch Tracking System?
A serial number and batch tracking system is software that records product identifiers and tracks their movement through the supply chain.
Although serial numbers and batch numbers serve related purposes, they are not interchangeable.
Serial Number Tracking
A serial number identifies one specific product unit.
For example, if an online electronics store receives 100 laptops, each laptop may have its own serial number. When a customer purchases one laptop, the system records the serial number associated with the shipped unit.
Serial number tracking is useful for:
- Electronics and appliances
- Mobile phones and computers
- Machinery and equipment
- High-value products
- Products requiring warranty registration
- Products that may need individual inspection or service
Batch and Lot Tracking
A batch or lot number identifies a group of products associated with a particular production run, supplier lot, receipt, or other traceability event.
For example, a cosmetics retailer may receive 500 bottles of shampoo from batch SH-2026-104. The system can track how many bottles remain in inventory, which warehouses hold them, and which customer orders received products from that batch.
Batch tracking is especially useful for:
- Food and beverages
- Cosmetics and personal care products
- Supplements and regulated goods
- Products with expiry dates
- Products affected by manufacturing defects
- Inventory that may require a targeted recall
Some businesses need both types of tracking. For example, an electronics retailer may track each laptop by serial number while also recording the supplier lot associated with its shipment.
Why Do E-commerce Businesses Need Product Traceability?
As product volumes increase, manually recording identifiers in spreadsheets becomes difficult. A dedicated tracking system provides a reliable way to connect inventory records with purchasing, warehousing, fulfillment, and after-sales operations.
1. Improve Inventory Accuracy
The system records which serial-numbered units or batches are physically available, reserved, shipped, returned, or quarantined.
This helps prevent the business from allocating products that are already sold, damaged, or under investigation.
2. Simplify Product Recalls
If a supplier reports a defective batch, the business can identify the affected inventory, warehouse locations, and relevant shipments.
Instead of reviewing every order manually, the system can generate a traceability report for the affected batch.
3. Manage Product Expiry Dates
For products with expiry dates, the platform can record manufacturing and expiry information at the batch level.
Warehouse teams can use these records to prioritize products with earlier expiry dates, often through a first-expiry-first-out (FEFO) process.
4. Improve Warranty Management
Serial-number records can connect individual products with customer orders, shipment dates, warranty periods, and service history.
When a customer requests support, the business can verify the product’s identity and purchase information more efficiently.
5. Reduce Counterfeit and Substitution Risks
Recording manufacturer-issued serial numbers and validating them where supported helps identify duplicate identifiers, unexpected substitutions, and products that do not match receiving records.
A serial number alone does not prove authenticity. Verification should use trusted manufacturer or supplier data when available.
6. Improve Returns Processing
When a product is returned, the system can compare its serial number with the original shipment record. This helps detect situations where the returned unit differs from the unit originally sold.
Returned products can then be inspected and classified as sellable, damaged, refurbished, or quarantined.
Essential Features of a Serial Number and Batch Tracking System
1. Product Traceability Configuration
Different products require different tracking policies. The system should allow administrators to configure tracking at the product or SKU level.
Supported modes may include:
- No individual tracking
- Serial-number tracking
- Batch or lot tracking
- Combined serial-number and batch tracking
Product configuration should also define whether identifiers are supplied by the manufacturer, generated internally, or imported from an external system.
For products requiring manufacturer-issued identifiers, the platform should preserve the original values rather than silently replacing them with internally generated numbers.
2. Serial Number Registration
The system should register individual product units during receiving, manufacturing integration, or inventory migration.
Each record may include:
- Serial number
- Product and SKU
- Associated batch, if applicable
- Supplier or manufacturer
- Purchase order and receipt
- Warehouse and storage location
- Current inventory status
- Warranty information, if required
The platform should validate serial-number uniqueness within the appropriate scope. In many cases, a serial number should be unique across all products from the same manufacturer, not merely within one warehouse.
3. Batch and Lot Registration
When a batch is received, the system should capture the batch identifier and relevant product information.
Useful fields include:
- Batch or lot number
- Product SKU
- Supplier
- Manufacturing date
- Expiry date, where applicable
- Receipt date
- Quantity received
- Quantity available
- Quality inspection status
- Storage requirements, where relevant
The system should distinguish supplier lot numbers from internal receipt or warehouse batch references. A single supplier lot may arrive in multiple deliveries, so the data model must support that relationship when required.
4. Barcode and QR Code Scanning
Warehouse employees should be able to scan product labels using handheld scanners, mobile devices, or compatible barcode equipment.
Scanning can support:
- Receiving products
- Assigning products to storage locations
- Picking products for orders
- Verifying serial numbers before dispatch
- Processing returns
- Performing stock counts
- Moving stock between warehouses
The system should validate scanned values and provide clear feedback when a code is unknown, duplicated, invalid, or associated with a different product.
Barcode and QR code formats should be selected based on supplier labels, product requirements, and scanner compatibility.
5. Purchase Order and Goods Receipt Integration
The tracking system should connect product identifiers with purchasing and receiving records.
When inventory arrives, the receiving workflow can:
- Retrieve the relevant purchase order.
- Verify the product and expected quantity.
- Scan or import serial numbers and batch identifiers.
- Validate expiry dates and other required fields.
- Record quality inspection results.
- Assign accepted stock to a warehouse location.
- Quarantine rejected or unverified products.
- Update available inventory after the receipt is confirmed.
The system should prevent the same serialized unit from being received twice unless an authorized correction workflow explicitly permits it.
6. Order Allocation and Picking
When an order is created, the system reserves the required inventory. For serialized products, the business may select the exact unit during allocation or at picking, depending on its operational process.
For batch-tracked products, the system should select eligible inventory according to business rules, such as FEFO, FIFO, customer requirements, or quality status.
Before shipment, the system should verify that the scanned serial number or batch belongs to the correct SKU and is eligible for dispatch.
This reduces picking errors and ensures that shipment records identify the actual products sent to customers.
7. Inventory Movement History
Every relevant movement should be recorded as a traceability event.
Examples include:
- Supplier receipt
- Warehouse transfer
- Stock reservation
- Order allocation
- Shipment
- Customer return
- Quality inspection
- Quarantine
- Repair or refurbishment
- Disposal or write-off
A movement history allows authorized users to reconstruct where a product or batch has been and what happened at each stage.
Instead of overwriting historical data, the platform should retain previous events and record corrections as new, auditable entries.
8. Returns and Warranty Tracking
Returned serialized products should be linked to the original order and shipment wherever possible.
The return workflow should verify the identifier, inspect the product, and determine the next inventory status.
Possible outcomes include:
- Returned to sellable stock
- Sent for repair
- Sent for refurbishment
- Placed in quarantine
- Returned to the supplier
- Written off
For batch-tracked goods, the system should also verify whether the batch is recalled, expired, or otherwise restricted before returning any quantity to available inventory.
9. Batch Recall and Traceability Reports
A traceability report should identify affected inventory across the supply chain.
For a selected batch, the system should be able to report:
- Quantity originally received
- Current quantities by warehouse
- Quantities reserved or quarantined
- Quantities shipped
- Related customer orders
- Shipment dates
- Returned quantities
- Supplier and purchase order details
Access to customer information should be restricted to authorized roles, and reports should expose only the personal data needed for the operational task.
10. Alerts and Notifications
Notifications help teams respond to traceability problems quickly.
Examples include:
- Duplicate serial-number registration
- Expired or near-expiry inventory
- A recalled batch found in available stock
- A serialized product scanned against the wrong order
- A shipment containing an unverified identifier
- A quality inspection failure
- A mismatch between expected and received quantities
Alerts should be prioritized by severity and routed to the relevant warehouse, purchasing, quality, or customer support team.
Step-by-Step Process to Build the System
Step 1: Define Tracking Requirements
Start by determining which products require serial-number tracking, batch tracking, or both.
Identify whether the system must support expiry dates, warranty details, manufacturer verification, warehouse transfers, product recalls, and return inspections.
Document the rules for generating identifiers, handling duplicate numbers, and correcting mistakes.
Also determine whether the platform will replace an existing inventory system or integrate with an ERP, warehouse management system (WMS), or e-commerce platform.
Step 2: Design the System Architecture
A modular architecture separates tracking logic from purchasing, inventory, and fulfillment workflows.
A typical design includes:
- Frontend dashboard: Product traceability, stock status, receiving, and reporting screens.
- Backend API: Validation, permissions, tracking rules, and business operations.
- Inventory service: Stock balances, reservations, and warehouse movements.
- Serial number service: Individual unit registration and lifecycle tracking.
- Batch management service: Batch details, expiry dates, quality status, and recall information.
- Order and fulfillment integration: Order allocation, picking, shipment confirmation, and returns.
- Notification service: Alerts for expiry, recall, and validation failures.
- Database: Product, identifier, movement, and transaction records.
For an MVP, these modules can live in a single well-structured application. Separate services can be introduced if scaling or integration requirements justify them.
Step 3: Create the Database Design
Design the data model to represent products, serial numbers, batches, warehouses, and inventory movements separately.
A serialized unit should reference its product and, where appropriate, its batch. A batch should be associated with a product, while receipts and shipments should record the specific quantities or units involved.
This separation is important because one batch can contain many individual units, and one supplier lot may be received in multiple transactions.
Use database constraints to prevent duplicate identifiers and invalid relationships.
Step 4: Build Receiving and Registration Workflows
Develop the receiving interface first because accurate traceability begins when stock enters the business.
Employees should be able to scan identifiers, import data from a file, or enter values manually when permitted.
The application should validate each entry against the purchase order, product configuration, existing serial numbers, batch records, and quality rules.
If a receiving operation fails partway through, the system should either complete the transaction safely or leave a clearly recoverable state. It should not create partially registered stock that appears available for sale.
Step 5: Implement Inventory Status and Movement Logic
Define a controlled set of inventory statuses and valid transitions.
For example, a serialized product may move from received to available, then to reserved, shipped, or quarantined, depending on the business process.
Batch quantities require additional care. When 100 units are shipped from a batch of 500, the system must record the shipment and reduce the relevant inventory quantity by 100 without allowing another transaction to allocate the same units.
Use database transactions and appropriate locking or concurrency controls to prevent overselling and inconsistent stock balances.
Step 6: Integrate E-commerce Orders
Connect the platform to the online store or order management system.
When an order is placed, the integration should reserve eligible stock. During fulfillment, warehouse staff scan the actual units or batch labels being picked.
At shipment confirmation, the system records the identifiers associated with the shipment and synchronizes the order status with the sales channel.
Use idempotency keys, event identifiers, and retry-safe processing so that repeated webhook deliveries do not create duplicate shipments or inventory movements.
Step 7: Add Returns and Recall Workflows
Implement returns processing that links the received product to the original shipment whenever possible.
For serial-tracked goods, verify the returned serial number. For batch-tracked goods, validate the batch status and any restrictions before accepting the goods back into sellable inventory.
Build a recall workflow that can flag an affected batch, restrict new allocations, identify existing stock, and generate shipment and order reports.
For an actual recall, the business should also follow the relevant product-specific legal and regulatory requirements.
Step 8: Build Dashboards and Reports
Create role-specific views for warehouse operators, inventory managers, quality teams, and administrators.
Useful dashboards include:
- Inventory by serial number and warehouse
- Batch quantities and expiry dates
- Recent product movements
- Unverified or duplicate identifiers
- Quarantined inventory
- Returned serialized products
- Recall exposure by batch
- Receiving and fulfillment exceptions
Provide search by SKU, serial number, batch number, purchase order, order ID, or shipment ID.
Step 9: Test the System
Test both normal operations and traceability edge cases.
Important test scenarios include:
- Registering a duplicate serial number
- Receiving the same supplier lot in multiple deliveries
- Scanning a product that does not match an order
- Shipping only part of a batch
- Processing a return with a mismatched serial number
- Attempting to allocate recalled or expired inventory
- Transferring stock between warehouses
- Receiving duplicate webhook events
- Handling concurrent orders for the same serialized unit
- Correcting an erroneous identifier while preserving the audit history
Run integration tests with the e-commerce platform, warehouse systems, and barcode scanners. Validate that traceability reports reconcile with the underlying transaction records.
Step 10: Deploy and Maintain the Platform
Deploy the application in a secure environment with monitoring, backups, and documented recovery procedures.
Start with a limited group of products and warehouses. Verify receiving accuracy, scanning performance, inventory reconciliation, and recall-report completeness before expanding the rollout.
Review exception reports regularly and update tracking rules when new product categories, suppliers, or fulfillment workflows are introduced.
Recommended Technology Stack
The stack should fit the company’s existing systems, expected transaction volume, and development team’s expertise.
| Component | Recommended Technologies | Purpose |
|---|---|---|
| Frontend | React or Next.js | Inventory dashboard and scanning workflows |
| Backend | Node.js with NestJS or Python with FastAPI | Business rules and API endpoints |
| Database | PostgreSQL | Products, identifiers, batches, and movement records |
| Cache | Redis | Short-lived lookups and frequently accessed data |
| Background processing | BullMQ, Celery, or a managed queue | Imports, reports, and asynchronous integrations |
| Barcode support | Compatible USB, Bluetooth, or mobile scanners | Identifier capture in warehouses |
| File storage | S3-compatible object storage | Import files and generated reports |
| Integration | REST APIs and webhooks | E-commerce, ERP, WMS, and supplier systems |
| Cloud infrastructure | AWS, Azure, or Google Cloud | Application hosting and operational services |
| Monitoring | OpenTelemetry with compatible monitoring tools | Error tracking and performance monitoring |
A relational database is a strong choice for core traceability records because the system requires consistent relationships, uniqueness constraints, and reliable transactions.
Suggested Database Schema
The following tables provide a practical starting point.
| Table | Important Fields | Purpose |
|---|---|---|
products | id, sku, name, tracking_mode | Defines product tracking requirements |
serial_numbers | id, product_id, serial_number, batch_id, status | Tracks individual serialized units |
batches | id, product_id, batch_number, manufactured_at, expires_at, quality_status | Stores batch-level details |
warehouses | id, name, location | Defines inventory locations |
inventory_balances | product_id, warehouse_id, batch_id, on_hand_qty, reserved_qty | Maintains batch-level inventory quantities |
serial_location_history | serial_id, warehouse_id, location_code, recorded_at | Tracks serialized unit locations |
inventory_movements | id, product_id, serial_id, batch_id, movement_type, quantity, reference_id | Records stock movements |
purchase_orders | id, supplier_id, status, expected_delivery_date | Stores purchasing information |
goods_receipts | id, purchase_order_id, received_at, status | Records receiving transactions |
order_items | id, order_id, product_id, quantity | Stores customer order lines |
shipment_items | id, shipment_id, order_item_id, serial_id, batch_id, quantity | Records identifiers and quantities shipped |
returns | id, order_id, status, received_at | Stores customer return records |
quality_events | id, batch_id, serial_id, event_type, status, created_at | Records inspections and quality issues |
audit_logs | id, user_id, action, entity_type, entity_id, created_at | Tracks important changes |
The exact schema depends on whether products are serial-tracked, batch-tracked, or both. For serialized products, inventory quantities should reconcile with individual unit records. For batch-tracked products, the system must maintain accurate quantities by batch and warehouse.
Use unique constraints for serial numbers at the appropriate scope. Batch-number uniqueness should also follow the business’s identifier rules, which may require a combination of supplier, product, manufacturer, and batch number rather than the batch number alone.
For traceability, record the relevant identifier on each receipt, movement, and shipment. Avoid relying only on the current status because historical events are necessary to reconstruct the product’s lifecycle.
Example API Endpoints
A REST API can expose tracking functionality to the dashboard, warehouse applications, and integrated business systems.
| Method | Endpoint | Purpose |
|---|---|---|
POST | /api/v1/serial-numbers | Register a serialized product |
GET | /api/v1/serial-numbers/{serialNumber} | Retrieve serial-number details |
POST | /api/v1/batches | Register a product batch |
GET | /api/v1/batches/{batchNumber} | Retrieve batch details |
POST | /api/v1/goods-receipts | Record a goods receipt |
POST | /api/v1/inventory/movements | Record an inventory movement |
POST | /api/v1/shipments/{id}/confirm | Confirm shipment details |
POST | /api/v1/returns | Register a product return |
GET | /api/v1/traceability/batches/{batchId} | Retrieve batch traceability information |
POST | /api/v1/batches/{id}/quarantine | Restrict a batch from normal allocation |
Example Serial Number Registration Request
{
"product_id": "PROD-1001",
"serial_number": "SN-2026-000045",
"batch_number": "BATCH-2026-104",
"warehouse_id": "WH-01",
"source": "goods_receipt"
}
The API should validate that the product exists, the identifier follows the product’s tracking policy, and the serial number has not already been registered within its uniqueness scope.
Example Batch Traceability Response
{
"batch_number": "BATCH-2026-104",
"product_id": "PROD-1001",
"warehouse_id": "WH-01",
"received_quantity": 500,
"available_quantity": 320,
"reserved_quantity": 30,
"shipped_quantity": 150,
"quality_status": "approved"
}
These values are illustrative. In a production system, the quantities should be derived from consistent inventory records and reconciled with recorded receipts, reservations, shipments, returns, and adjustments.
Security and Data Integrity Best Practices
Serial and batch records can be important for product recalls, warranties, and customer disputes. The system should protect both data accuracy and access to sensitive business information.
- Role-based permissions: Restrict who can register identifiers, adjust stock, release quarantined goods, or approve corrections.
- Identifier validation: Reject duplicate or invalid serial numbers and batch references according to defined rules.
- Immutable history: Preserve movement and audit records. Corrections should create traceable adjustment events rather than silently changing historical transactions.
- Transactional updates: Update stock balances and related movement records within consistent database transactions.
- Idempotent integrations: Prevent duplicate webhook events and repeated requests from registering the same receipt or shipment twice.
- Secure APIs: Use authentication, authorization, rate limits, and input validation.
- Encryption: Protect sensitive data in transit and at rest.
- Data minimization: Limit customer information in traceability reports and restrict access to authorized personnel.
- Backup and recovery: Test backups and ensure traceability records can be restored.
- Reconciliation: Compare inventory balances with serialized units, batch quantities, and physical stock counts.
Common Challenges and Solutions
| Challenge | Cause | Recommended Solution |
|---|---|---|
| Duplicate serial numbers | Manual entry errors or repeated imports | Apply uniqueness constraints and validate before registration |
| Missing batch details | Incomplete supplier documentation | Require essential fields and use receiving exception workflows |
| Incorrect inventory balances | Stock changes are not recorded consistently | Record movements transactionally and reconcile regularly |
| Wrong product shipped | Picking errors or incorrect labels | Scan and validate identifiers before dispatch |
| Difficult recall investigations | Shipment records do not reference batches | Record batch and serial references on fulfillment transactions |
| Inaccurate returns | Returned unit differs from the original shipment | Verify serial numbers against the original order |
| Barcode scanning failures | Incompatible formats or damaged labels | Support configured barcode standards and provide manual exception handling |
| Integration duplicates | Webhook retries or network failures | Use idempotency keys and unique event identifiers |
| Unauthorized stock corrections | Weak permissions or missing audit history | Enforce approval workflows and record every adjustment |
Key Performance Indicators to Track
Measuring system performance helps businesses assess whether traceability is improving warehouse accuracy and reducing operational risk.
| KPI | What It Measures |
|---|---|
| Serial Number Capture Rate | Percentage of required serialized units with valid recorded identifiers |
| Batch Traceability Coverage | Percentage of applicable inventory linked to valid batch records |
| Inventory Record Accuracy | Agreement between system inventory and physical counts |
| Receiving Error Rate | Frequency of identifier or quantity errors during receiving |
| Picking Accuracy | Percentage of order lines picked and verified correctly |
| Traceability Report Completion Time | Time required to produce a report for a selected serial number or batch |
| Recall Identification Time | Time required to identify affected stock and shipments |
| Return Verification Rate | Percentage of applicable returns matched to the original shipped identifier |
| Duplicate Identifier Rate | Frequency of duplicate registration attempts |
| Quarantined Stock Compliance | Whether restricted inventory remains unavailable for normal allocation |
Define KPI targets according to the products being handled and the business’s operational requirements. For products that require individual tracking, identifier capture should be enforced at the appropriate process stage rather than treated as an optional reporting metric.
How Much Does It Cost to Build the System?
The development cost depends on the number of warehouses, product tracking requirements, scanner hardware, integrations, and reporting needs.
A basic system may include product registration, serial and batch tracking, inventory movement history, and a simple dashboard. A more advanced platform may require ERP integration, barcode-based warehouse operations, warranty tracking, recall management, multi-warehouse support, and complex return workflows.
The main cost factors include:
- UI/UX design and frontend development
- Backend and database development
- Barcode and QR code integration
- E-commerce and ERP integrations
- Warehouse receiving and picking workflows
- Security, audit trails, and testing
- Cloud infrastructure and ongoing maintenance
A practical strategy is to launch an MVP with product-level tracking configuration, receiving, serial and batch registration, inventory movements, and shipment traceability. Add advanced recall analytics, manufacturer verification, and automated supplier integrations after the core workflows are reliable.
Conclusion
Building a serial number and batch tracking system for e-commerce inventory gives businesses better visibility into individual products and product lots throughout their lifecycle. It helps improve inventory accuracy, verify returns, support warranty operations, and identify affected products when quality issues or recalls occur.
The foundation of a reliable system is accurate identifier capture, consistent inventory movement records, and a clear connection between receiving, warehouse operations, customer orders, and shipments. With appropriate database constraints, secure integrations, and auditable workflows, businesses can build a traceability platform that grows with their operational needs.
Dotcube Technologies helps businesses develop custom inventory management platforms, e-commerce integrations, and warehouse software tailored to their workflows. If your business needs a serial number and batch tracking solution, our team can help plan and build a reliable platform.
Contact Dotcube Technologies: https://www.dotcubetechnologies.com/#contact




