Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nodejs/bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ function onListening() {
for(let listener of app.onListen){
listener()
}
}
}
2 changes: 1 addition & 1 deletion nodejs/models/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const Table = require('../utils/redis_model')
const Table = require('../utils/redis_model');
module.exports = Table;

require('./dns_provider');
Expand Down
101 changes: 101 additions & 0 deletions nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"jquery": "^3.7.1",
"ldapts": "^8.1.2",
"linux-sys-user": "^1.2.0",
"model-redis": "^0.4.0",
"moment": "^2.30.1",
"mustache": "^4.2.0",
"p2psub": "^0.2.0",
Expand Down
Loading