# eikkar/oreshop architecture

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

- Interactive diagram: https://gitdiagram.com/eikkar/oreshop
- Repository: https://github.com/eikkar/oreshop

## Overview

OREshop is a small online shop with a React storefront and an Express/MySQL service. Shoppers browse and search products, add items to a shared cart, and submit an order; the interface also provides account access and order history. The server handles catalog and order requests, sessions, and database operations. The sampled code confirms catalog and checkout requests, but not the wiring for every account or history screen, so those links are omitted rather than inferred.

Main entry points: [`oreshop/src/jsx/Valikko.jsx`](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Valikko.jsx) (Page navigation), [`oreshop/src/jsx/Authcontext.jsx`](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Authcontext.jsx) (Session UI state), [`oreshop/src/jsx/Tuotteet.jsx`](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Tuotteet.jsx) (Product catalog), [`oreshop/src/jsx/tilaus.jsx`](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/tilaus.jsx) (Checkout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_entry["React entry<br/>[main.jsx]"]
  node_app["App shell<br/>[App.jsx]"]
  node_navigation["Page navigation<br/>[Valikko.jsx]"]
end

subgraph group_commerce["Shopping"]
  node_catalog["Product catalog<br/>[Tuotteet.jsx]"]
  node_search["Product search<br/>[Searchbar.jsx]"]
  node_product_detail["Product details<br/>[Tuotesivu.jsx]"]
  node_cart["Shopping cart<br/>[Ostoskori.jsx]"]
  node_checkout["Checkout<br/>[tilaus.jsx]"]
  node_confirmation["Order confirmation<br/>[Congrats.jsx]"]
  node_history["Order history<br/>[Tilaushistoria.jsx]"]
  node_helpers["Shop helpers<br/>[apuFunktiot.js]"]
end

subgraph group_accounts["Accounts"]
  node_auth_state["Session UI state<br/>[Authcontext.jsx]"]
  node_auth_screen["Account screen<br/>[kirjautuminen.jsx]"]
  node_login["Login form<br/>[login.jsx]"]
  node_register["Registration form<br/>[register.jsx]"]
  node_signout["Sign-out control<br/>[signout.jsx]"]
end

subgraph group_service["Shop service"]
  node_api["HTTP service<br/>[palvelin.js]"]
  node_login_guard["Login guard<br/>[kirjasto.js]"]
end

subgraph group_data["Persistence"]
  node_mysql[("MySQL database")]
end

node_shopper(("Shopper"))

node_shopper -->|"opens storefront"| node_entry
node_entry -->|"renders"| node_app
node_app -->|"provides state"| node_auth_state
node_app -->|"renders"| node_navigation
node_navigation -->|"routes to"| node_catalog
node_navigation -->|"routes to"| node_cart
node_navigation -->|"routes to"| node_checkout
node_navigation -->|"routes to"| node_confirmation
node_navigation -->|"routes to"| node_history
node_navigation -->|"routes to"| node_auth_screen
node_catalog -->|"renders"| node_search
node_catalog -->|"shows selection"| node_product_detail
node_cart -->|"reads and updates"| node_auth_state
node_checkout -->|"reads and updates"| node_auth_state
node_checkout -->|"calculates total"| node_helpers
node_history -->|"uses formatting"| node_helpers
node_auth_screen -->|"uses state"| node_auth_state
node_login -->|"uses state"| node_auth_state
node_register -->|"uses state"| node_auth_state
node_signout -->|"uses state"| node_auth_state
node_catalog -->|"fetches catalog"| node_api
node_checkout -->|"submits order"| node_api
node_api -->|"checks login"| node_login_guard
node_api -->|"queries and writes"| node_mysql

click node_entry "https://github.com/eikkar/oreshop/blob/main/oreshop/src/main.jsx"
click node_app "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/App.jsx"
click node_navigation "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Valikko.jsx"
click node_catalog "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Tuotteet.jsx"
click node_search "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Searchbar.jsx"
click node_product_detail "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Tuotesivu.jsx"
click node_cart "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Ostoskori.jsx"
click node_checkout "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/tilaus.jsx"
click node_confirmation "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Congrats.jsx"
click node_history "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Tilaushistoria.jsx"
click node_helpers "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/apuFunktiot.js"
click node_auth_state "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Authcontext.jsx"
click node_auth_screen "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/kirjautuminen.jsx"
click node_login "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/login.jsx"
click node_register "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/register.jsx"
click node_signout "https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/signout.jsx"
click node_api "https://github.com/eikkar/oreshop/blob/main/datapalvelin/palvelin.js"
click node_login_guard "https://github.com/eikkar/oreshop/blob/main/datapalvelin/kirjasto.js"

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_entry,node_app,node_navigation toneBlue
class node_catalog,node_search,node_product_detail,node_cart,node_checkout,node_confirmation,node_history,node_helpers toneAmber
class node_auth_state,node_auth_screen,node_login,node_register,node_signout toneMint
class node_api,node_login_guard toneRose
class node_mysql,node_shopper toneIndigo
```

## Components

### Storefront

- [React entry](https://github.com/eikkar/oreshop/blob/main/oreshop/src/main.jsx): `oreshop/src/main.jsx`
- [App shell](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/App.jsx): `oreshop/src/jsx/App.jsx`
- [Page navigation](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Valikko.jsx): `oreshop/src/jsx/Valikko.jsx`

### Shopping

- [Product catalog](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Tuotteet.jsx): `oreshop/src/jsx/Tuotteet.jsx`
- [Product search](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Searchbar.jsx): `oreshop/src/jsx/Searchbar.jsx`
- [Product details](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Tuotesivu.jsx): `oreshop/src/jsx/Tuotesivu.jsx`
- [Shopping cart](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Ostoskori.jsx): `oreshop/src/jsx/Ostoskori.jsx`
- [Checkout](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/tilaus.jsx): `oreshop/src/jsx/tilaus.jsx`
- [Order confirmation](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Congrats.jsx): `oreshop/src/jsx/Congrats.jsx`
- [Order history](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Tilaushistoria.jsx): `oreshop/src/jsx/Tilaushistoria.jsx`
- [Shop helpers](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/apuFunktiot.js): `oreshop/src/jsx/apuFunktiot.js`

### Accounts

- [Session UI state](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/Authcontext.jsx): `oreshop/src/jsx/Authcontext.jsx`
- [Account screen](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/kirjautuminen.jsx): `oreshop/src/jsx/kirjautuminen.jsx`
- [Login form](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/login.jsx): `oreshop/src/jsx/login.jsx`
- [Registration form](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/register.jsx): `oreshop/src/jsx/register.jsx`
- [Sign-out control](https://github.com/eikkar/oreshop/blob/main/oreshop/src/jsx/signout.jsx): `oreshop/src/jsx/signout.jsx`

### Shop service

- [HTTP service](https://github.com/eikkar/oreshop/blob/main/datapalvelin/palvelin.js): `datapalvelin/palvelin.js`
- [Login guard](https://github.com/eikkar/oreshop/blob/main/datapalvelin/kirjasto.js): `datapalvelin/kirjasto.js`

### Persistence

- **MySQL database**

### Other components

- **Shopper**

## Connections

- Shopper → React entry: opens storefront (evidence: `oreshop/src/main.jsx`)
- React entry → App shell: renders (evidence: `oreshop/src/main.jsx`)
- App shell → Session UI state: provides state (evidence: `oreshop/src/jsx/App.jsx`)
- App shell → Page navigation: renders (evidence: `oreshop/src/jsx/App.jsx`)
- Page navigation → Product catalog: routes to (evidence: `oreshop/src/jsx/Valikko.jsx`)
- Page navigation → Shopping cart: routes to (evidence: `oreshop/src/jsx/Valikko.jsx`)
- Page navigation → Checkout: routes to (evidence: `oreshop/src/jsx/Valikko.jsx`)
- Page navigation → Order confirmation: routes to (evidence: `oreshop/src/jsx/Valikko.jsx`)
- Page navigation → Order history: routes to (evidence: `oreshop/src/jsx/Valikko.jsx`)
- Page navigation → Account screen: routes to (evidence: `oreshop/src/jsx/Valikko.jsx`)
- Product catalog → Product search: renders (evidence: `oreshop/src/jsx/Tuotteet.jsx`)
- Product catalog → Product details: shows selection (evidence: `oreshop/src/jsx/Tuotteet.jsx`)
- Shopping cart → Session UI state: reads and updates (evidence: `oreshop/src/jsx/Ostoskori.jsx`)
- Checkout → Session UI state: reads and updates (evidence: `oreshop/src/jsx/tilaus.jsx`)
- Checkout → Shop helpers: calculates total (evidence: `oreshop/src/jsx/tilaus.jsx`)
- Order history → Shop helpers: uses formatting (evidence: `oreshop/src/jsx/Tilaushistoria.jsx`)
- Account screen → Session UI state: uses state (evidence: `oreshop/src/jsx/kirjautuminen.jsx`)
- Login form → Session UI state: uses state (evidence: `oreshop/src/jsx/login.jsx`)
- Registration form → Session UI state: uses state (evidence: `oreshop/src/jsx/register.jsx`)
- Sign-out control → Session UI state: uses state (evidence: `oreshop/src/jsx/signout.jsx`)
- Product catalog → HTTP service: fetches catalog (evidence: `oreshop/src/jsx/Tuotteet.jsx`)
- Checkout → HTTP service: submits order (evidence: `oreshop/src/jsx/tilaus.jsx`)
- HTTP service → Login guard: checks login (evidence: `datapalvelin/palvelin.js`)
- HTTP service → MySQL database: queries and writes (evidence: `datapalvelin/palvelin.js`)
