# keviniciodev/e-commerce architecture

> Architecture diagram of the GitHub repository keviniciodev/e-commerce, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/keviniciodev/e-commerce
- Repository: https://github.com/keviniciodev/e-commerce

## Overview

This is a Next.js T-shirt storefront with a product catalog and an admin product-creation workflow. The catalog page requests products through a Server Action, which delegates retrieval to the product service and database. Admin users submit a form through a Server Action; the service validates and adapts product data before inserting it. The graph also shows the shared navigation and theme capability. Relationships are limited to calls and rendering/import references visible in excerpts, the source index, or README; unsampled features are not inferred.

Main entry points: [`src/features/products/services/ProductService.ts`](https://github.com/keviniciodev/e-commerce/blob/main/src/features/products/services/ProductService.ts) (Product service), [`src/features/products/actions/product-actions.ts`](https://github.com/keviniciodev/e-commerce/blob/main/src/features/products/actions/product-actions.ts) (Product actions), [`app/page.tsx`](https://github.com/keviniciodev/e-commerce/blob/main/app/page.tsx) (Product catalog), [`app/admin/products/new/page.tsx`](https://github.com/keviniciodev/e-commerce/blob/main/app/admin/products/new/page.tsx) (New product page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront UI"]
  node_catalog["Product catalog<br/>[page.tsx]"]
  node_admin_page["New product page<br/>[page.tsx]"]
  node_navbar["Navigation<br/>[Navbar.tsx]"]
  node_theme_toggle["Theme toggle<br/>[ThemeToggle.tsx]"]
  node_theme_provider["Theme provider<br/>[theme-provider.tsx]"]
end

subgraph group_product["Product Domain"]
  node_product_form["Product form<br/>[ProductForm.tsx]"]
  node_actions["Product actions<br/>[product-actions.ts]"]
  node_schema["Product validation<br/>[productSchema.ts]"]
  node_service["Product service<br/>[ProductService.ts]"]
end

subgraph group_persistence["Persistence"]
  node_db_client["Database client<br/>[index.ts]"]
  node_product_table[("Products table<br/>[products.ts]")]
end

node_visitor(("Store visitor"))
node_admin(("Admin user"))
node_postgres[("PostgreSQL")]

node_visitor -->|"views"| node_catalog
node_catalog -->|"loads via"| node_actions
node_admin -.->|"opens"| node_admin_page
node_admin_page -->|"renders"| node_product_form
node_product_form -->|"submits to"| node_actions
node_actions -->|"calls"| node_service
node_service -->|"validates with"| node_schema
node_service -->|"queries"| node_db_client
node_service -->|"reads and writes"| node_product_table
node_db_client -->|"connects to"| node_postgres
node_visitor -.->|"uses"| node_navbar
node_navbar -->|"renders"| node_theme_toggle
node_theme_provider -.->|"provides theme"| node_theme_toggle

click node_catalog "https://github.com/keviniciodev/e-commerce/blob/main/app/page.tsx"
click node_admin_page "https://github.com/keviniciodev/e-commerce/blob/main/app/admin/products/new/page.tsx"
click node_navbar "https://github.com/keviniciodev/e-commerce/blob/main/src/shared/components/Navbar.tsx"
click node_theme_toggle "https://github.com/keviniciodev/e-commerce/blob/main/src/shared/components/ThemeToggle.tsx"
click node_theme_provider "https://github.com/keviniciodev/e-commerce/blob/main/src/shared/providers/theme-provider.tsx"
click node_product_form "https://github.com/keviniciodev/e-commerce/blob/main/src/features/products/components/ProductForm.tsx"
click node_actions "https://github.com/keviniciodev/e-commerce/blob/main/src/features/products/actions/product-actions.ts"
click node_schema "https://github.com/keviniciodev/e-commerce/blob/main/src/features/products/schemas/productSchema.ts"
click node_service "https://github.com/keviniciodev/e-commerce/blob/main/src/features/products/services/ProductService.ts"
click node_db_client "https://github.com/keviniciodev/e-commerce/blob/main/src/db/index.ts"
click node_product_table "https://github.com/keviniciodev/e-commerce/blob/main/src/db/schema/products.ts"

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_catalog,node_admin_page,node_navbar,node_theme_toggle,node_theme_provider,node_admin toneBlue
class node_product_form,node_actions,node_schema,node_service,node_postgres toneAmber
class node_db_client,node_product_table toneMint
class node_visitor toneIndigo
```

## Components

### Storefront UI

- [Product catalog](https://github.com/keviniciodev/e-commerce/blob/main/app/page.tsx): `app/page.tsx`
- [New product page](https://github.com/keviniciodev/e-commerce/blob/main/app/admin/products/new/page.tsx): `app/admin/products/new/page.tsx`
- [Navigation](https://github.com/keviniciodev/e-commerce/blob/main/src/shared/components/Navbar.tsx): `src/shared/components/Navbar.tsx`
- [Theme toggle](https://github.com/keviniciodev/e-commerce/blob/main/src/shared/components/ThemeToggle.tsx): `src/shared/components/ThemeToggle.tsx`
- [Theme provider](https://github.com/keviniciodev/e-commerce/blob/main/src/shared/providers/theme-provider.tsx): `src/shared/providers/theme-provider.tsx`

### Product Domain

- [Product form](https://github.com/keviniciodev/e-commerce/blob/main/src/features/products/components/ProductForm.tsx): `src/features/products/components/ProductForm.tsx`
- [Product actions](https://github.com/keviniciodev/e-commerce/blob/main/src/features/products/actions/product-actions.ts): `src/features/products/actions/product-actions.ts`
- [Product validation](https://github.com/keviniciodev/e-commerce/blob/main/src/features/products/schemas/productSchema.ts): `src/features/products/schemas/productSchema.ts`
- [Product service](https://github.com/keviniciodev/e-commerce/blob/main/src/features/products/services/ProductService.ts): `src/features/products/services/ProductService.ts`

### Persistence

- [Database client](https://github.com/keviniciodev/e-commerce/blob/main/src/db/index.ts): `src/db/index.ts`
- [Products table](https://github.com/keviniciodev/e-commerce/blob/main/src/db/schema/products.ts): `src/db/schema/products.ts`

### Other components

- **Store visitor**
- **Admin user**
- **PostgreSQL**

## Connections

- Store visitor → Product catalog: views (evidence: `app/page.tsx`)
- Product catalog → Product actions: loads via (evidence: `app/page.tsx`)
- Admin user → New product page: opens
- New product page → Product form: renders (evidence: `app/admin/products/new/page.tsx`)
- Product form → Product actions: submits to (evidence: `src/features/products/components/ProductForm.tsx`)
- Product actions → Product service: calls (evidence: `src/features/products/actions/product-actions.ts`)
- Product service → Product validation: validates with (evidence: `src/features/products/services/ProductService.ts`)
- Product service → Database client: queries (evidence: `src/features/products/services/ProductService.ts`)
- Product service → Products table: reads and writes (evidence: `src/features/products/services/ProductService.ts`)
- Database client → PostgreSQL: connects to (evidence: `src/db/index.ts`)
- Store visitor → Navigation: uses
- Navigation → Theme toggle: renders (evidence: `src/shared/components/Navbar.tsx`)
- Theme provider → Theme toggle: provides theme
