Add model-redis package references to documentation

- 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 <noreply@anthropic.com>
This commit is contained in:
2025-12-31 20:35:55 -05:00
parent 5913c5e8c3
commit b78376cdf9
3 changed files with 25 additions and 1 deletions
+1 -1
View File
@@ -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
+2
View File
@@ -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
+22
View File
@@ -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