diff --git a/README.md b/README.md index 0f42ed8..7bcfa88 100755 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ The system consists of three main components: - Host lookup tree with wildcard matching - User authentication and authorization -3. **Redis** - Data store +3. **Redis** - Data store (using [model-redis](https://www.npmjs.com/package/model-redis) ORM) - Host configurations - User accounts and tokens - SSL certificate storage diff --git a/docs/architecture.md b/docs/architecture.md index 61f91ba..b9f7d15 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -105,6 +105,8 @@ nodejs/ ### Redis (Data Store) +**ORM:** [model-redis](https://www.npmjs.com/package/model-redis) - A lightweight Redis ORM for Node.js with schema validation, relationships, and automatic key management. + **Stored Data:** - Host configurations (domain, IP, port, SSL settings) - User accounts and hashed passwords diff --git a/docs/contributing.md b/docs/contributing.md index 76ef5a3..dad2b1c 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -248,6 +248,28 @@ When you open a PR: 4. Review from maintainers 5. Merge to master +## Data Models + +The project uses [model-redis](https://www.npmjs.com/package/model-redis) as the ORM for Redis data storage. All models extend the `Table` class and use a declarative schema via `_keyMap`. + +**Example Model:** +```javascript +const Table = require('../utils/redis_model'); + +class Host extends Table { + static _key = 'host'; // Primary key field + static _keyMap = { + 'host': {isRequired: true, type: 'string', min: 3, max: 500}, + 'ip': {isRequired: true, type: 'string', min: 3, max: 500}, + 'targetPort': {isRequired: true, type: 'number', min: 0, max: 65535}, + 'forcessl': {default: true, type: 'boolean'}, + 'created_on': {default: () => Date.now(), type: 'number'} + }; +} +``` + +**Learn more:** [model-redis documentation](https://www.npmjs.com/package/model-redis) + ## Adding Features ### Adding a DNS Provider