Case Study: 3-Layer Architecture for F&B Order System

F&B Manufacturer — 100+ orders/day. Built from scratch with LarkBase, 29-node n8n workflow, and Astro admin as failover channel.

3-Layer Architecture Diagram

System Overview

An F&B manufacturing business in Ho Chi Minh City processes 100+ orders/day across multiple channels: retail, wholesale, and supermarket. Initial challenges: manual data entry, error risks, and lack of failover mechanism when automation systems encounter issues.

Solution: A clearly decoupled 3-layer architecture:

  • Data Layer: LarkBase as relational core (single source of truth)
  • Automation Layer: n8n workflow handling orders via chat messages
  • Interface Layer: Astro Admin as failover channel + extensible module platform
💡 Insight: Decoupling layers allows UI or automation changes without affecting the core data structure — a key principle when designing scalable, maintainable systems.

Layer 1: Interface & Input

Lark Messenger Formatted chat → Auto trigger
Astro Admin Web form → Failover channel
Process & Validate

Layer 2: Automation

n8n Workflow
29 Nodes
Webhook Validate Write DB Reply

Deterministic flow, zero AI dependency.

Sync & Persist

Layer 3: Data Core

LarkBase 15+ Tables
Orders
Details
Customers
Inventory

Single Source of Truth. Normalized schema.

Primary
Failover

Data Layer: LarkBase as Relational Core

The system was built from scratch with 15+ interconnected tables, including: products, customers, promotions, routes, orders (master), order details, inventory, production, and reporting.

Schema Design Principles

  • 3rd Normal Form: Avoid data duplication, ensure integrity
  • Explicit foreign keys: Every relationship clearly defined for easy tracing
  • Strategic indexing: Optimize queries for real-time dashboards
⚠️ Security Note: Table names and detailed schema have been anonymized to protect client business logic.

Automation Layer: 29-Node n8n Workflow

This workflow handles the flow: Lark Messenger → Validate → Write to DB → Reply confirmation.

Operational Mechanism (Zero AI Parsing)

  1. User sends message in standard format: ORDER|CUST_ID|PROD_CODE|QTY
  2. n8n webhook receives payload, validates via Function node
  3. Writes to 2 tables: orders (master) + order_details (child)
  4. Sends confirmation message with order ID back to chat

Technical Differentiators

  • Zero AI dependency: Rule-based validation, no LLM parsing → deterministic, easy to debug
  • Explicit error handling: Each node has retry logic + fallback notification
  • Centralized logging: Every step logged for traceability

Interface Layer: Astro Admin (Failover Channel)

When n8n/VPS encounters issues, Astro Admin serves as a failover channel to ensure business continuity.

Phase 1 Features (Implemented)

  • Auth system: 5 users (1 admin + 4 staff), role-based access control
  • Order form: Simple UI, client-side + server-side validation
  • Direct sync: Writes directly to LarkBase, no middleware

Phase 2+ Roadmap

  • Production management module: Track progress, raw material inventory
  • Inventory reconciliation dashboard: Real-time visualization
  • Reporting engine: PDF/Excel export, scheduled delivery
💡 Why Astro? Static site generation + edge deployment enables fast loading, near-zero cost, and easy LarkBase API integration.

Lesson: Failover Design Pattern

Why Three Order Entry Paths?

Path Mechanism Pros Cons Use Case
Native LarkBase Form Manual entry: orders → order_details Built-in, no setup Time-consuming, error-prone Data correction
n8n + Lark Messenger 1 message = auto-create 2 tables Fast, natural UX Depends on VPS/n8n Daily operations
Astro Admin Form Form web → direct LarkBase write Static hosting, fewer failures Slower than chat Failover when n8n down
💡 Why Build the n8n Workflow?

Native LarkBase form requires multi-step manual entry:
1. Go to orders table → create new record → copy order ID
2. Go to order_details table → create record for product 1 + paste order ID
3. Repeat step 2 for products 2, 3...

The n8n workflow consolidates this into 1 chat message → auto-creates master + N child records → reduces manual steps by ~90%.

Conclusion & Next Steps

Key Takeaways

  • Clear layer separation enables easier maintenance and scalability
  • Failover design is essential for critical business operations
  • No-code + code hybrid (n8n + Astro) balances speed and flexibility

Next Roadmap

  • Reporting module: PDF export, scheduled email delivery
  • Alerting system: Telegram/Zalo notifications for threshold breaches
  • Payment gateway integration: Sync with fulfilled orders
🔒 Disclaimer: Client information and specific business logic have been anonymized for confidentiality. This case study shares architectural patterns and technical learnings, not a commercial service portfolio.

Real Implementation Gallery

n8n Workflow Overview
n8n Workflow (29 Nodes)

Automated order processing structure

LarkBase Dashboard
LarkBase Dashboard

Real-time orders & inventory stats

Astro Admin Interface
Astro Admin Web

Management interface & failover channel

Mobile Messenger
Mobile Messenger

Direct order creation via chat

Ready to build your system?

Leave your info, I will respond and share experience within 24h.

Your information will be used to respond and discuss. We are committed to protecting personal information.