repowiseory/kratos

Architecture of ory/kratos

ory/kratos is 7,112 source files holding 8,367 symbols across 26 modules, written mainly in Go, Shell, Makefile. The largest module is persistence, with 3,860 files, and 19 files are entry points into the dependency graph.

How kratos fits together

Requests for identity flows enter through HTTP handlers in the selfservice module, which has 781 files covering self-service login, registration and recovery. The identity module, with 196 files, defines identity data and its schemas. The persistence module, the largest with 3860 files, stores and retrieves identities through SQL-backed code such as persistence/sql/identity/persister_identity.go. The driver module wires these parts together, and the x directory holds shared helpers such as x/http.go and x/uuid.go. Responses leave the service as structured JSON.

Largest modules

  • persistence: 3,860 files and 15,385 lines of code
  • oryx: 1,747 files and 33,684 lines of code
  • selfservice: 781 files and 88,577 lines of code
  • identity: 196 files and 18,382 lines of code
  • courier: 70 files and 4,313 lines of code
  • x: 62 files and 4,052 lines of code
  • cmd: 49 files and 3,617 lines of code
  • driver: 46 files and 6,790 lines of code

Languages

By file count: Go 1,013 files, Shell 9 files, Makefile 3 files, Dockerfile 1 file, JavaScript 1 file.

Documentation

Repowise documents kratos in 1,258 pages generated from the source, 56 of them written explanations of the repository and its modules.

More on kratos: summary and FAQ, codebase overview, code health.

Related guide: Best dependency graph tools for monorepos