# alimangoes/invoice-tab-shopify architecture

> Architecture diagram of the GitHub repository alimangoes/invoice-tab-shopify, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alimangoes/invoice-tab-shopify
- Repository: https://github.com/alimangoes/invoice-tab-shopify

## Overview

This is a Shopify embedded app template with invoice-related routes and an invoices-tab extension. The user-facing path begins with shop login, continues into the authenticated embedded app, and exposes invoice functionality alongside a product/metafield/metaobject demonstration. Shopify authentication and webhook handling share Prisma-backed session storage. The API route and extension are represented as distinct invoice components; the available excerpts do not establish a connection between them.

Main entry points: [`app/shopify.server.ts`](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/shopify.server.ts) (Shopify app setup), [`app/db.server.ts`](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/db.server.ts) (Prisma client), [`app/routes/_index/route.tsx`](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/_index/route.tsx) (Landing and routing), [`app/routes/auth.login/route.tsx`](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/auth.login/route.tsx) (Shop login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and embedded app"]
  node_landing["Landing and routing<br/>[route.tsx]"]
  node_login["Shop login<br/>[route.tsx]"]
  node_login_errors["Login errors<br/>[error.server.tsx]"]
  node_embedded_shell["Embedded app shell<br/>[app.tsx]"]
  node_auth_catchall["Admin auth route<br/>[auth.$.tsx]"]
end

subgraph group_features["App features"]
  node_home["Product and custom data demo<br/>[app._index.tsx]"]
  node_additional["Additional app page<br/>[app.additional.tsx]"]
end

subgraph group_invoices["Invoice experience"]
  node_invoices_api["Invoices API<br/>[api.invoices.tsx]"]
  node_invoice_tab["Invoices tab extension<br/>[Invoices.jsx]"]
end

subgraph group_platform["Shopify platform and state"]
  node_webhook_scopes["Scope update webhook"]
  node_webhook_uninstall["Uninstall webhook"]
  node_shopify_setup["Shopify app setup<br/>[shopify.server.ts]"]
  node_prisma_client["Prisma client<br/>[db.server.ts]"]
  node_session_store[("Session database<br/>[schema.prisma]")]
end

node_shop_admin(("Shop admin"))
node_shopify{{"Shopify platform"}}

node_shop_admin -->|"opens app"| node_landing
node_landing -->|"submits login"| node_login
node_landing -->|"redirects shop"| node_embedded_shell
node_login -->|"calls login"| node_shopify_setup
node_login -->|"formats errors"| node_login_errors
node_embedded_shell -->|"authenticates admin"| node_shopify_setup
node_auth_catchall -->|"authenticates admin"| node_shopify_setup
node_home -->|"authenticates admin"| node_shopify_setup
node_home -->|"queries products and custom data"| node_shopify
node_invoices_api -->|"uses Shopify integration"| node_shopify_setup
node_webhook_scopes -->|"authenticates webhook"| node_shopify_setup
node_webhook_scopes -->|"updates session"| node_prisma_client
node_webhook_uninstall -->|"authenticates webhook"| node_shopify_setup
node_webhook_uninstall -->|"deletes sessions"| node_prisma_client
node_shopify_setup -->|"configures session storage"| node_prisma_client
node_prisma_client -.->|"persists sessions"| node_session_store
node_shopify_setup -->|"configures app integration"| node_shopify

click node_landing "https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/_index/route.tsx"
click node_login "https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/auth.login/route.tsx"
click node_login_errors "https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/auth.login/error.server.tsx"
click node_embedded_shell "https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/app.tsx"
click node_auth_catchall "https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/auth.%24.tsx"
click node_home "https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/app._index.tsx"
click node_additional "https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/app.additional.tsx"
click node_invoices_api "https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/api.invoices.tsx"
click node_invoice_tab "https://github.com/alimangoes/invoice-tab-shopify/blob/main/extensions/invoices-tab/src/Invoices.jsx"
click node_webhook_scopes "https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/webhooks.app.scopes_update.tsx"
click node_webhook_uninstall "https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/webhooks.app.uninstalled.tsx"
click node_shopify_setup "https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/shopify.server.ts"
click node_prisma_client "https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/db.server.ts"
click node_session_store "https://github.com/alimangoes/invoice-tab-shopify/blob/main/prisma/schema.prisma"

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_landing,node_login,node_login_errors,node_embedded_shell,node_auth_catchall toneBlue
class node_home,node_additional toneAmber
class node_invoices_api,node_invoice_tab toneMint
class node_webhook_scopes,node_webhook_uninstall,node_shopify_setup,node_prisma_client,node_session_store toneRose
class node_shop_admin,node_shopify toneIndigo
```

## Components

### Access and embedded app

- [Landing and routing](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/_index/route.tsx): `app/routes/_index/route.tsx`
- [Shop login](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/auth.login/route.tsx): `app/routes/auth.login/route.tsx`
- [Login errors](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/auth.login/error.server.tsx): `app/routes/auth.login/error.server.tsx`
- [Embedded app shell](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/app.tsx): `app/routes/app.tsx`
- [Admin auth route](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/auth.%24.tsx): `app/routes/auth.$.tsx`

### App features

- [Product and custom data demo](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/app._index.tsx): `app/routes/app._index.tsx`
- [Additional app page](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/app.additional.tsx): `app/routes/app.additional.tsx`

### Invoice experience

- [Invoices API](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/api.invoices.tsx): `app/routes/api.invoices.tsx`
- [Invoices tab extension](https://github.com/alimangoes/invoice-tab-shopify/blob/main/extensions/invoices-tab/src/Invoices.jsx): `extensions/invoices-tab/src/Invoices.jsx`

### Shopify platform and state

- [Scope update webhook](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/webhooks.app.scopes_update.tsx): `app/routes/webhooks.app.scopes_update.tsx`
- [Uninstall webhook](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/routes/webhooks.app.uninstalled.tsx): `app/routes/webhooks.app.uninstalled.tsx`
- [Shopify app setup](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/shopify.server.ts): `app/shopify.server.ts`
- [Prisma client](https://github.com/alimangoes/invoice-tab-shopify/blob/main/app/db.server.ts): `app/db.server.ts`
- [Session database](https://github.com/alimangoes/invoice-tab-shopify/blob/main/prisma/schema.prisma): `prisma/schema.prisma`

### Other components

- **Shop admin**
- **Shopify platform**

## Connections

- Shop admin → Landing and routing: opens app (evidence: `app/routes/_index/route.tsx`)
- Landing and routing → Shop login: submits login (evidence: `app/routes/_index/route.tsx`)
- Landing and routing → Embedded app shell: redirects shop (evidence: `app/routes/_index/route.tsx`)
- Shop login → Shopify app setup: calls login (evidence: `app/routes/auth.login/route.tsx`)
- Shop login → Login errors: formats errors (evidence: `app/routes/auth.login/route.tsx`)
- Embedded app shell → Shopify app setup: authenticates admin (evidence: `app/routes/app.tsx`)
- Admin auth route → Shopify app setup: authenticates admin (evidence: `app/routes/auth.$.tsx`)
- Product and custom data demo → Shopify app setup: authenticates admin (evidence: `app/routes/app._index.tsx`)
- Product and custom data demo → Shopify platform: queries products and custom data (evidence: `app/routes/app._index.tsx`)
- Invoices API → Shopify app setup: uses Shopify integration (evidence: `app/routes/api.invoices.tsx`)
- Scope update webhook → Shopify app setup: authenticates webhook (evidence: `app/routes/webhooks.app.scopes_update.tsx`)
- Scope update webhook → Prisma client: updates session (evidence: `app/routes/webhooks.app.scopes_update.tsx`)
- Uninstall webhook → Shopify app setup: authenticates webhook (evidence: `app/routes/webhooks.app.uninstalled.tsx`)
- Uninstall webhook → Prisma client: deletes sessions (evidence: `app/routes/webhooks.app.uninstalled.tsx`)
- Shopify app setup → Prisma client: configures session storage (evidence: `app/shopify.server.ts`)
- Prisma client → Session database: persists sessions
- Shopify app setup → Shopify platform: configures app integration (evidence: `app/shopify.server.ts`)
