# 100xdevs-cohort-2/paytm-project-starter-monorepo architecture

> Architecture diagram of the GitHub repository 100xdevs-cohort-2/paytm-project-starter-monorepo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/100xdevs-cohort-2/paytm-project-starter-monorepo
- Repository: https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo

## Overview

This repository is a small monorepo prototype with separate user and merchant Next.js apps, shared authentication and user-facing UI, a Recoil balance state package, and a Prisma database package. The user flow renders a session-aware app bar and exposes a session-guarded user endpoint; the merchant app displays a balance and has an API route that creates a database user. The README describes a generic Turborepo starter and does not document these product flows. Some auth and provider implementations were not sampled, so only shown or indexed relationships are drawn.

Main entry points: [`apps/user-app/app/page.tsx`](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/app/page.tsx) (User page), [`apps/user-app/app/api/auth/[...nextauth]/route.ts`](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/app/api/auth/%5B...nextauth%5D/route.ts) (Auth endpoint), [`apps/user-app/app/api/user/route.ts`](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/app/api/user/route.ts) (Session API), [`apps/merchant-app/app/page.tsx`](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/merchant-app/app/page.tsx) (Merchant page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_user["User app"]
  node_user_page["User page<br/>[page.tsx]"]
  node_user_providers["User providers<br/>[provider.tsx]"]
  node_user_auth_route["Auth endpoint<br/>[route.ts]"]
  node_user_auth_config["User auth config<br/>[auth.ts]"]
  node_user_api["Session API<br/>[route.ts]"]
end

subgraph group_merchant["Merchant app"]
  node_merchant_page["Merchant page<br/>[page.tsx]"]
  node_merchant_providers["Merchant providers<br/>[provider.tsx]"]
  node_merchant_auth_route["Auth endpoint<br/>[route.ts]"]
  node_merchant_auth_config["Merchant auth config<br/>[auth.ts]"]
  node_merchant_api["Merchant API<br/>[route.ts]"]
end

subgraph group_shared["Shared packages"]
  node_appbar["Shared app bar<br/>[Appbar.tsx]"]
  node_balance_hook["Balance hook<br/>[useBalance.ts]"]
  node_balance_atom["Balance state<br/>[balance.ts]"]
  node_database[("Prisma database<br/>[schema.prisma]")]
end

node_user_actor(("User"))
node_merchant_actor(("Merchant"))

node_user_actor -->|"opens"| node_user_page
node_user_page -->|"renders"| node_appbar
node_user_page -.->|"uses session context"| node_user_providers
node_user_actor -->|"signs in"| node_user_auth_route
node_user_auth_route -->|"configures"| node_user_auth_config
node_user_actor -->|"requests session"| node_user_api
node_user_api -->|"checks session"| node_user_auth_config
node_merchant_actor -->|"opens"| node_merchant_page
node_merchant_page -->|"reads balance"| node_balance_hook
node_balance_hook -->|"reads value"| node_balance_atom
node_merchant_actor -->|"signs in"| node_merchant_auth_route
node_merchant_auth_route -->|"configures"| node_merchant_auth_config
node_merchant_actor -->|"requests user"| node_merchant_api
node_merchant_api -->|"creates user"| node_database

click node_user_page "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/app/page.tsx"
click node_user_providers "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/provider.tsx"
click node_user_auth_route "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/app/api/auth/%5B...nextauth%5D/route.ts"
click node_user_auth_config "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/app/lib/auth.ts"
click node_user_api "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/app/api/user/route.ts"
click node_merchant_page "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/merchant-app/app/page.tsx"
click node_merchant_providers "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/merchant-app/provider.tsx"
click node_merchant_auth_route "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/merchant-app/app/api/auth/%5B...nextauth%5D/route.ts"
click node_merchant_auth_config "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/merchant-app/lib/auth.ts"
click node_merchant_api "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/merchant-app/app/api/user/route.ts"
click node_appbar "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/packages/ui/src/Appbar.tsx"
click node_balance_hook "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/packages/store/src/hooks/useBalance.ts"
click node_balance_atom "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/packages/store/src/atoms/balance.ts"
click node_database "https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/packages/db/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_user_page,node_user_providers,node_user_auth_route,node_user_auth_config,node_user_api,node_user_actor toneBlue
class node_merchant_page,node_merchant_providers,node_merchant_auth_route,node_merchant_auth_config,node_merchant_api toneAmber
class node_appbar,node_balance_hook,node_balance_atom,node_database toneMint
class node_merchant_actor toneIndigo
```

## Components

### User app

- [User page](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/app/page.tsx): `apps/user-app/app/page.tsx`
- [User providers](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/provider.tsx): `apps/user-app/provider.tsx`
- [Auth endpoint](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/app/api/auth/%5B...nextauth%5D/route.ts): `apps/user-app/app/api/auth/[...nextauth]/route.ts`
- [User auth config](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/app/lib/auth.ts): `apps/user-app/app/lib/auth.ts`
- [Session API](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/user-app/app/api/user/route.ts): `apps/user-app/app/api/user/route.ts`

### Merchant app

- [Merchant page](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/merchant-app/app/page.tsx): `apps/merchant-app/app/page.tsx`
- [Merchant providers](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/merchant-app/provider.tsx): `apps/merchant-app/provider.tsx`
- [Auth endpoint](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/merchant-app/app/api/auth/%5B...nextauth%5D/route.ts): `apps/merchant-app/app/api/auth/[...nextauth]/route.ts`
- [Merchant auth config](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/merchant-app/lib/auth.ts): `apps/merchant-app/lib/auth.ts`
- [Merchant API](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/apps/merchant-app/app/api/user/route.ts): `apps/merchant-app/app/api/user/route.ts`

### Shared packages

- [Shared app bar](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/packages/ui/src/Appbar.tsx): `packages/ui/src/Appbar.tsx`
- [Balance hook](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/packages/store/src/hooks/useBalance.ts): `packages/store/src/hooks/useBalance.ts`
- [Balance state](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/packages/store/src/atoms/balance.ts): `packages/store/src/atoms/balance.ts`
- [Prisma database](https://github.com/100xdevs-cohort-2/paytm-project-starter-monorepo/blob/migration/packages/db/prisma/schema.prisma): `packages/db/prisma/schema.prisma`

### Other components

- **User**
- **Merchant**

## Connections

- User → User page: opens (evidence: `apps/user-app/app/page.tsx`)
- User page → Shared app bar: renders (evidence: `apps/user-app/app/page.tsx`)
- User page → User providers: uses session context
- User → Auth endpoint: signs in (evidence: `apps/user-app/app/api/auth/[...nextauth]/route.ts`)
- Auth endpoint → User auth config: configures (evidence: `apps/user-app/app/api/auth/[...nextauth]/route.ts`)
- User → Session API: requests session (evidence: `apps/user-app/app/api/user/route.ts`)
- Session API → User auth config: checks session (evidence: `apps/user-app/app/api/user/route.ts`)
- Merchant → Merchant page: opens (evidence: `apps/merchant-app/app/page.tsx`)
- Merchant page → Balance hook: reads balance (evidence: `apps/merchant-app/app/page.tsx`)
- Balance hook → Balance state: reads value (evidence: `packages/store/src/hooks/useBalance.ts`)
- Merchant → Auth endpoint: signs in (evidence: `apps/merchant-app/app/api/auth/[...nextauth]/route.ts`)
- Auth endpoint → Merchant auth config: configures (evidence: `apps/merchant-app/app/api/auth/[...nextauth]/route.ts`)
- Merchant → Merchant API: requests user (evidence: `apps/merchant-app/app/api/user/route.ts`)
- Merchant API → Prisma database: creates user (evidence: `apps/merchant-app/app/api/user/route.ts`)
