# faker-ruby/faker architecture

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

- Interactive diagram: https://gitdiagram.com/faker-ruby/faker
- Repository: https://github.com/faker-ruby/faker

## Overview

Faker is a Ruby library for generating realistic-looking sample data for tests, demos, and development. A caller loads the library and invokes a generator; generators select or construct values, often using Faker’s translation and random helpers. The graph groups representative domain capabilities rather than every generator file. The README documents localization, uniqueness, and deterministic output; only relationships visible in the supplied excerpts or README are shown, so unsampled generator internals are not inferred.

Main entry points: [`lib/faker.rb`](https://github.com/faker-ruby/faker/blob/main/lib/faker.rb) (Faker API), [`lib/faker/internet.rb`](https://github.com/faker-ruby/faker/blob/main/lib/faker/internet.rb) (Internet data), [`lib/faker/default/name.rb`](https://github.com/faker-ruby/faker/blob/main/lib/faker/default/name.rb) (Names and identity), [`lib/faker/default/omniauth.rb`](https://github.com/faker-ruby/faker/blob/main/lib/faker/default/omniauth.rb) (OAuth mock responses)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Library entry"]
  node_faker["Faker API<br/>[faker.rb]"]
end

subgraph group_core["Generation core"]
  node_translation["Translation lookup<br/>[faker.rb]"]
  node_random["Random selection<br/>[faker.rb]"]
  node_positional["Format builder"]
  node_unique["Unique values"]
end

subgraph group_people["People and internet"]
  node_names["Names and identity<br/>[name.rb]"]
  node_internet["Internet data<br/>[internet.rb]"]
  node_omniauth["OAuth mock responses<br/>[omniauth.rb]"]
end

subgraph group_domains["Domain generators"]
  node_address["Address and location<br/>[address.rb]"]
  node_date["Date and time<br/>[date.rb]"]
  node_finance["Finance and crypto<br/>[finance.rb]"]
  node_numbers["Numbers and strings<br/>[number.rb]"]
end

subgraph group_fiction["Culture generators"]
  node_books["Book data<br/>[lovecraft.rb]"]
  node_music["Music data<br/>[opera.rb]"]
  node_movies["Movie data<br/>[star_wars.rb]"]
  node_games["Game data<br/>[dnd.rb]"]
end

node_caller(("Ruby caller"))
node_i18n["I18n locale service"]

node_caller -->|"loads"| node_faker
node_faker -->|"looks up"| node_translation
node_faker -->|"selects with"| node_random
node_faker -->|"loads helper"| node_positional
node_faker -->|"provides"| node_unique
node_internet -->|"uses names"| node_names
node_omniauth -->|"builds identity"| node_names
node_omniauth -->|"builds email"| node_internet
node_translation -->|"translates"| node_i18n
node_caller -->|"requests generated data"| node_names
node_caller -->|"requests generated data"| node_internet
node_caller -->|"requests generated data"| node_address
node_caller -->|"requests generated data"| node_numbers
node_caller -->|"requests generated data"| node_date
node_caller -->|"requests generated data"| node_finance
node_caller -.->|"requests generated data"| node_books
node_caller -.->|"requests generated data"| node_music
node_caller -.->|"requests generated data"| node_movies
node_caller -.->|"requests generated data"| node_games

click node_faker "https://github.com/faker-ruby/faker/blob/main/lib/faker.rb"
click node_translation "https://github.com/faker-ruby/faker/blob/main/lib/faker.rb"
click node_random "https://github.com/faker-ruby/faker/blob/main/lib/faker.rb"
click node_positional "https://github.com/faker-ruby/faker/blob/main/lib/helpers/positional_generator.rb"
click node_unique "https://github.com/faker-ruby/faker/blob/main/lib/helpers/unique_generator.rb"
click node_names "https://github.com/faker-ruby/faker/blob/main/lib/faker/default/name.rb"
click node_internet "https://github.com/faker-ruby/faker/blob/main/lib/faker/internet.rb"
click node_omniauth "https://github.com/faker-ruby/faker/blob/main/lib/faker/default/omniauth.rb"
click node_address "https://github.com/faker-ruby/faker/blob/main/lib/faker/default/address.rb"
click node_date "https://github.com/faker-ruby/faker/blob/main/lib/faker/default/date.rb"
click node_finance "https://github.com/faker-ruby/faker/blob/main/lib/faker/default/finance.rb"
click node_numbers "https://github.com/faker-ruby/faker/blob/main/lib/faker/default/number.rb"
click node_books "https://github.com/faker-ruby/faker/blob/main/lib/faker/books/lovecraft.rb"
click node_music "https://github.com/faker-ruby/faker/blob/main/lib/faker/music/opera.rb"
click node_movies "https://github.com/faker-ruby/faker/blob/main/lib/faker/movies/star_wars.rb"
click node_games "https://github.com/faker-ruby/faker/blob/main/lib/faker/games/dnd.rb"

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_faker toneBlue
class node_translation,node_random,node_positional,node_unique toneAmber
class node_names,node_internet,node_omniauth toneMint
class node_address,node_date,node_finance,node_numbers toneRose
class node_books,node_music,node_movies,node_games,node_caller,node_i18n toneIndigo
```

## Components

### Library entry

- [Faker API](https://github.com/faker-ruby/faker/blob/main/lib/faker.rb): `lib/faker.rb`

### Generation core

- [Translation lookup](https://github.com/faker-ruby/faker/blob/main/lib/faker.rb): `lib/faker.rb`
- [Random selection](https://github.com/faker-ruby/faker/blob/main/lib/faker.rb): `lib/faker.rb`
- [Format builder](https://github.com/faker-ruby/faker/blob/main/lib/helpers/positional_generator.rb): `lib/helpers/positional_generator.rb`
- [Unique values](https://github.com/faker-ruby/faker/blob/main/lib/helpers/unique_generator.rb): `lib/helpers/unique_generator.rb`

### People and internet

- [Names and identity](https://github.com/faker-ruby/faker/blob/main/lib/faker/default/name.rb): `lib/faker/default/name.rb`
- [Internet data](https://github.com/faker-ruby/faker/blob/main/lib/faker/internet.rb): `lib/faker/internet.rb`
- [OAuth mock responses](https://github.com/faker-ruby/faker/blob/main/lib/faker/default/omniauth.rb): `lib/faker/default/omniauth.rb`

### Domain generators

- [Address and location](https://github.com/faker-ruby/faker/blob/main/lib/faker/default/address.rb): `lib/faker/default/address.rb`
- [Date and time](https://github.com/faker-ruby/faker/blob/main/lib/faker/default/date.rb): `lib/faker/default/date.rb`
- [Finance and crypto](https://github.com/faker-ruby/faker/blob/main/lib/faker/default/finance.rb): `lib/faker/default/finance.rb`
- [Numbers and strings](https://github.com/faker-ruby/faker/blob/main/lib/faker/default/number.rb): `lib/faker/default/number.rb`

### Culture generators

- [Book data](https://github.com/faker-ruby/faker/blob/main/lib/faker/books/lovecraft.rb): `lib/faker/books/lovecraft.rb`
- [Music data](https://github.com/faker-ruby/faker/blob/main/lib/faker/music/opera.rb): `lib/faker/music/opera.rb`
- [Movie data](https://github.com/faker-ruby/faker/blob/main/lib/faker/movies/star_wars.rb): `lib/faker/movies/star_wars.rb`
- [Game data](https://github.com/faker-ruby/faker/blob/main/lib/faker/games/dnd.rb): `lib/faker/games/dnd.rb`

### Other components

- **Ruby caller**
- **I18n locale service**

## Connections

- Ruby caller → Faker API: loads (evidence: `README.md`)
- Faker API → Translation lookup: looks up (evidence: `lib/faker.rb`)
- Faker API → Random selection: selects with (evidence: `lib/faker.rb`)
- Faker API → Format builder: loads helper (evidence: `lib/faker.rb`)
- Faker API → Unique values: provides (evidence: `lib/faker.rb`)
- Internet data → Names and identity: uses names (evidence: `lib/faker/internet.rb`)
- OAuth mock responses → Names and identity: builds identity (evidence: `lib/faker/default/omniauth.rb`)
- OAuth mock responses → Internet data: builds email (evidence: `lib/faker/default/omniauth.rb`)
- Translation lookup → I18n locale service: translates (evidence: `lib/faker.rb`)
- Ruby caller → Names and identity: requests generated data (evidence: `README.md`)
- Ruby caller → Internet data: requests generated data (evidence: `README.md`)
- Ruby caller → Address and location: requests generated data (evidence: `README.md`)
- Ruby caller → Numbers and strings: requests generated data (evidence: `README.md`)
- Ruby caller → Date and time: requests generated data (evidence: `README.md`)
- Ruby caller → Finance and crypto: requests generated data (evidence: `README.md`)
- Ruby caller → Book data: requests generated data
- Ruby caller → Music data: requests generated data
- Ruby caller → Movie data: requests generated data
- Ruby caller → Game data: requests generated data
