# yago-jnp/luciene-modas architecture

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

- Interactive diagram: https://gitdiagram.com/yago-jnp/luciene-modas
- Repository: https://github.com/yago-jnp/luciene-modas

## Overview

Luciene Modas is an online storefront for the retailer’s products, with customer accounts, cart and order handling, and product-management capabilities. The principal workflow is product discovery, adding items to a cart, and submitting an order; separate branches cover account access, comments, and administration. The sampled sources show several API-to-database and authentication relationships. Many page-to-API connections and the upload integration were not shown, so they are represented without inferred wiring.

Main entry points: [`src/lib/db.js`](https://github.com/yago-jnp/luciene-modas/blob/main/src/lib/db.js) (PostgreSQL), [`src/utils/getUsuarioServerSide.js`](https://github.com/yago-jnp/luciene-modas/blob/main/src/utils/getUsuarioServerSide.js) (Session User Lookup), [`src/app/api/itens-carrinho/route.js`](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/itens-carrinho/route.js) (Cart Items API), [`src/app/api/pedidos/route.js`](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/pedidos/route.js) (Orders API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_storefront_pages["Storefront Pages<br/>[page.jsx]"]
  node_search["Product Search<br/>[page.jsx]"]
  node_product_catalog["Product Catalog API<br/>[route.js]"]
  node_product_detail["Product Details<br/>[page.jsx]"]
  node_product_cards["Product Cards<br/>[CardProduto.jsx]"]
end

subgraph group_commerce["Cart and Orders"]
  node_cart_store["Cart State<br/>[carrinho.js]"]
  node_cart_api["Cart Items API<br/>[route.js]"]
  node_cart_page["Cart Page"]
  node_checkout["Checkout<br/>[page.jsx]"]
  node_orders_api["Orders API<br/>[route.js]"]
  node_order_history["Order History<br/>[page.jsx]"]
end

subgraph group_identity["Accounts and Reviews"]
  node_login["Login<br/>[LoginForm.jsx]"]
  node_signup["Registration<br/>[SignUpForm.jsx]"]
  node_auth_api["Authentication<br/>[route.js]"]
  node_profile["Customer Profile<br/>[InfosUsuario.jsx]"]
  node_comments_api["Comments API<br/>[route.js]"]
end

subgraph group_management["Product Management"]
  node_admin_products["Product Admin<br/>[page.jsx]"]
  node_upload_api["Image Upload API<br/>[route.js]"]
end

subgraph group_data["Data and Auth"]
  node_users_api["Users API<br/>[route.js]"]
  node_session_user["Session User Lookup"]
  node_database[("PostgreSQL<br/>[db.js]")]
end

node_shopper(("Shopper"))

node_shopper -->|"browses products"| node_storefront_pages
node_shopper -->|"manages products"| node_admin_products
node_product_cards -->|"adds item"| node_cart_store
node_cart_page -->|"uses cart state"| node_cart_store
node_cart_api -->|"gets user"| node_session_user
node_cart_api -->|"queries cart and products"| node_database
node_product_catalog -->|"queries products"| node_database
node_orders_api -->|"gets user"| node_session_user
node_orders_api -->|"writes order transaction"| node_database
node_comments_api -->|"gets user"| node_session_user
node_comments_api -->|"reads and writes comments"| node_database
node_auth_api -->|"reads and creates accounts"| node_database
node_users_api -->|"reads and creates users"| node_database
node_session_user -->|"reads session config"| node_auth_api
node_session_user -->|"fetches user record"| node_users_api

click node_storefront_pages "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/page.jsx"
click node_search "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/pesquisar/page.jsx"
click node_product_catalog "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/produtos/route.js"
click node_product_detail "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/produtos/%5Bid%5D/page.jsx"
click node_product_cards "https://github.com/yago-jnp/luciene-modas/blob/main/src/components/produtos/CardProduto.jsx"
click node_cart_store "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/_store/carrinho.js"
click node_cart_api "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/itens-carrinho/route.js"
click node_cart_page "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/carrinho/_components/ClientComponent.jsx"
click node_checkout "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/checkout/page.jsx"
click node_orders_api "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/pedidos/route.js"
click node_order_history "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/meus-pedidos/page.jsx"
click node_login "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/login/_components/LoginForm.jsx"
click node_signup "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/sign-up/_components/SignUpForm.jsx"
click node_auth_api "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/auth/%5B...nextauth%5D/route.js"
click node_profile "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/perfil/_components/InfosUsuario.jsx"
click node_comments_api "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/comentarios/route.js"
click node_admin_products "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/admin/adicionar-produtos/page.jsx"
click node_upload_api "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/upload/route.js"
click node_users_api "https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/usuarios/route.js"
click node_session_user "https://github.com/yago-jnp/luciene-modas/blob/main/src/utils/getUsuarioServerSide.js"
click node_database "https://github.com/yago-jnp/luciene-modas/blob/main/src/lib/db.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_storefront_pages,node_search,node_product_catalog,node_product_detail,node_product_cards toneBlue
class node_cart_store,node_cart_api,node_cart_page,node_checkout,node_orders_api,node_order_history toneAmber
class node_login,node_signup,node_auth_api,node_profile,node_comments_api toneMint
class node_admin_products,node_upload_api toneRose
class node_users_api,node_session_user,node_database,node_shopper toneIndigo
```

## Components

### Storefront

- [Storefront Pages](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/page.jsx): `src/app/page.jsx`
- [Product Search](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/pesquisar/page.jsx): `src/app/pesquisar/page.jsx`
- [Product Catalog API](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/produtos/route.js): `src/app/api/produtos/route.js`
- [Product Details](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/produtos/%5Bid%5D/page.jsx): `src/app/produtos/[id]/page.jsx`
- [Product Cards](https://github.com/yago-jnp/luciene-modas/blob/main/src/components/produtos/CardProduto.jsx): `src/components/produtos/CardProduto.jsx`

### Cart and Orders

- [Cart State](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/_store/carrinho.js): `src/app/_store/carrinho.js`
- [Cart Items API](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/itens-carrinho/route.js): `src/app/api/itens-carrinho/route.js`
- [Cart Page](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/carrinho/_components/ClientComponent.jsx): `src/app/carrinho/_components/ClientComponent.jsx`
- [Checkout](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/checkout/page.jsx): `src/app/checkout/page.jsx`
- [Orders API](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/pedidos/route.js): `src/app/api/pedidos/route.js`
- [Order History](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/meus-pedidos/page.jsx): `src/app/meus-pedidos/page.jsx`

### Accounts and Reviews

- [Login](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/login/_components/LoginForm.jsx): `src/app/login/_components/LoginForm.jsx`
- [Registration](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/sign-up/_components/SignUpForm.jsx): `src/app/sign-up/_components/SignUpForm.jsx`
- [Authentication](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/auth/%5B...nextauth%5D/route.js): `src/app/api/auth/[...nextauth]/route.js`
- [Customer Profile](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/perfil/_components/InfosUsuario.jsx): `src/app/perfil/_components/InfosUsuario.jsx`
- [Comments API](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/comentarios/route.js): `src/app/api/comentarios/route.js`

### Product Management

- [Product Admin](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/admin/adicionar-produtos/page.jsx): `src/app/admin/adicionar-produtos/page.jsx`
- [Image Upload API](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/upload/route.js): `src/app/api/upload/route.js`

### Data and Auth

- [Users API](https://github.com/yago-jnp/luciene-modas/blob/main/src/app/api/usuarios/route.js): `src/app/api/usuarios/route.js`
- [Session User Lookup](https://github.com/yago-jnp/luciene-modas/blob/main/src/utils/getUsuarioServerSide.js): `src/utils/getUsuarioServerSide.js`
- [PostgreSQL](https://github.com/yago-jnp/luciene-modas/blob/main/src/lib/db.js): `src/lib/db.js`

### Other components

- **Shopper**

## Connections

- Shopper → Storefront Pages: browses products
- Shopper → Product Admin: manages products
- Product Cards → Cart State: adds item (evidence: `src/components/produtos/CardProduto.jsx`)
- Cart Page → Cart State: uses cart state (evidence: `src/app/carrinho/_components/ClientComponent.jsx`)
- Cart Items API → Session User Lookup: gets user (evidence: `src/app/api/itens-carrinho/route.js`)
- Cart Items API → PostgreSQL: queries cart and products (evidence: `src/app/api/itens-carrinho/route.js`)
- Product Catalog API → PostgreSQL: queries products (evidence: `src/app/api/produtos/route.js`)
- Orders API → Session User Lookup: gets user (evidence: `src/app/api/pedidos/route.js`)
- Orders API → PostgreSQL: writes order transaction (evidence: `src/app/api/pedidos/route.js`)
- Comments API → Session User Lookup: gets user (evidence: `src/app/api/comentarios/route.js`)
- Comments API → PostgreSQL: reads and writes comments (evidence: `src/app/api/comentarios/route.js`)
- Authentication → PostgreSQL: reads and creates accounts (evidence: `src/app/api/auth/[...nextauth]/route.js`)
- Users API → PostgreSQL: reads and creates users (evidence: `src/app/api/usuarios/route.js`)
- Session User Lookup → Authentication: reads session config (evidence: `src/utils/getUsuarioServerSide.js`)
- Session User Lookup → Users API: fetches user record (evidence: `src/utils/getUsuarioServerSide.js`)
