E-commerce Core Concepts & Architecture
This document outlines the fundamental architectural concepts of the Aerocall E-commerce system. Understanding these concepts is crucial for both administrators managing the store and developers building storefronts.
1. High-Level Architecture
The E-commerce module is built on a Headless Architecture.
- Backend (Aerocall API): Handles all logic, database, payment processing, and inventory management.
- Frontend (Storefront): You build this! It communicates with the API to display products and process checkouts.
Key Entities
- Project: The top-level container (your website or app).
- Product: An item available for sale.
- Product Type (Component): Defines the structure of a product (e.g., specific fields for âT-Shirtsâ vs âLaptopsâ).
- Order: A record of a completed transaction.
- Collection (Category): A way to group products.
2. The Power of âProduct Typesâ (Components)
Unlike traditional e-commerce platforms with fixed fields, Aerocall uses a flexible schema system.
The Problem
A T-Shirt needs fields like Size, Color, Fabric.
A Laptop needs CPU, RAM, Screen Size.
Forcing both into a generic âDescriptionâ field is messy.
The Solution: Product Types
A Product Type is simply a Component in Aerocall.
- You create a Component called âApparelâ with fields for Size and Color.
- You create a Product and select âApparelâ as its Type.
- The Admin UI automatically generates a form with those specific fields.
- The API returns those specific fields in a
dataobject.
(Diagram: Product Type (Component) defines schema for Products)
- Component âApparelâ defines schema for Product âBlue T-Shirtâ and Product âRed Hoodieâ
- Component âLaptopâ defines schema for Product âMacBook Proâ
3. Product Structure
A Product entity combines standard e-commerce fields with your custom schema data.
| Field | Type | Purpose |
|---|---|---|
name | String | Standard name (e.g., âBlue T-Shirtâ). |
slug | String | URL-friendly ID (e.g., âblue-t-shirtâ). |
price | Number | Base price in store currency. |
inventory | Integer | Stock count. |
schema_component_id | ID | Links to the Product Type (Component). |
data | JSON | Dynamic fields defined by the Component (e.g., { "size": "M", "color": "Blue" }). |
4. Collections (Categories)
Collections organize your content.
- Hierarchy: Collections can have parents, allowing for nested trees (e.g.,
Men->Clothing->Shirts). - Flexibility: A product can belong to a primary collection, but you can also use Tags or custom relationships for more complex groupings.
5. The Checkout Flow
The checkout process is designed to be secure and atomic.
- Cart Creation: A visitor adds items to a specialized âCartâ object (stored server-side, referenced by ID).
- Checkout Initialization: The Cart is converted into a draft Order.
- Payment Processing: The system communicates with a Payment Provider (e.g., Stripe).
- Order Finalization: Upon successful payment, the Order is marked
paid, inventory is deducted, and webhooks are fired.
6. Globalization (Settings)
Store-wide settings control how money and shipping work.
- Currency: Defined globally for the project (e.g., USD, EUR).
- Tax Rules: Configured to apply automatically at checkout.
- Shipping: Flat rates or free shipping thresholds.
Terminology Glossary
- SKU (Stock Keeping Unit): A unique identifier for each distinct product or variant.
- Variant: A specific version of a product (e.g., âSize Mâ is a variant of âBlue T-Shirtâ). Note: Currently managed via separate Products or custom schema arrays.
- Slug: The part of a URL that identifies a page in a human-readable format.
- Webhook: An automated message sent from apps when something happens (e.g., âOrder Paidâ).