xypriss 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/dist/cjs/index.js +74 -0
- package/dist/cjs/package.json +3 -0
- package/dist/esm/index.js +19 -0
- package/dist/esm/package.json +3 -0
- package/dist/index.d.ts +7252 -0
- package/package.json +254 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 NEHONIX INC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# XyPriss
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/xypriss)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
**XyPriss** is a high-performance, security-focused Node.js framework that enhances Express.js with enterprise-grade features. Built with TypeScript and featuring a modular architecture, XyPriss provides developers with a fast, secure way to create scalable web applications while maintaining full Express.js compatibility.
|
|
8
|
+
|
|
9
|
+
## 🚀 Key Features
|
|
10
|
+
|
|
11
|
+
### Performance & Scalability
|
|
12
|
+
|
|
13
|
+
- **Ultra-Fast Request Processing**: Advanced request pre-compilation and optimization
|
|
14
|
+
- **Intelligent Caching**: Multi-tier caching with Redis, Memory, and File system support
|
|
15
|
+
- **Cluster Management**: Built-in clustering with auto-scaling capabilities
|
|
16
|
+
- **Smart Routing**: Dynamic route optimization and intelligent request handling
|
|
17
|
+
|
|
18
|
+
### Security First
|
|
19
|
+
|
|
20
|
+
- **XyPriss Security Module**: Comprehensive cryptographic utilities and secure data handling
|
|
21
|
+
- **Fortified Functions**: Tamper-resistant function execution with integrity verification
|
|
22
|
+
- **Advanced Middleware**: Built-in protection against XSS, SQL injection, and other attacks
|
|
23
|
+
- **Secure Memory Management**: Protected memory allocation and cleanup
|
|
24
|
+
|
|
25
|
+
### Developer Experience
|
|
26
|
+
|
|
27
|
+
- **TypeScript Native**: Full TypeScript support with comprehensive type definitions
|
|
28
|
+
- **Modular Architecture**: Plugin-based system for extensibility
|
|
29
|
+
- **Rich Ecosystem**: Integration with XyPriss Security toolkit
|
|
30
|
+
- **Comprehensive Documentation**: Detailed guides and API references
|
|
31
|
+
|
|
32
|
+
## 📦 Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install xypriss
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
For the complete security toolkit:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install xypriss xypriss-security
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 🏃♂️ Quick Start
|
|
45
|
+
|
|
46
|
+
### Basic Server Setup
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { createServer } from "xypriss";
|
|
50
|
+
|
|
51
|
+
// Create a new XyPriss server (enhanced ExpressJS)
|
|
52
|
+
const server = createServer({
|
|
53
|
+
port: 3000,
|
|
54
|
+
security: {
|
|
55
|
+
enabled: true,
|
|
56
|
+
rateLimit: {
|
|
57
|
+
windowMs: 15 * 60 * 1000, // 15 minutes
|
|
58
|
+
max: 100, // limit each IP to 100 requests per windowMs
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
cache: {
|
|
62
|
+
type: "memory",
|
|
63
|
+
maxSize: 100, // 100MB
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Define routes (ExpressJS-compatible)
|
|
68
|
+
server.get("/", (req, res) => {
|
|
69
|
+
res.json({ message: "Hello from XyPriss!" });
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
server.get("/api/users/:id", (req, res) => {
|
|
73
|
+
const userId = req.params.id;
|
|
74
|
+
// Your logic here
|
|
75
|
+
res.json({ userId, data: "User data" });
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Start the server
|
|
79
|
+
server.listen(3000, () => {
|
|
80
|
+
console.log("XyPriss server running on port 3000");
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### XyPriss Security Integration
|
|
85
|
+
|
|
86
|
+
XyPriss seamlessly integrates with the XyPriss Security toolkit, providing:
|
|
87
|
+
|
|
88
|
+
- Advanced cryptographic functions
|
|
89
|
+
- Secure data structures
|
|
90
|
+
- Tamper-evident logging
|
|
91
|
+
- Fortified function execution
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { createServer } from "xypriss";
|
|
95
|
+
import { XyPrissSecurity, SecureString, Hash } from "xypriss-security";
|
|
96
|
+
|
|
97
|
+
const server = createServer({
|
|
98
|
+
port: 3000,
|
|
99
|
+
security: { enabled: true },
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Initialize security module
|
|
103
|
+
const security = new XyPrissSecurity();
|
|
104
|
+
|
|
105
|
+
// Secure route with encryption
|
|
106
|
+
server.post("/api/secure-data", async (req, res) => {
|
|
107
|
+
try {
|
|
108
|
+
// Encrypt sensitive data
|
|
109
|
+
const encryptedData = await security.encrypt(req.body.data);
|
|
110
|
+
|
|
111
|
+
// Store securely (example)
|
|
112
|
+
const secureStorage = new SecureString(encryptedData);
|
|
113
|
+
|
|
114
|
+
res.json({
|
|
115
|
+
success: true,
|
|
116
|
+
hash: Hash.create(req.body.data, { algorithm: "sha256" }),
|
|
117
|
+
});
|
|
118
|
+
} catch (error) {
|
|
119
|
+
res.status(500).json({ error: "Security operation failed" });
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
server.listen(3000, () => {
|
|
124
|
+
console.log("Secure XyPriss server running");
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## 📚 Documentation
|
|
129
|
+
|
|
130
|
+
- [Getting Started Guide](./docs/getting-started.md)
|
|
131
|
+
- [API Reference](./docs/api-reference.md)
|
|
132
|
+
- [Security Guide](./docs/security.md)
|
|
133
|
+
- [Performance Optimization](./docs/performance.md)
|
|
134
|
+
- [Plugin Development](./docs/plugins.md)
|
|
135
|
+
- [Deployment Guide](./docs/deployment.md)
|
|
136
|
+
|
|
137
|
+
## 🔧 Configuration
|
|
138
|
+
|
|
139
|
+
XyPriss supports extensive configuration options:
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
interface XyPrissConfig {
|
|
143
|
+
server?: ServerConfig;
|
|
144
|
+
security?: SecurityConfig;
|
|
145
|
+
cache?: CacheConfig;
|
|
146
|
+
cluster?: ClusterConfig;
|
|
147
|
+
performance?: PerformanceConfig;
|
|
148
|
+
plugins?: PluginConfig[];
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
See the [Configuration Guide](./docs/configuration.md) for detailed options.
|
|
153
|
+
|
|
154
|
+
## 🚀 Performance
|
|
155
|
+
|
|
156
|
+
XyPriss is designed for high performance:
|
|
157
|
+
|
|
158
|
+
- **Request Processing**: Up to 50,000+ requests/second
|
|
159
|
+
- **Memory Efficiency**: Optimized memory usage with automatic cleanup
|
|
160
|
+
- **CPU Utilization**: Intelligent load balancing across CPU cores
|
|
161
|
+
- **Caching**: Sub-millisecond cache retrieval times
|
|
162
|
+
|
|
163
|
+
## 🔒 Security
|
|
164
|
+
|
|
165
|
+
Security is built into every aspect of XyPriss:
|
|
166
|
+
|
|
167
|
+
- **Input Validation**: Automatic sanitization and validation
|
|
168
|
+
- **Output Encoding**: XSS protection through secure encoding
|
|
169
|
+
- **SQL Injection Protection**: Parameterized query enforcement
|
|
170
|
+
- **Rate Limiting**: Configurable rate limiting per IP/user
|
|
171
|
+
- **Secure Headers**: Automatic security header injection
|
|
172
|
+
|
|
173
|
+
## 🤝 Contributing
|
|
174
|
+
|
|
175
|
+
We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details.
|
|
176
|
+
|
|
177
|
+
## 📄 License
|
|
178
|
+
|
|
179
|
+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
|
180
|
+
|
|
181
|
+
## 🆘 Support
|
|
182
|
+
|
|
183
|
+
- [Documentation](./docs/)
|
|
184
|
+
- [GitHub Issues](https://github.com/your-org/xypriss/issues)
|
|
185
|
+
- [Discord Community](https://discord.gg/xypriss)
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
**XyPriss** - Ultra-fast, secure, and scalable Node.js framework for modern web applications.
|
|
190
|
+
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ServerFactory = require('./ServerFactory.js');
|
|
4
|
+
var smartRoutes = require('./smart-routes.js');
|
|
5
|
+
var CacheFactory = require('./cache/CacheFactory.js');
|
|
6
|
+
var securityMiddleware = require('./security-middleware.js');
|
|
7
|
+
var performanceMonitor = require('./performance-monitor.js');
|
|
8
|
+
var index = require('./cluster/index.js');
|
|
9
|
+
var quickStart = require('./quick-start.js');
|
|
10
|
+
var safeJsonMiddleware = require('./middleware/safe-json-middleware.js');
|
|
11
|
+
var safeSerializer = require('./mods/toolkit/src/components/fortified-function/serializer/safe-serializer.js');
|
|
12
|
+
var express = require('express');
|
|
13
|
+
var clusterManager = require('./cluster/cluster-manager.js');
|
|
14
|
+
var WorkerManager = require('./cluster/modules/WorkerManager.js');
|
|
15
|
+
var HealthMonitor = require('./cluster/modules/HealthMonitor.js');
|
|
16
|
+
var LoadBalancer = require('./cluster/modules/LoadBalancer.js');
|
|
17
|
+
var IPCManager = require('./cluster/modules/IPCManager.js');
|
|
18
|
+
var MetricsCollector = require('./cluster/modules/MetricsCollector.js');
|
|
19
|
+
var AutoScaler = require('./cluster/modules/AutoScaler.js');
|
|
20
|
+
var ClusterFactory = require('./cluster/modules/ClusterFactory.js');
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.UFSMiddleware = ServerFactory.UFSMiddleware;
|
|
25
|
+
exports.createCacheMiddleware = ServerFactory.createCacheMiddleware;
|
|
26
|
+
exports.createServer = ServerFactory.createServer;
|
|
27
|
+
exports.createServerInstance = ServerFactory.createServerInstance;
|
|
28
|
+
exports.Route = smartRoutes.Route;
|
|
29
|
+
exports.createOptimalCache = CacheFactory.createOptimalCache;
|
|
30
|
+
exports.SecurityMiddleware = securityMiddleware.SecurityMiddleware;
|
|
31
|
+
exports.PerformanceMonitor = performanceMonitor.PerformanceMonitor;
|
|
32
|
+
exports.clusterBuilder = index.clusterBuilder;
|
|
33
|
+
exports.createApiCluster = index.createApiCluster;
|
|
34
|
+
exports.createClusterMiddleware = index.createClusterMiddleware;
|
|
35
|
+
exports.createDevelopmentCluster = index.createDevelopmentCluster;
|
|
36
|
+
exports.createMicroserviceCluster = index.createMicroserviceCluster;
|
|
37
|
+
exports.createProductionCluster = index.createProductionCluster;
|
|
38
|
+
exports.createTestCluster = index.createTestCluster;
|
|
39
|
+
exports.createWebCluster = index.createWebCluster;
|
|
40
|
+
exports.createWorkerCluster = index.createWorkerCluster;
|
|
41
|
+
exports.getRecommendedConfig = index.getRecommendedConfig;
|
|
42
|
+
exports.mergeClusterConfigs = index.mergeClusterConfigs;
|
|
43
|
+
exports.setClusterDefaults = index.setClusterDefaults;
|
|
44
|
+
exports.validateClusterConfig = index.validateClusterConfig;
|
|
45
|
+
exports.withClusterSupport = index.withClusterSupport;
|
|
46
|
+
exports.quickServer = quickStart.quickServer;
|
|
47
|
+
exports.createCircularRefDebugger = safeJsonMiddleware.createCircularRefDebugger;
|
|
48
|
+
exports.createSafeJsonMiddleware = safeJsonMiddleware.createSafeJsonMiddleware;
|
|
49
|
+
exports.safeJsonStringify = safeJsonMiddleware.safeJsonStringify;
|
|
50
|
+
exports.sendSafeJson = safeJsonMiddleware.sendSafeJson;
|
|
51
|
+
exports.setupSafeJson = safeJsonMiddleware.setupSafeJson;
|
|
52
|
+
exports.expressStringify = safeSerializer.expressStringify;
|
|
53
|
+
exports.fastStringify = safeSerializer.fastStringify;
|
|
54
|
+
exports.safeStringify = safeSerializer.safeStringify;
|
|
55
|
+
Object.defineProperty(exports, 'Router', {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () { return express.Router; }
|
|
58
|
+
});
|
|
59
|
+
exports.ClusterManager = clusterManager.ClusterManager;
|
|
60
|
+
exports.WorkerManager = WorkerManager.WorkerManager;
|
|
61
|
+
exports.HealthMonitor = HealthMonitor.HealthMonitor;
|
|
62
|
+
exports.LoadBalancer = LoadBalancer.LoadBalancer;
|
|
63
|
+
exports.IPCManager = IPCManager.IPCManager;
|
|
64
|
+
exports.MetricsCollector = MetricsCollector.MetricsCollector;
|
|
65
|
+
exports.AutoScaler = AutoScaler.AutoScaler;
|
|
66
|
+
exports.ClusterBuilderFactoryImpl = ClusterFactory.ClusterBuilderFactoryImpl;
|
|
67
|
+
exports.ClusterConfigBuilder = ClusterFactory.ClusterConfigBuilder;
|
|
68
|
+
exports.ClusterFactory = ClusterFactory.ClusterFactory;
|
|
69
|
+
exports.buildCluster = ClusterFactory.buildCluster;
|
|
70
|
+
exports.clusterBuilderFactory = ClusterFactory.clusterBuilderFactory;
|
|
71
|
+
exports.clusterFactory = ClusterFactory.clusterFactory;
|
|
72
|
+
exports.createCluster = ClusterFactory.createCluster;
|
|
73
|
+
exports.createClusterForEnvironment = ClusterFactory.createClusterForEnvironment;
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { UFSMiddleware, createCacheMiddleware, createServer, createServerInstance } from './ServerFactory.js';
|
|
2
|
+
export { Route } from './smart-routes.js';
|
|
3
|
+
export { createOptimalCache } from './cache/CacheFactory.js';
|
|
4
|
+
export { SecurityMiddleware } from './security-middleware.js';
|
|
5
|
+
export { PerformanceMonitor } from './performance-monitor.js';
|
|
6
|
+
export { clusterBuilder, createApiCluster, createClusterMiddleware, createDevelopmentCluster, createMicroserviceCluster, createProductionCluster, createTestCluster, createWebCluster, createWorkerCluster, getRecommendedConfig, mergeClusterConfigs, setClusterDefaults, validateClusterConfig, withClusterSupport } from './cluster/index.js';
|
|
7
|
+
export { quickServer } from './quick-start.js';
|
|
8
|
+
export { createCircularRefDebugger, createSafeJsonMiddleware, safeJsonStringify, sendSafeJson, setupSafeJson } from './middleware/safe-json-middleware.js';
|
|
9
|
+
export { expressStringify, fastStringify, safeStringify } from './mods/toolkit/src/components/fortified-function/serializer/safe-serializer.js';
|
|
10
|
+
export { Router } from 'express';
|
|
11
|
+
export { ClusterManager } from './cluster/cluster-manager.js';
|
|
12
|
+
export { WorkerManager } from './cluster/modules/WorkerManager.js';
|
|
13
|
+
export { HealthMonitor } from './cluster/modules/HealthMonitor.js';
|
|
14
|
+
export { LoadBalancer } from './cluster/modules/LoadBalancer.js';
|
|
15
|
+
export { IPCManager } from './cluster/modules/IPCManager.js';
|
|
16
|
+
export { MetricsCollector } from './cluster/modules/MetricsCollector.js';
|
|
17
|
+
export { AutoScaler } from './cluster/modules/AutoScaler.js';
|
|
18
|
+
export { ClusterBuilderFactoryImpl, ClusterConfigBuilder, ClusterFactory, buildCluster, clusterBuilderFactory, clusterFactory, createCluster, createClusterForEnvironment } from './cluster/modules/ClusterFactory.js';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|