# ski043/shoemarshal architecture

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

- Interactive diagram: https://gitdiagram.com/ski043/shoemarshal
- Repository: https://github.com/ski043/shoemarshal

## Overview

#### Purpose and Runtime
This is a full-stack Next.js App Router e-commerce application with a public shoe storefront and authenticated administrative dashboard. It runs as a React/TypeScript server-rendered application, with route handlers for third-party callbacks and webhooks. Root composition and global styling begin at `app/layout.tsx` and `app/globals.css`.

#### Route Domains and Entry Points
The storefront is isolated in a route group, so it shares commerce layout/navigation without changing public URLs. Primary customer entry points are the landing page, catalog/category views, product detail, bag, and payment outcomes:
- `app/(storefront)/page.tsx`
- `app/(storefront)/product/[id]/page.tsx`
- `app/(storefront)/bag/page.tsx`

The management area is rooted at `app/dashboard/layout.tsx`, with dashboard overview, product management, banner management, and order views:
- `app/dashboard/page.tsx`
- `app/dashboard/products/page.tsx`
- `app/dashboard/orders/page.tsx`

#### Storefront Commerce Flow
Storefront pages render product discovery and presentation through composed storefront components, including category selection, featured products, product cards, image galleries, and account navigation:
- `app/components/storefront/FeaturedProducts.tsx`
- `app/components/storefront/ProductCard.tsx`
- `app/components/storefront/Navbar.tsx`

A customer navigates catalog/category pages to a dynamic product (`product/[id]`), adds items to the bag, then proceeds into Stripe-backed payment. Dedicated success and cancellation routes provide post-checkout return states:
- `app/(storefront)/payment/success/page.tsx`
- `app/(storefront)/payment/cancel/page.tsx`
- `app/api/stripe/route.ts`

#### Identity, Cart, and Checkout Boundaries
Kinde supplies authentication, including its catch-all authentication handler; a separate creation endpoint likely provisions application-side user state after identity events:
- `app/api/auth/[kindeAuth]/route.ts`
- `app/api/auth/creation/route.ts`

Cart state is backed by Upstash Redis rather than the relational database, separating transient/session-oriented shopping state from durable commerce records. Stripe is encapsulated behind a local client module and API route, with Stripe webhooks serving as the payment-system boundary:
- `app/lib/redis.ts`
- `app/lib/stripe.ts`
- `app/api/stripe/route.ts`

#### Durable Data and Business Mutations
Prisma defines the durable domain model and connects the app to Neon/Postgres. Server-side mutations are centralized in `app/actions.ts`, providing the likely boundary for validated product, banner, cart, or checkout-related operations. Zod schemas formalize server validation:
- `prisma/schema.prisma`
- `app/lib/db.ts`
- `app/actions.ts`

Dashboard create/edit/delete routes drive administration of products and banners, while order data feeds operational views:
- `app/dashboard/products/create/page.tsx`
- `app/dashboard/products/[id]/page.tsx`
- `app/dashboard/banner/[id]/delete/page.tsx`

#### Media and Presentation Infrastructure
Product and promotional media upload through UploadThing route/core integration; persisted uploads are then consumed by dashboard forms and storefront renderers. Static sample shoe imagery remains in `public/`:
- `app/api/uploadthing/core.ts`
- `app/api/uploadthing/route.ts`
- `app/components/dashboard/EditForm.tsx`

The dashboard includes reporting-oriented widgets, notably charting and recent-sales views, while shared Shadcn-style primitives provide the UI layer:
- `app/components/dashboard/Chart.tsx`
- `app/components/dashboard/DashboardStats.tsx`
- `components/ui`

#### Deployment Dependencies
Material external services are Kinde (identity), Neon/Postgres via Prisma (durable records), Upstash Redis (cart), Stripe (Checkout and webhook events), and UploadThing (media). The project is configured as a Next.js deployment, intended for Vercel, with Tailwind styling and static public assets.

Main entry points: [`app/actions.ts`](https://github.com/ski043/shoemarshal/blob/main/app/actions.ts) (Server actions), [`app/(storefront)/page.tsx`](https://github.com/ski043/shoemarshal/blob/main/app/(storefront)/page.tsx) (Storefront routes), [`app/dashboard/page.tsx`](https://github.com/ski043/shoemarshal/blob/main/app/dashboard/page.tsx) (Dashboard views), [`app/dashboard/products/create/page.tsx`](https://github.com/ski043/shoemarshal/blob/main/app/dashboard/products/create/page.tsx) (Product & banner editing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_storefront_routes["Storefront routes<br/>App Router pages<br/>[page.tsx]"]
  node_product_detail["Product detail<br/>dynamic page<br/>[page.tsx]"]
  node_bag["Bag<br/>commerce page<br/>[page.tsx]"]
  node_storefront_ui["Storefront components<br/>React UI"]
  node_payment_returns["Payment return states<br/>App Router pages<br/>[page.tsx]"]
end

subgraph group_admin["Administration"]
  node_dashboard_layout["Dashboard shell<br/>App Router layout<br/>[layout.tsx]"]
  node_dashboard_views["Dashboard views<br/>admin pages<br/>[page.tsx]"]
  node_admin_mutation_routes["Product &amp; banner editing<br/>admin pages<br/>[page.tsx]"]
  node_reporting_widgets["Reporting widgets<br/>React UI<br/>[Chart.tsx]"]
end

subgraph group_application["Application Core"]
  node_root["Root layout &amp; styles<br/>Next.js composition<br/>[layout.tsx]"]
  node_actions{{"Server actions<br/>mutation boundary<br/>[actions.ts]"}}
  node_auth_routes["Kinde auth handlers<br/>route handlers<br/>[route.ts]"]
  node_stripe_route{{"Stripe checkout &amp; webhook<br/>route handler<br/>[route.ts]"}}
  node_upload_routes["UploadThing integration<br/>route handlers<br/>[route.ts]"]
end

subgraph group_data["Data &amp; Providers"]
  node_prisma["Prisma domain model<br/>ORM schema<br/>[schema.prisma]"]
  node_postgres[("Neon Postgres<br/>durable database")]
  node_redis[("Upstash Redis<br/>cart store")]
  node_stripe{{"Stripe<br/>payment provider"}}
  node_kinde{{"Kinde<br/>identity provider"}}
  node_uploadthing{{"UploadThing<br/>media provider"}}
end

node_root -->|"composes"| node_storefront_routes
node_root -->|"composes"| node_dashboard_layout
node_storefront_routes -->|"renders"| node_storefront_ui
node_storefront_routes -->|"navigates to"| node_product_detail
node_product_detail -->|"adds items to"| node_bag
node_bag -->|"starts checkout"| node_stripe_route
node_stripe_route -->|"returns customer"| node_payment_returns
node_storefront_routes -->|"reads and mutates"| node_actions
node_dashboard_layout -->|"hosts"| node_dashboard_views
node_dashboard_views -->|"renders"| node_reporting_widgets
node_dashboard_views -->|"manages"| node_admin_mutation_routes
node_admin_mutation_routes -->|"invokes"| node_actions
node_actions -->|"uses"| node_prisma
node_prisma -->|"persists to"| node_postgres
node_actions -->|"updates cart"| node_redis
node_stripe_route -->|"creates sessions / receives events"| node_stripe
node_auth_routes -->|"handles identity events"| node_kinde
node_auth_routes -.->|"provisions app user"| node_actions
node_upload_routes -->|"uploads media"| node_uploadthing
node_admin_mutation_routes -->|"submits media"| node_upload_routes
node_actions -.->|"stores commerce records"| node_postgres

click node_root "https://github.com/ski043/shoemarshal/blob/main/app/layout.tsx"
click node_storefront_routes "https://github.com/ski043/shoemarshal/blob/main/app/(storefront)/page.tsx"
click node_product_detail "https://github.com/ski043/shoemarshal/blob/main/app/(storefront)/product/%5Bid%5D/page.tsx"
click node_bag "https://github.com/ski043/shoemarshal/blob/main/app/(storefront)/bag/page.tsx"
click node_storefront_ui "https://github.com/ski043/shoemarshal/blob/main/app/components/storefront/FeaturedProducts.tsx"
click node_payment_returns "https://github.com/ski043/shoemarshal/blob/main/app/(storefront)/payment/success/page.tsx"
click node_dashboard_layout "https://github.com/ski043/shoemarshal/blob/main/app/dashboard/layout.tsx"
click node_dashboard_views "https://github.com/ski043/shoemarshal/blob/main/app/dashboard/page.tsx"
click node_admin_mutation_routes "https://github.com/ski043/shoemarshal/blob/main/app/dashboard/products/create/page.tsx"
click node_reporting_widgets "https://github.com/ski043/shoemarshal/blob/main/app/components/dashboard/Chart.tsx"
click node_actions "https://github.com/ski043/shoemarshal/blob/main/app/actions.ts"
click node_auth_routes "https://github.com/ski043/shoemarshal/blob/main/app/api/auth/%5BkindeAuth%5D/route.ts"
click node_stripe_route "https://github.com/ski043/shoemarshal/blob/main/app/api/stripe/route.ts"
click node_upload_routes "https://github.com/ski043/shoemarshal/blob/main/app/api/uploadthing/route.ts"
click node_prisma "https://github.com/ski043/shoemarshal/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_storefront_routes,node_product_detail,node_bag,node_storefront_ui,node_payment_returns toneBlue
class node_dashboard_layout,node_dashboard_views,node_admin_mutation_routes,node_reporting_widgets toneAmber
class node_root,node_actions,node_auth_routes,node_stripe_route,node_upload_routes toneMint
class node_prisma,node_postgres,node_redis,node_stripe,node_kinde,node_uploadthing toneRose
```

## Components

### Storefront

Public commerce routes and UI.

- [Storefront routes](https://github.com/ski043/shoemarshal/blob/main/app/(storefront)/page.tsx): App Router pages · Landing, product detail, and bag entry points. · `app/(storefront)/page.tsx`
- [Product detail](https://github.com/ski043/shoemarshal/blob/main/app/(storefront)/product/%5Bid%5D/page.tsx): dynamic page · `app/(storefront)/product/[id]/page.tsx`
- [Bag](https://github.com/ski043/shoemarshal/blob/main/app/(storefront)/bag/page.tsx): commerce page · `app/(storefront)/bag/page.tsx`
- [Storefront components](https://github.com/ski043/shoemarshal/blob/main/app/components/storefront/FeaturedProducts.tsx): React UI · Navigation, featured products, and product cards. · `app/components/storefront/FeaturedProducts.tsx`
- [Payment return states](https://github.com/ski043/shoemarshal/blob/main/app/(storefront)/payment/success/page.tsx): App Router pages · Checkout success and cancellation outcomes. · `app/(storefront)/payment/success/page.tsx`

### Administration

Authenticated management and reporting.

- [Dashboard shell](https://github.com/ski043/shoemarshal/blob/main/app/dashboard/layout.tsx): App Router layout · `app/dashboard/layout.tsx`
- [Dashboard views](https://github.com/ski043/shoemarshal/blob/main/app/dashboard/page.tsx): admin pages · Overview, products, and orders. · `app/dashboard/page.tsx`
- [Product & banner editing](https://github.com/ski043/shoemarshal/blob/main/app/dashboard/products/create/page.tsx): admin pages · Create, edit, and delete management routes. · `app/dashboard/products/create/page.tsx`
- [Reporting widgets](https://github.com/ski043/shoemarshal/blob/main/app/components/dashboard/Chart.tsx): React UI · Charts and sales summaries. · `app/components/dashboard/Chart.tsx`

### Application Core

Server mutations and integration boundaries.

- [Root layout & styles](https://github.com/ski043/shoemarshal/blob/main/app/layout.tsx): Next.js composition · `app/layout.tsx`
- [Server actions](https://github.com/ski043/shoemarshal/blob/main/app/actions.ts): mutation boundary · Centralized validated commerce and administration mutations. · `app/actions.ts`
- [Kinde auth handlers](https://github.com/ski043/shoemarshal/blob/main/app/api/auth/%5BkindeAuth%5D/route.ts): route handlers · Authentication callback and user provisioning endpoints. · `app/api/auth/[kindeAuth]/route.ts`
- [Stripe checkout & webhook](https://github.com/ski043/shoemarshal/blob/main/app/api/stripe/route.ts): route handler · Local payment boundary for checkout and Stripe events. · `app/api/stripe/route.ts`
- [UploadThing integration](https://github.com/ski043/shoemarshal/blob/main/app/api/uploadthing/route.ts): route handlers · Media upload route and core configuration. · `app/api/uploadthing/route.ts`

### Data & Providers

Durable, session, and third-party services.

- [Prisma domain model](https://github.com/ski043/shoemarshal/blob/main/prisma/schema.prisma): ORM schema · `prisma/schema.prisma`
- **Neon Postgres**: durable database
- **Upstash Redis**: cart store · Session-oriented cart state.
- **Stripe**: payment provider · Checkout sessions and webhook events.
- **Kinde**: identity provider
- **UploadThing**: media provider

## Connections

- Root layout & styles → Storefront routes: composes
- Root layout & styles → Dashboard shell: composes
- Storefront routes → Storefront components: renders
- Storefront routes → Product detail: navigates to
- Product detail → Bag: adds items to
- Bag → Stripe checkout & webhook: starts checkout
- Stripe checkout & webhook → Payment return states: returns customer
- Storefront routes → Server actions: reads and mutates
- Dashboard shell → Dashboard views: hosts
- Dashboard views → Reporting widgets: renders
- Dashboard views → Product & banner editing: manages
- Product & banner editing → Server actions: invokes
- Server actions → Prisma domain model: uses
- Prisma domain model → Neon Postgres: persists to
- Server actions → Upstash Redis: updates cart
- Stripe checkout & webhook → Stripe: creates sessions / receives events
- Kinde auth handlers → Kinde: handles identity events
- Kinde auth handlers → Server actions: provisions app user
- UploadThing integration → UploadThing: uploads media
- Product & banner editing → UploadThing integration: submits media
- Server actions → Neon Postgres: stores commerce records
