# razmans/mykad architecture

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

- Interactive diagram: https://gitdiagram.com/razmans/mykad
- Repository: https://github.com/razmans/mykad

## Overview

MyKad Validator is a small TypeScript library that accepts a MyKad number and returns validation and derived identity details. Users can call individual functions or use readMyKadNum to obtain validity, age, date of birth, state, and gender together. The runtime is implemented in one source file; the graph separates its distinct responsibilities. Relationships are supported by the source excerpt and README.

Main entry points: [`index.ts`](https://github.com/razmans/mykad/blob/main/index.ts) (Combined Reader)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("Library User"))
node_read["Combined Reader<br/>[index.ts]"]
node_validator["Format Validator<br/>[index.ts]"]
node_age["Age Calculator<br/>[index.ts]"]
node_dob["Birth Date<br/>[index.ts]"]
node_gender["Gender Resolver<br/>[index.ts]"]
node_state["Birth State<br/>[index.ts]"]

node_user -->|"requests details"| node_read
node_user -->|"validates number"| node_validator
node_user -->|"requests age"| node_age
node_user -->|"requests birth date"| node_dob
node_user -->|"requests gender"| node_gender
node_user -->|"requests state"| node_state
node_read -->|"checks format"| node_validator
node_read -->|"calculates age"| node_age
node_read -->|"gets birth date"| node_dob
node_read -->|"gets gender"| node_gender
node_read -->|"gets birth state"| node_state
node_age -->|"checks format"| node_validator
node_dob -->|"checks format"| node_validator
node_gender -->|"checks format"| node_validator
node_state -->|"checks format"| node_validator

click node_read "https://github.com/razmans/mykad/blob/main/index.ts"
click node_validator "https://github.com/razmans/mykad/blob/main/index.ts"
click node_age "https://github.com/razmans/mykad/blob/main/index.ts"
click node_dob "https://github.com/razmans/mykad/blob/main/index.ts"
click node_gender "https://github.com/razmans/mykad/blob/main/index.ts"
click node_state "https://github.com/razmans/mykad/blob/main/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_user toneBlue
class node_read,node_validator,node_age,node_dob,node_gender,node_state toneTeal
```

## Components

### Other components

- **Library User**
- [Combined Reader](https://github.com/razmans/mykad/blob/main/index.ts): `index.ts`
- [Format Validator](https://github.com/razmans/mykad/blob/main/index.ts): `index.ts`
- [Age Calculator](https://github.com/razmans/mykad/blob/main/index.ts): `index.ts`
- [Birth Date](https://github.com/razmans/mykad/blob/main/index.ts): `index.ts`
- [Gender Resolver](https://github.com/razmans/mykad/blob/main/index.ts): `index.ts`
- [Birth State](https://github.com/razmans/mykad/blob/main/index.ts): `index.ts`

## Connections

- Library User → Combined Reader: requests details (evidence: `README.md`)
- Library User → Format Validator: validates number (evidence: `README.md`)
- Library User → Age Calculator: requests age (evidence: `README.md`)
- Library User → Birth Date: requests birth date (evidence: `README.md`)
- Library User → Gender Resolver: requests gender (evidence: `README.md`)
- Library User → Birth State: requests state (evidence: `README.md`)
- Combined Reader → Format Validator: checks format (evidence: `index.ts`)
- Combined Reader → Age Calculator: calculates age (evidence: `index.ts`)
- Combined Reader → Birth Date: gets birth date (evidence: `index.ts`)
- Combined Reader → Gender Resolver: gets gender (evidence: `index.ts`)
- Combined Reader → Birth State: gets birth state (evidence: `index.ts`)
- Age Calculator → Format Validator: checks format (evidence: `index.ts`)
- Birth Date → Format Validator: checks format (evidence: `index.ts`)
- Gender Resolver → Format Validator: checks format (evidence: `index.ts`)
- Birth State → Format Validator: checks format (evidence: `index.ts`)
