From b78376cdf99367e78d8bc0783829fbef6b48d64b Mon Sep 17 00:00:00 2001 From: William Mantly Date: Wed, 31 Dec 2025 20:35:55 -0500 Subject: [PATCH] Add model-redis package references to documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added ORM reference in architecture.md (Redis section) - Added Data Models section in contributing.md with example - Updated README.md to mention model-redis in Architecture - Linked to https://www.npmjs.com/package/model-redis for more info 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- README.md | 2 +- docs/architecture.md | 2 ++ docs/contributing.md | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) 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