# shashwat230710/rift-mart architecture

> Architecture diagram of the GitHub repository shashwat230710/rift-mart, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shashwat230710/rift-mart
- Repository: https://github.com/shashwat230710/rift-mart

## Overview

1. **Repository shape**
   RiftMart is split into three meaningful areas: a **React/Vite frontend** that presents the retro terminal experience, a **Python payment service** that handles wallet/receipt state, and two currently **empty placeholders** (`backend/`, `agent/`) for future services.

2. **User-facing application**
   The active UI lives in `frontend/`. It is a client-side React app built with Vite and styled as a Windows XP / terminal-inspired interface. This is the main entry point for the shopping journey.

3. **Frontend runtime and composition**
   `frontend/src/App.jsx` and `main.jsx` boot the app, while the UI is decomposed into stage-like components:
   `BootScreen`, `AsciiLogo`, `Conversation`, `Terminal`, `ShopAgent`, `PaymentModule`, `Receipt`, and `Shutdown`.
   The component names suggest a linear, state-driven experience that simulates an “OS” booting into an autonomous shopping session and then shutting down.

4. **Frontend domain flow**
   The frontend is not a normal browse-and-click storefront. It is designed around a **guided autonomous workflow**:
   boot → conversation/input → shopping agent activity → payment handoff → receipt display → shutdown.
   The user provides only the shopping goal and budget; the rest of the interaction is presented as agent-driven progress.

5. **Agent orchestration boundary**
   The `Conversation`, `Terminal`, and `ShopAgent` components form the UI boundary for the “AI agent” experience. They likely manage session state, log output, and step-by-step progress updates, even though no standalone agent implementation is present in the repo yet.

6. **Payment subsystem**
   The only substantive backend-like code is in `payment/`. This is a Python service area with:
   - `api.py` for the HTTP/API layer
   - `wallet.py` for wallet/account logic
   - `receipt_generator.py` for receipt creation
   - `requirements.txt` for Python dependencies
   This subsystem is separate from the frontend and appears to own transaction completion and record keeping.

7. **Persistent payment state**
   `payment/wallet.json` and `payment/transactions.json` indicate local file-based persistence rather than a database server. This makes the payment layer stateful and lightweight, with receipts written to `payment/receipts/` as text files.

8. **Receipt/output artifact flow**
   Receipts are materialized as files such as `RIFT-20260712-....txt`. That suggests the payment flow ends in a durable transaction artifact that can be displayed back in the frontend via the `Receipt` component.

9. **Backend placeholders**
   The `backend/` directory is empty, so there is no implemented general-purpose application server in this snapshot. Any architecture diagram should show this as **planned or absent**, not as an active service.

10. **Missing agent implementation**
   The `agent/` directory is also empty, despite the README describing an autonomous shopping agent. So the repo currently contains the **UI simulation** of the agent workflow, but not a separate executable agent service.

11. **Integration boundary**
   The intended integration line is between the frontend experience and the Python payment module. The frontend presents the autonomous shopping journey, and the payment service is the place where balances, transaction history, and receipts are created and stored.

12. **Technology summary**
   The implemented stack is:
   - **React + Vite** for the frontend
   - **Python + FastAPI** for payment/API logic
   - **JSON/text files** for local persistence of wallet, transactions, and receipts
   No relational database or external commerce platform is present in the repository snapshot.

13. **Architecture takeaway**
   For a diagram, the safest representation is: **single-page retro shopping UI** on the left, **local Python payment/receipt service** on the right, with **empty placeholders for future backend/agent services**. The project is currently more of a polished autonomous-commerce prototype than a fully wired multi-service system.

Main entry points: [`frontend/src/main.jsx`](https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/main.jsx) (App boot), [`payment/api.py`](https://github.com/shashwat230710/rift-mart/blob/main/payment/api.py) (API layer), [`payment/receipt_generator.py`](https://github.com/shashwat230710/rift-mart/blob/main/payment/receipt_generator.py) (Receipt builder), [`frontend/src/components/BootScreen.jsx`](https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/BootScreen.jsx) (Boot screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_frontend_entry["App boot<br/>React entry<br/>[main.jsx]"]
  node_frontend_boot["Boot screen<br/>UI stage<br/>[BootScreen.jsx]"]
  node_frontend_logo["ASCII logo<br/>branding UI<br/>[AsciiLogo.jsx]"]
  node_frontend_conversation["Conversation<br/>agent UI<br/>[Conversation.jsx]"]
  node_frontend_terminal["Terminal<br/>session UI<br/>[Terminal.jsx]"]
  node_frontend_agent["Shop agent<br/>workflow UI<br/>[ShopAgent.jsx]"]
  node_frontend_payment["Payment handoff<br/>checkout UI<br/>[PaymentModule.jsx]"]
  node_frontend_receipt["Receipt view<br/>result UI<br/>[Receipt.jsx]"]
  node_frontend_shutdown["Shutdown<br/>UI stage<br/>[Shutdown.jsx]"]
end

subgraph group_payment["Payment"]
  node_payment_api["API layer<br/>Python API<br/>[api.py]"]
  node_payment_wallet[("Wallet logic<br/>state service<br/>[wallet.py]")]
  node_payment_receipt["Receipt builder<br/>artifact service"]
  node_payment_state[("Local storage<br/>file state<br/>[wallet.json]")]
  node_payment_receipts["Receipts files<br/>output store"]
end

subgraph group_planned["Planned"]
  node_backend_placeholder["Backend<br/>empty placeholder"]
  node_agent_placeholder["Agent<br/>empty placeholder"]
end

node_frontend_entry -->|"starts"| node_frontend_boot
node_frontend_boot -->|"shows"| node_frontend_logo
node_frontend_logo -->|"advances to"| node_frontend_conversation
node_frontend_conversation -->|"logs into"| node_frontend_terminal
node_frontend_terminal -->|"drives"| node_frontend_agent
node_frontend_agent -->|"handoff"| node_frontend_payment
node_frontend_payment -->|"calls"| node_payment_api
node_payment_api -->|"uses"| node_payment_wallet
node_payment_wallet -->|"persists"| node_payment_state
node_payment_api -->|"generates"| node_payment_receipt
node_payment_receipt -->|"writes"| node_payment_receipts
node_payment_receipt -->|"returns"| node_frontend_receipt
node_frontend_receipt -->|"ends"| node_frontend_shutdown
node_frontend_entry -.->|"no implementation"| node_backend_placeholder
node_frontend_entry -.->|"no implementation"| node_agent_placeholder

click node_frontend_entry "https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/main.jsx"
click node_frontend_boot "https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/BootScreen.jsx"
click node_frontend_logo "https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/AsciiLogo.jsx"
click node_frontend_conversation "https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/Conversation.jsx"
click node_frontend_terminal "https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/Terminal.jsx"
click node_frontend_agent "https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/ShopAgent.jsx"
click node_frontend_payment "https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/PaymentModule.jsx"
click node_frontend_receipt "https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/Receipt.jsx"
click node_frontend_shutdown "https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/Shutdown.jsx"
click node_payment_api "https://github.com/shashwat230710/rift-mart/blob/main/payment/api.py"
click node_payment_wallet "https://github.com/shashwat230710/rift-mart/blob/main/payment/wallet.py"
click node_payment_receipt "https://github.com/shashwat230710/rift-mart/blob/main/payment/receipt_generator.py"
click node_payment_state "https://github.com/shashwat230710/rift-mart/blob/main/payment/wallet.json"
click node_payment_receipts "https://github.com/shashwat230710/rift-mart/tree/main/payment/receipts"
click node_backend_placeholder "https://github.com/shashwat230710/rift-mart/tree/main/backend"
click node_agent_placeholder "https://github.com/shashwat230710/rift-mart/tree/main/agent"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend_entry,node_frontend_boot,node_frontend_logo,node_frontend_conversation,node_frontend_terminal,node_frontend_agent,node_frontend_payment,node_frontend_receipt,node_frontend_shutdown toneBlue
class node_payment_api,node_payment_wallet,node_payment_receipt,node_payment_state,node_payment_receipts toneAmber
class node_backend_placeholder,node_agent_placeholder toneMint
```

## Components

### Frontend

React/Vite terminal-style shopping experience

- [App boot](https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/main.jsx): React entry · Bootstraps the client app from main.jsx and App.jsx · `frontend/src/main.jsx`
- [Boot screen](https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/BootScreen.jsx): UI stage · Startup/boot sequence shown before the shopping flow · `frontend/src/components/BootScreen.jsx`
- [ASCII logo](https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/AsciiLogo.jsx): branding UI · Retro terminal branding and visual identity · `frontend/src/components/AsciiLogo.jsx`
- [Conversation](https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/Conversation.jsx): agent UI · Captures the user goal and drives the guided interaction · `frontend/src/components/Conversation.jsx`
- [Terminal](https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/Terminal.jsx): session UI · Displays step-by-step progress and log-like output · `frontend/src/components/Terminal.jsx`
- [Shop agent](https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/ShopAgent.jsx): workflow UI · Represents autonomous shopping progress inside the UI · `frontend/src/components/ShopAgent.jsx`
- [Payment handoff](https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/PaymentModule.jsx): checkout UI · Front-end bridge into the payment subsystem · `frontend/src/components/PaymentModule.jsx`
- [Receipt view](https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/Receipt.jsx): result UI · Shows the completed transaction receipt to the user · `frontend/src/components/Receipt.jsx`
- [Shutdown](https://github.com/shashwat230710/rift-mart/blob/main/frontend/src/components/Shutdown.jsx): UI stage · Ends the session with a terminal shutdown sequence · `frontend/src/components/Shutdown.jsx`

### Payment

Python service for wallet state and receipts

- [API layer](https://github.com/shashwat230710/rift-mart/blob/main/payment/api.py): Python API · HTTP interface for wallet and transaction operations · `payment/api.py`
- [Wallet logic](https://github.com/shashwat230710/rift-mart/blob/main/payment/wallet.py): state service · Manages balances and account-like payment state · `payment/wallet.py`
- [Receipt builder](https://github.com/shashwat230710/rift-mart/blob/main/payment/receipt_generator.py): artifact service · Creates receipt text artifacts from completed transactions · `payment/receipt_generator.py`
- [Local storage](https://github.com/shashwat230710/rift-mart/blob/main/payment/wallet.json): file state · JSON-backed persistence for wallet and transaction history · `payment/wallet.json`
- [Receipts files](https://github.com/shashwat230710/rift-mart/tree/main/payment/receipts): output store · Generated receipt text files saved on disk · `payment/receipts`

### Planned

Empty placeholders for future services

- [Backend](https://github.com/shashwat230710/rift-mart/tree/main/backend): empty placeholder · Present but not implemented in this snapshot · `backend`
- [Agent](https://github.com/shashwat230710/rift-mart/tree/main/agent): empty placeholder · Present but not implemented in this snapshot · `agent`

## Connections

- App boot → Boot screen: starts · App entry begins the booted experience
- Boot screen → ASCII logo: shows · Boot sequence renders branding
- ASCII logo → Conversation: advances to · After boot, the user enters the guided flow
- Conversation → Terminal: logs into · Conversation feeds terminal-style session output
- Terminal → Shop agent: drives · Session state presents autonomous shopping progress
- Shop agent → Payment handoff: handoff · Shopping completion leads into checkout
- Payment handoff → API layer: calls · Frontend hands payment operations to the Python service
- API layer → Wallet logic: uses · API delegates balance and transaction logic
- Wallet logic → Local storage: persists · Wallet data is stored in JSON files
- API layer → Receipt builder: generates · Completed transactions are turned into receipt artifacts
- Receipt builder → Receipts files: writes · Receipts are saved as text files on disk
- Receipt builder → Receipt view: returns · Receipt output is surfaced back in the UI
- Receipt view → Shutdown: ends · The displayed receipt closes the session
- App boot → Backend: no implementation · General backend service is currently absent
- App boot → Agent: no implementation · Standalone agent service is currently absent
