# System Architecture

TAGBASE is built as a modular system that connects physical NFC tags with cloud-based verification, analytics, and (optionally) blockchain infrastructure. It is optimized for low friction on the end-user side and high security and extensibility on the backend.

***

### High-Level Overview

```plaintext
┌────────────┐     ┌─────────────┐     ┌─────────────┐     ┌──────────────┐
│  NFC TAG   │ --> │  Smartphone │ --> │ TAGBASE API │ --> │ Verification │
│ (NTAG 424) │     │   (Browser) │     │   (Backend) │     │   Database   │
└────────────┘     └─────────────┘     └─────────────┘     └──────────────┘
```

### Core Components

#### 1. **NFC Tags**

* **Hardware:** NTAG 424 DNA chips
* **Security:** AES-128 CMAC, unique UID, anti-cloning counter
* **Data:** Pre-encoded secure URL with crypto parameters

#### 2. **User Interface**

* **Device:** NFC-enabled mobile phone (iOS/Android)
* **Interface:** Default mobile browser (no app)
* **Behavior:** Tap-to-open secure URL

#### 3. **Verification API (Backend)**

* Built with **Elixir + Phoenix** for fault tolerance and speed
* Stateless endpoint that verifies each scan using:
  * Encrypted URL tokens
  * Session tracking and delta analysis
  * Tag state and activation status
* Connects to internal services: logging, analytics, blockchain, and portals

#### 4. **Verification Database**

* **Stores:**
  * Tag status (active/inactive)
  * Scan history
  * Session deltas
  * Optional ownership metadata
* Powered by **PostgreSQL**, with **pgvector** for advanced tracking and embeddings

#### 5. **Web Portal**

* Internal + customer-facing UI
* Supports:
  * Tag batch management
  * Live verification map
  * Order and analytics dashboards

#### 6. **Blockchain Integration (Optional)**

* Chain support: **Cardano**, **Ethereum**, **Solana**
* Use cases:
  * Minting NFTs or fungible tokens
  * Ownership records
  * Resale tracking

***

### Scalability & Modularity

TAGBASE is designed to support:

* Thousands of concurrent scans
* Millions of tags
* Distributed tag writing via Raspberry Pi + USB writer systems
* Lightweight deployment on edge devices (in progress)

Each component can be independently scaled, replaced, or extended via API.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tagbase.io/general/system-architecture.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
