# TallyFlow Architecture

**Diagram:** [[TallyFlow-Architecture-Diagram.html]]

## Overview (5 Components)

TallyFlow is built around exactly **five primary components**, with **Core** as the central hub that owns the database.

### 1. Core (Central)
- **Core Backend** (Go) positioned in the center — provides the REST API
- **Core Web UI** (Vue.js) on the left — consumes the Core API
- **Auth Service** — handles login and SSO support
- Owns MongoDB (assets, tags, photos, zones, events)
- Single API integration point for all other components
- Handles configuration, reporting, and orchestration

### 2. Assets (Mobile)
- Flutter native mobile application
- Lightweight inventory, geiger-style seek & find, enrollment, zone moves
- Communicates with Core via REST/WebSocket API

### 3. Print
- Flutter + Rust implementation
- Zebra ZPL-compatible label printing and RFID encoding
- Includes **Print UI** for configuration
- Can also be driven directly via the **Print API**
- **Can register assets directly with Core**

### 4. Capture (PhotoTag)
- Native mobile application (not Go/Vue)
- Associates photos with barcodes, work orders, and metadata
- Focused on quality control and visual documentation
- Sends data to Core via API

### 5. IoT
- Rust-based service
- Integrates fixed RFID readers (Impinj, Zebra) and environmental sensors
- Pushes tag events and sensor data to Core (optional / dashed connection)
- **Can integrate with ERP systems**

**MongoDB** is not a standalone component — it is fully owned and managed inside Core.

## Data Flows
- **Assets, Print, Capture** → Core: Solid lines (primary flows)
- **IoT → Core**: Dashed line (optional, event-driven)
- **Print** additionally supports asset registration back into Core
- Core Web UI communicates with Core Backend via the same API used by other components

This structure was verified by reviewing the actual source repositories in `~/src/`. All external modules interact exclusively through Core’s REST API layer.