{
  "id": "ecommerce",
  "slug": "ecommerce",
  "title": "E-commerce Store Backend",
  "description": "Products, variants, categories, orders, customers, carts, and reviews. Preview the verified schema then clone into Apito Console.",
  "version": "1.0.0",
  "checksum": "sha256:ecommerce-v1-2026-07-24",
  "status": "verified",
  "edition": "both",
  "project_type": "general",
  "database_intent": "sqlite",
  "source": "console projectTemplates ecommerce + Apito Engineering review",
  "reviewed_at": "2026-07-24",
  "architecture_notes": "Catalog + cart + order flow. Products have variants and categories; orders belong to customers with line items.",
  "models": [
    {
      "name": "category",
      "label": "Category",
      "scope": "general",
      "fields": [
        { "identifier": "name", "label": "Name", "field_type": "text", "required": true },
        { "identifier": "slug", "label": "Slug", "field_type": "text", "required": true }
      ]
    },
    {
      "name": "product",
      "label": "Product",
      "scope": "general",
      "fields": [
        { "identifier": "name", "label": "Name", "field_type": "text", "required": true },
        { "identifier": "slug", "label": "Slug", "field_type": "text", "required": true },
        { "identifier": "description", "label": "Description", "field_type": "multiline" },
        { "identifier": "base_price", "label": "Base Price", "field_type": "number", "input_type": "double", "required": true },
        { "identifier": "active", "label": "Active", "field_type": "boolean", "input_type": "bool" }
      ]
    },
    {
      "name": "product_variant",
      "label": "Product Variant",
      "scope": "general",
      "fields": [
        { "identifier": "sku", "label": "SKU", "field_type": "text", "required": true },
        { "identifier": "price", "label": "Price", "field_type": "number", "input_type": "double", "required": true },
        { "identifier": "stock", "label": "Stock", "field_type": "number", "input_type": "int" },
        { "identifier": "options", "label": "Options", "field_type": "object", "nested": [
          { "identifier": "size", "label": "Size", "field_type": "text" },
          { "identifier": "color", "label": "Color", "field_type": "text" }
        ]}
      ]
    },
    {
      "name": "customer",
      "label": "Customer",
      "scope": "general",
      "fields": [
        { "identifier": "email", "label": "Email", "field_type": "text", "required": true },
        { "identifier": "name", "label": "Name", "field_type": "text", "required": true },
        { "identifier": "phone", "label": "Phone", "field_type": "text" }
      ]
    },
    {
      "name": "address",
      "label": "Address",
      "scope": "general",
      "fields": [
        { "identifier": "line1", "label": "Line 1", "field_type": "text", "required": true },
        { "identifier": "city", "label": "City", "field_type": "text", "required": true },
        { "identifier": "country", "label": "Country", "field_type": "text", "required": true },
        { "identifier": "postal_code", "label": "Postal Code", "field_type": "text" }
      ]
    },
    {
      "name": "cart",
      "label": "Cart",
      "scope": "general",
      "fields": [
        { "identifier": "status", "label": "Status", "field_type": "list", "options": ["open", "converted", "abandoned"], "required": true }
      ]
    },
    {
      "name": "order",
      "label": "Order",
      "scope": "general",
      "fields": [
        { "identifier": "number", "label": "Order Number", "field_type": "text", "required": true },
        { "identifier": "status", "label": "Status", "field_type": "list", "options": ["pending", "paid", "shipped", "cancelled"], "required": true },
        { "identifier": "total", "label": "Total", "field_type": "number", "input_type": "double", "required": true }
      ]
    },
    {
      "name": "order_item",
      "label": "Order Item",
      "scope": "general",
      "fields": [
        { "identifier": "quantity", "label": "Quantity", "field_type": "number", "input_type": "int", "required": true },
        { "identifier": "unit_price", "label": "Unit Price", "field_type": "number", "input_type": "double", "required": true }
      ]
    },
    {
      "name": "review",
      "label": "Review",
      "scope": "general",
      "fields": [
        { "identifier": "rating", "label": "Rating", "field_type": "number", "input_type": "int", "required": true },
        { "identifier": "body", "label": "Body", "field_type": "multiline" }
      ]
    }
  ],
  "relations": [
    { "from": "category", "to": "product", "forward": "has_many", "reverse": "has_one" },
    { "from": "product", "to": "product_variant", "forward": "has_many", "reverse": "has_one" },
    { "from": "customer", "to": "address", "forward": "has_many", "reverse": "has_one" },
    { "from": "customer", "to": "cart", "forward": "has_many", "reverse": "has_one" },
    { "from": "customer", "to": "order", "forward": "has_many", "reverse": "has_one" },
    { "from": "order", "to": "order_item", "forward": "has_many", "reverse": "has_one" },
    { "from": "product", "to": "order_item", "forward": "has_many", "reverse": "has_one" },
    { "from": "cart", "to": "order_item", "forward": "has_many", "reverse": "has_one" },
    { "from": "product", "to": "review", "forward": "has_many", "reverse": "has_one" },
    { "from": "customer", "to": "review", "forward": "has_many", "reverse": "has_one" }
  ],
  "roles": [
    { "name": "admin", "is_admin": true, "permissions": ["product:*", "category:*", "order:*", "customer:*", "cart:*", "review:*"] },
    { "name": "customer", "permissions": ["product:read", "category:read", "cart:*", "order:create", "order:read", "review:create", "address:*"] }
  ],
  "graphql_operations": [
    { "name": "productList", "type": "query", "model": "product", "example": "query { productList(where: { active: { eq: true } }) { id data { name base_price } } }" },
    { "name": "createOrder", "type": "mutation", "model": "order", "example": "mutation($payload: JSON!, $connect: JSON) { createOrder(payload: $payload, connect: $connect) { id } }" }
  ],
  "rest_endpoints": [
    { "method": "GET", "path": "/secured/rest/product", "description": "List products" },
    { "method": "POST", "path": "/secured/rest/order", "description": "Create order" }
  ],
  "sdk_examples": [
    {
      "language": "javascript",
      "title": "List active products",
      "code": "const products = await client.query(`query { productList(where: { active: { eq: true } }) { id data { name base_price } } }`);"
    },
    {
      "language": "flutter",
      "title": "List products",
      "code": "final products = await client.query('''query { productList { id data { name } } }''');"
    },
    {
      "language": "go",
      "title": "Create order",
      "code": "id, err := client.Create(\"order\", map[string]any{\"number\": \"ORD-1\", \"status\": \"pending\", \"total\": 42.0})"
    }
  ],
  "limitations": ["Static verified preview only.", "Payments / checkout providers are not included in this schema."],
  "clone_requirements": ["Apito Console account", "Project create permission"],
  "smoke_tests": ["productList filters active products", "createOrder connects customer and items"],
  "experience": {
    "experience_type": "playground",
    "preview_modules": ["overview", "schema", "erd", "graphql", "rest", "permissions", "sdk", "download"],
    "cta_label": "Clone this backend",
    "handoff_policy": "signed_preview"
  }
}
