# nomad-bank/nestjs-simple-redis-lock architecture

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

- Interactive diagram: https://gitdiagram.com/nomad-bank/nestjs-simple-redis-lock
- Repository: https://github.com/nomad-bank/nestjs-simple-redis-lock

## Overview

This NestJS library provides distributed locking through a single Redis instance. An application registers the lock module with Redis options, then calls the injected service or wraps a method with the decorator; the service acquires, renews, and releases locks in Redis. The graph includes configuration and the service’s options/token layer. The README documents Nest Redis setup and decorator behavior; source excerpts show the lock operations and module wiring.

Main entry points: [`lib/redisLock.service.ts`](https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/redisLock.service.ts) (Lock Service), [`lib/redisLock.module.ts`](https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/redisLock.module.ts) (Lock Module), [`lib/redisLock.decorator.ts`](https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/redisLock.decorator.ts) (Lock Decorator), [`lib/interfaces/redisLockOptions.interface.ts`](https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/interfaces/redisLockOptions.interface.ts) (Lock Options)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Module Configuration"]
  node_module["Lock Module"]
  node_options["Lock Options"]
  node_token["Options Token"]
end

subgraph group_locking["Lock Runtime"]
  node_service["Lock Service"]
end

subgraph group_integration["Application API"]
  node_decorator["Lock Decorator"]
end

node_app(("Nest Application"))
node_redis[("Redis Instance")]

node_app -->|"registers"| node_module
node_module -->|"accepts"| node_options
node_module -->|"provides"| node_token
node_module -->|"exports"| node_service
node_service -->|"injects"| node_token
node_service -->|"uses"| node_options
node_app -->|"calls"| node_service
node_app -->|"decorates methods"| node_decorator
node_decorator -->|"locks and unlocks"| node_service
node_service -->|"sets, expires, deletes"| node_redis

click node_module "https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/redisLock.module.ts"
click node_options "https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/interfaces/redisLockOptions.interface.ts"
click node_token "https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/redisLock.constants.ts"
click node_service "https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/redisLock.service.ts"
click node_decorator "https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/redisLock.decorator.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_module,node_options,node_token toneBlue
class node_service,node_redis toneAmber
class node_decorator toneMint
class node_app toneIndigo
```

## Components

### Module Configuration

- [Lock Module](https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/redisLock.module.ts): `lib/redisLock.module.ts`
- [Lock Options](https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/interfaces/redisLockOptions.interface.ts): `lib/interfaces/redisLockOptions.interface.ts`
- [Options Token](https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/redisLock.constants.ts): `lib/redisLock.constants.ts`

### Lock Runtime

- [Lock Service](https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/redisLock.service.ts): `lib/redisLock.service.ts`

### Application API

- [Lock Decorator](https://github.com/nomad-bank/nestjs-simple-redis-lock/blob/master/lib/redisLock.decorator.ts): `lib/redisLock.decorator.ts`

### Other components

- **Nest Application**
- **Redis Instance**

## Connections

- Nest Application → Lock Module: registers (evidence: `README.md`)
- Lock Module → Lock Options: accepts (evidence: `lib/redisLock.module.ts`)
- Lock Module → Options Token: provides (evidence: `lib/redisLock.module.ts`)
- Lock Module → Lock Service: exports (evidence: `lib/redisLock.module.ts`)
- Lock Service → Options Token: injects (evidence: `lib/redisLock.service.ts`)
- Lock Service → Lock Options: uses (evidence: `lib/redisLock.service.ts`)
- Nest Application → Lock Service: calls (evidence: `README.md`)
- Nest Application → Lock Decorator: decorates methods (evidence: `README.md`)
- Lock Decorator → Lock Service: locks and unlocks (evidence: `lib/redisLock.decorator.ts`)
- Lock Service → Redis Instance: sets, expires, deletes (evidence: `lib/redisLock.service.ts`)
