# wallyway/airlytycs architecture

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

- Interactive diagram: https://gitdiagram.com/wallyway/airlytycs
- Repository: https://github.com/wallyway/airlytycs

## Overview

1. This is a Next.js App Router application with a clear split between public marketing, client checkout, and protected back-office areas. The top-level `app/` tree contains route groups for the protected console (`app/(protected)/*`), public auth pages, a landing page, and a client shopping flow.

2. The main user-facing surfaces are:
   - `app/landing` and `app/page.tsx` for the public marketing entry point
   - `app/login`, `app/signup`, and `app/login-protected` for authentication entry points
   - `app/cliente/*` for the customer shopping/cart/order experience
   - `app/(protected)/*` for internal operational views such as dashboard, products, inventory, sales, customers, suppliers, and movements

3. The protected area is organized as a single shell with `app/(protected)/layout.tsx`, which likely provides the shared authenticated UI chrome. Supporting layout pieces live in `components/layout/` with `Header` and `Sidebar`, indicating a dashboard-style navigation boundary around the internal modules.

4. Business functionality is split by domain into feature components under `components/`:
   - `components/dashboard` for KPI and chart visualizations
   - `components/clientes`, `components/productos`, `components/proveedores`, `components/inventario`, `components/movimientos`, `components/ventas` for table- and chart-based operational views
   - `components/client` for the storefront/cart/checkout flow
   - `components/auth` for admin/client sign-in and sign-up forms
   - `components/landing` for public promotional sections and pricing content

5. Data access is centralized in `lib/queries/`, with one module per business entity (`clientes`, `inventario`, `movimientos`, `productos`, `proveedores`, `ventas`). This suggests the UI does not talk directly to the database; instead, feature pages consume these query helpers as the main data boundary.

6. Supabase is the backend/data platform for the app. The repo includes separate browser and server clients (`lib/supabase-browser.ts`, `lib/supabase.ts`, and `lib/supabase/server.ts`) plus middleware support in `lib/supabase/middleware.ts`. That structure implies server-side session handling for protected routes and browser-side access where needed in client flows.

7. The API layer is small but important: `app/api/client/signup/route.ts`, `app/api/client/checkout/route.ts`, and `app/api/admin/create/route.ts`. These routes likely handle privileged mutations and workflow orchestration that the UI should not perform directly, such as account creation, checkout submission, and initial admin provisioning.

8. The client checkout flow is stateful and partially local. `lib/clientCart.ts` indicates a dedicated cart state/utility layer, while `components/client/CartPageClient.tsx`, `CartPanel.tsx`, `CheckoutModal.tsx`, and `DeliveryAnimation.tsx` form the interactive shopping experience before/after the API submission step.

9. Public and internal UI are built from a shared design system in `components/ui/`. The presence of components such as `dialog`, `select`, `table`, `tabs`, `sonner`, `chart`, and `world-map` indicates the app uses composable primitives for consistent dashboard, form, and visualization patterns rather than ad hoc styling per screen.

10. `components.json`, `app/globals.css`, `postcss.config.mjs`, and `next.config.ts` indicate a Tailwind/shadcn-style frontend stack. This affects architecture mainly by making UI composition the dominant pattern and by centralizing visual behavior in reusable primitives rather than page-specific CSS.

11. `types/index.ts` and `lib/utils.ts` act as shared cross-cutting helpers/types, reducing duplication across feature modules. These shared layers sit between the domain queries and the feature components.

12. `proxy.ts` and the Supabase middleware files point to route-level access control and session propagation as an important architectural boundary. In practice, the app’s request flow is: browser hits a route, middleware/proxy determines access, authenticated pages render through the protected layout, and data is fetched via query helpers or API routes backed by Supabase.

13. The repo also contains non-runtime infrastructure for development and consistency: `.opencode/` agent and skill definitions, `AGENTS.md`, and `skills-lock.json`. These do not affect product runtime, but they do indicate the repository is set up with strong AI-assisted engineering workflows and project-specific conventions.

Main entry points: [`app/(protected)/layout.tsx`](https://github.com/wallyway/airlytycs/blob/main/app/(protected)/layout.tsx) (Protected shell), [`app/layout.tsx`](https://github.com/wallyway/airlytycs/blob/main/app/layout.tsx) (Next app), [`lib/queries/productos.ts`](https://github.com/wallyway/airlytycs/blob/main/lib/queries/productos.ts) (Queries), [`components/ui/button.tsx`](https://github.com/wallyway/airlytycs/blob/main/components/ui/button.tsx) (UI primitives)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_app["App surfaces"]
  node_node_root["Next app<br/>Next.js app<br/>[layout.tsx]"]
  node_node_public["Landing<br/>public page<br/>[page.tsx]"]
  node_node_auth["Auth entry<br/>auth routes<br/>[page.tsx]"]
  node_node_client_flow["Client flow<br/>shopping routes<br/>[page.tsx]"]
  node_node_protected_shell["Protected shell<br/>authenticated layout<br/>[layout.tsx]"]
  node_node_dashboard["Dashboard<br/>ops view<br/>[page.tsx]"]
  node_node_catalog["Catalog<br/>ops views<br/>[page.tsx]"]
  node_node_sales["Sales<br/>ops view<br/>[page.tsx]"]
  node_node_api["API routes<br/>route handlers<br/>[route.ts]"]
end

subgraph group_grp_features["Feature components"]
  node_node_landing_features["Landing UI<br/>marketing components<br/>[PricingSection.tsx]"]
  node_node_auth_features["Auth forms<br/>form components<br/>[AdminLoginCard.tsx]"]
  node_node_client_features["Storefront UI<br/>client components<br/>[CartPageClient.tsx]"]
  node_node_dashboard_features["Dashboard widgets<br/>analytics components"]
  node_node_domain_features["Domain tables<br/>domain views<br/>[ProductosTable.tsx]"]
end

subgraph group_grp_data["Data layer"]
  node_node_queries["Queries<br/>data access<br/>[productos.ts]"]
  node_node_supabase["Supabase clients<br/>backend clients<br/>[supabase.ts]"]
  node_node_cart["Cart state<br/>local state<br/>[clientCart.ts]"]
end

subgraph group_grp_ui["Shared UI"]
  node_node_layout["Nav shell<br/>layout components<br/>[Header.tsx]"]
  node_node_ui["UI primitives<br/>design system<br/>[button.tsx]"]
  node_node_shared["Shared helpers<br/>cross-cutting utils<br/>[utils.ts]"]
end

subgraph group_grp_ops["Ops"]
  node_node_ops["Repo ops<br/>workflow config<br/>[AGENTS.md]"]
end

node_node_root -->|"routes"| node_node_public
node_node_root -->|"routes"| node_node_auth
node_node_root -->|"routes"| node_node_client_flow
node_node_root -->|"routes"| node_node_protected_shell
node_node_protected_shell -->|"wraps"| node_node_dashboard
node_node_protected_shell -->|"wraps"| node_node_catalog
node_node_protected_shell -->|"wraps"| node_node_sales
node_node_protected_shell -->|"uses"| node_node_layout
node_node_public -->|"renders"| node_node_landing_features
node_node_auth -->|"renders"| node_node_auth_features
node_node_client_flow -->|"renders"| node_node_client_features
node_node_dashboard -->|"renders"| node_node_dashboard_features
node_node_catalog -->|"renders"| node_node_domain_features
node_node_sales -->|"renders"| node_node_domain_features
node_node_dashboard_features -->|"builds on"| node_node_ui
node_node_domain_features -->|"builds on"| node_node_ui
node_node_landing_features -->|"builds on"| node_node_ui
node_node_auth_features -->|"builds on"| node_node_ui
node_node_client_features -->|"uses"| node_node_cart
node_node_client_features -->|"submits to"| node_node_api
node_node_api -->|"writes via"| node_node_supabase
node_node_queries -->|"reads via"| node_node_supabase
node_node_public -.->|"consumes"| node_node_queries
node_node_dashboard -->|"consumes"| node_node_queries
node_node_catalog -->|"consumes"| node_node_queries
node_node_auth -->|"posts to"| node_node_api
node_node_protected_shell -->|"gated by"| node_node_supabase
node_node_shared -->|"supports"| node_node_queries
node_node_ops -.->|"guides"| node_node_root

click node_node_root "https://github.com/wallyway/airlytycs/blob/main/app/layout.tsx"
click node_node_public "https://github.com/wallyway/airlytycs/blob/main/app/page.tsx"
click node_node_auth "https://github.com/wallyway/airlytycs/blob/main/app/login/page.tsx"
click node_node_client_flow "https://github.com/wallyway/airlytycs/blob/main/app/cliente/carrito/page.tsx"
click node_node_protected_shell "https://github.com/wallyway/airlytycs/blob/main/app/(protected)/layout.tsx"
click node_node_dashboard "https://github.com/wallyway/airlytycs/blob/main/app/(protected)/dashboard/page.tsx"
click node_node_catalog "https://github.com/wallyway/airlytycs/blob/main/app/(protected)/productos/page.tsx"
click node_node_sales "https://github.com/wallyway/airlytycs/blob/main/app/(protected)/ventas/page.tsx"
click node_node_api "https://github.com/wallyway/airlytycs/blob/main/app/api/client/checkout/route.ts"
click node_node_layout "https://github.com/wallyway/airlytycs/blob/main/components/layout/Header.tsx"
click node_node_ui "https://github.com/wallyway/airlytycs/blob/main/components/ui/button.tsx"
click node_node_shared "https://github.com/wallyway/airlytycs/blob/main/lib/utils.ts"
click node_node_queries "https://github.com/wallyway/airlytycs/blob/main/lib/queries/productos.ts"
click node_node_supabase "https://github.com/wallyway/airlytycs/blob/main/lib/supabase.ts"
click node_node_cart "https://github.com/wallyway/airlytycs/blob/main/lib/clientCart.ts"
click node_node_landing_features "https://github.com/wallyway/airlytycs/blob/main/components/landing/PricingSection.tsx"
click node_node_auth_features "https://github.com/wallyway/airlytycs/blob/main/components/auth/AdminLoginCard.tsx"
click node_node_client_features "https://github.com/wallyway/airlytycs/blob/main/components/client/CartPageClient.tsx"
click node_node_dashboard_features "https://github.com/wallyway/airlytycs/blob/main/components/dashboard/DashboardCharts.tsx"
click node_node_domain_features "https://github.com/wallyway/airlytycs/blob/main/components/productos/ProductosTable.tsx"
click node_node_ops "https://github.com/wallyway/airlytycs/blob/main/AGENTS.md"

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_node_root,node_node_public,node_node_auth,node_node_client_flow,node_node_protected_shell,node_node_dashboard,node_node_catalog,node_node_sales,node_node_api toneBlue
class node_node_landing_features,node_node_auth_features,node_node_client_features,node_node_dashboard_features,node_node_domain_features toneAmber
class node_node_queries,node_node_supabase,node_node_cart toneMint
class node_node_layout,node_node_ui,node_node_shared toneRose
class node_node_ops toneIndigo
```

## Components

### App surfaces

Route-level entry points and protected/internal areas.

- [Next app](https://github.com/wallyway/airlytycs/blob/main/app/layout.tsx): Next.js app · Root application shell and route composition. · `app/layout.tsx`
- [Landing](https://github.com/wallyway/airlytycs/blob/main/app/page.tsx): public page · Marketing entry point and homepage routes. · `app/page.tsx`
- [Auth entry](https://github.com/wallyway/airlytycs/blob/main/app/login/page.tsx): auth routes · Login and signup pages for admins and clients. · `app/login/page.tsx`
- [Client flow](https://github.com/wallyway/airlytycs/blob/main/app/cliente/carrito/page.tsx): shopping routes · Customer cart and order confirmation experience. · `app/cliente/carrito/page.tsx`
- [Protected shell](https://github.com/wallyway/airlytycs/blob/main/app/(protected)/layout.tsx): authenticated layout · Shared authenticated UI chrome for internal modules. · `app/(protected)/layout.tsx`
- [Dashboard](https://github.com/wallyway/airlytycs/blob/main/app/(protected)/dashboard/page.tsx): ops view · Internal KPI and overview page. · `app/(protected)/dashboard/page.tsx`
- [Catalog](https://github.com/wallyway/airlytycs/blob/main/app/(protected)/productos/page.tsx): ops views · Protected product, inventory, supplier, customer, and movement screens. · `app/(protected)/productos/page.tsx`
- [Sales](https://github.com/wallyway/airlytycs/blob/main/app/(protected)/ventas/page.tsx): ops view · Protected sales reporting and management screen. · `app/(protected)/ventas/page.tsx`
- [API routes](https://github.com/wallyway/airlytycs/blob/main/app/api/client/checkout/route.ts): route handlers · Privileged mutation endpoints for signup, checkout, and admin creation. · `app/api/client/checkout/route.ts`

### Feature components

Domain UI components grouped by product area.

- [Landing UI](https://github.com/wallyway/airlytycs/blob/main/components/landing/PricingSection.tsx): marketing components · Public promotional sections, pricing, navigation, and scrollytelling. · `components/landing/PricingSection.tsx`
- [Auth forms](https://github.com/wallyway/airlytycs/blob/main/components/auth/AdminLoginCard.tsx): form components · Admin and client sign-in/sign-up cards and forms. · `components/auth/AdminLoginCard.tsx`
- [Storefront UI](https://github.com/wallyway/airlytycs/blob/main/components/client/CartPageClient.tsx): client components · Cart, checkout modal, product showcase, and delivery animation. · `components/client/CartPageClient.tsx`
- [Dashboard widgets](https://github.com/wallyway/airlytycs/blob/main/components/dashboard/DashboardCharts.tsx): analytics components · KPI cards and chart-driven dashboard visualizations. · `components/dashboard/DashboardCharts.tsx`
- [Domain tables](https://github.com/wallyway/airlytycs/blob/main/components/productos/ProductosTable.tsx): domain views · Customers, products, inventory, movements, sales, and supplier tables/charts. · `components/productos/ProductosTable.tsx`

### Data layer

Query helpers, cart state, and Supabase clients.

- [Queries](https://github.com/wallyway/airlytycs/blob/main/lib/queries/productos.ts): data access · Entity-specific query helpers for the operational domains. · `lib/queries/productos.ts`
- [Supabase clients](https://github.com/wallyway/airlytycs/blob/main/lib/supabase.ts): backend clients · Browser, server, and middleware Supabase access plus session propagation. · `lib/supabase.ts`
- [Cart state](https://github.com/wallyway/airlytycs/blob/main/lib/clientCart.ts): local state · Client-side cart and checkout state utilities. · `lib/clientCart.ts`

### Shared UI

Reusable layout, primitives, and cross-cutting helpers.

- [Nav shell](https://github.com/wallyway/airlytycs/blob/main/components/layout/Header.tsx): layout components · Shared header and sidebar used around protected areas. · `components/layout/Header.tsx`
- [UI primitives](https://github.com/wallyway/airlytycs/blob/main/components/ui/button.tsx): design system · Reusable shadcn-style controls, tables, dialogs, charts, and map components. · `components/ui/button.tsx`
- [Shared helpers](https://github.com/wallyway/airlytycs/blob/main/lib/utils.ts): cross-cutting utils · General utilities and shared TypeScript types. · `lib/utils.ts`

### Ops

Developer workflow and repository conventions.

- [Repo ops](https://github.com/wallyway/airlytycs/blob/main/AGENTS.md): workflow config · Agent, skill, and project guidance files that shape repository conventions. · `AGENTS.md`

## Connections

- Next app → Landing: routes · App router exposes the public landing entry.
- Next app → Auth entry: routes · App router exposes login and signup pages.
- Next app → Client flow: routes · App router exposes the customer shopping flow.
- Next app → Protected shell: routes · Protected section is mounted under the app router.
- Protected shell → Dashboard: wraps · Shared authenticated shell surrounds the dashboard.
- Protected shell → Catalog: wraps · Shared authenticated shell surrounds operational modules.
- Protected shell → Sales: wraps · Shared authenticated shell surrounds sales views.
- Protected shell → Nav shell: uses · Protected shell likely composes header and sidebar chrome.
- Landing → Landing UI: renders · Landing page is built from marketing feature components.
- Auth entry → Auth forms: renders · Auth pages render login and signup forms.
- Client flow → Storefront UI: renders · Client pages render storefront and checkout components.
- Dashboard → Dashboard widgets: renders · Dashboard page is composed from KPI and chart widgets.
- Catalog → Domain tables: renders · Operational pages use domain-specific tables and charts.
- Sales → Domain tables: renders · Sales page uses the shared operational domain views.
- Dashboard widgets → UI primitives: builds on · Analytics widgets rely on shared UI primitives.
- Domain tables → UI primitives: builds on · Domain tables and charts rely on shared UI primitives.
- Landing UI → UI primitives: builds on · Public marketing sections use the shared design system.
- Auth forms → UI primitives: builds on · Auth forms use shared form and feedback primitives.
- Storefront UI → Cart state: uses · Checkout UI is backed by dedicated cart state utilities.
- Storefront UI → API routes: submits to · Checkout flow hands off to API routes for privileged actions.
- API routes → Supabase clients: writes via · API handlers delegate mutations to Supabase.
- Queries → Supabase clients: reads via · Domain query helpers are the main read boundary to Supabase.
- Landing → Queries: consumes · Public-facing pages can consume shared data helpers where needed.
- Dashboard → Queries: consumes · Dashboard view reads operational data through query helpers.
- Catalog → Queries: consumes · Operational screens consume entity query modules.
- Auth entry → API routes: posts to · Signup and provisioning flows go through route handlers.
- Protected shell → Supabase clients: gated by · Session propagation and middleware protect internal routes.
- Shared helpers → Queries: supports · Utilities and shared types support the domain data layer.
- Repo ops → Next app: guides · Repository conventions shape the application structure.
