# aulafirdaus/uauth-nextjs-client architecture

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

- Interactive diagram: https://gitdiagram.com/aulafirdaus/uauth-nextjs-client
- Repository: https://github.com/aulafirdaus/uauth-nextjs-client

## Overview

UAuth Next.js Client is a small Auth.js OIDC provider factory. A developer supplies issuer and client credentials; Auth.js consumes its provider configuration to run the OIDC flow, applying the configured PKCE, state, nonce, and scopes. Auth.js then uses the profile mapper to normalize identity and role/group claims. The README also documents forwarding roles and groups through application-defined callbacks; those callbacks are not implemented in this package. The single source file supports this map; runtime behavior inside Auth.js is represented only where the README or provider configuration establishes it.

Main entry points: [`src/index.ts`](https://github.com/aulafirdaus/uauth-nextjs-client/blob/main/src/index.ts) (Provider factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_provider["OIDC provider"]
  node_factory["Provider factory<br/>[index.ts]"]
  node_oidc_config["OIDC settings<br/>[index.ts]"]
  node_profile_mapper["Profile mapper<br/>[index.ts]"]
end

node_developer(("Developer"))
node_authjs["Auth.js"]
node_uauth["UAuth IdP"]

node_developer -->|"configures"| node_factory
node_factory -->|"returns config"| node_authjs
node_authjs -->|"runs OIDC"| node_uauth
node_authjs -->|"uses settings"| node_oidc_config
node_uauth -->|"returns claims"| node_authjs
node_authjs -->|"invokes"| node_profile_mapper
node_profile_mapper -->|"returns user"| node_authjs

click node_factory "https://github.com/aulafirdaus/uauth-nextjs-client/blob/main/src/index.ts"
click node_oidc_config "https://github.com/aulafirdaus/uauth-nextjs-client/blob/main/src/index.ts"
click node_profile_mapper "https://github.com/aulafirdaus/uauth-nextjs-client/blob/main/src/index.ts"

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_factory,node_oidc_config,node_profile_mapper toneBlue
class node_developer,node_authjs,node_uauth toneIndigo
```

## Components

### OIDC provider

- [Provider factory](https://github.com/aulafirdaus/uauth-nextjs-client/blob/main/src/index.ts): `src/index.ts`
- [OIDC settings](https://github.com/aulafirdaus/uauth-nextjs-client/blob/main/src/index.ts): `src/index.ts`
- [Profile mapper](https://github.com/aulafirdaus/uauth-nextjs-client/blob/main/src/index.ts): `src/index.ts`

### Other components

- **Developer**
- **Auth.js**
- **UAuth IdP**

## Connections

- Developer → Provider factory: configures
- Provider factory → Auth.js: returns config
- Auth.js → UAuth IdP: runs OIDC
- Auth.js → OIDC settings: uses settings
- UAuth IdP → Auth.js: returns claims
- Auth.js → Profile mapper: invokes
- Profile mapper → Auth.js: returns user
