nexurejs v0.1.9
NexureJS
A high-performance, lightweight Node.js framework with native C++ modules for maximum speed.
Features
- High Performance: Optimized for speed with native C++ modules
- Cross-Platform: Fully supported on Linux, macOS, and Windows
- Lightweight: Minimal dependencies and small footprint
- Modern: Built with TypeScript and modern JavaScript features
- Flexible: Modular design allows for easy customization
- Developer-Friendly: Clear API and comprehensive documentation
Native Modules
NexureJS includes native C++ modules for performance-critical operations:
- HTTP Parser: Ultra-fast HTTP request parsing
- Radix Router: Efficient route matching and parameter extraction
- JSON Processor: High-performance JSON parsing and stringification
These native modules can provide up to 10x performance improvement over pure JavaScript implementations. Native modules are enabled by default for maximum performance.
Cross-Platform Support
NexureJS is fully tested and supported on:
- Linux (Ubuntu, Debian, etc.)
- macOS (Intel and Apple Silicon)
- Windows (10, 11)
Prebuilt binaries are available for common platforms and architectures, with automatic fallback to building from source when needed.
Installation
npm install nexurejs
The installation process will attempt to download pre-built binaries for your platform. If no pre-built binary is available, it will build from source (requires a C++ compiler and node-gyp).
Quick Start
import { createServer } from 'nexurejs';
const app = createServer();
app.get('/', (req, res) => {
res.send('Hello, NexureJS!');
});
app.get('/users/:id', (req, res) => {
res.json({ userId: req.params.id, message: 'User details' });
});
app.listen(3000, () => {
console.log('Server running on http://localhost:3000');
});
Native Module Configuration
You can configure the native modules behavior:
import { configureNativeModules } from 'nexurejs/native';
// Configure native modules
configureNativeModules({
enabled: true, // Enable/disable all native modules (default: true)
verbose: false, // Enable/disable verbose logging (default: false)
maxCacheSize: 1000 // Maximum size for route cache (default: 1000)
});
Performance Metrics
NexureJS includes built-in performance metrics:
import { getAllPerformanceMetrics, resetAllPerformanceMetrics } from 'nexurejs/native';
// Reset metrics before tests
resetAllPerformanceMetrics();
// Run your application...
// Get performance metrics
const metrics = getAllPerformanceMetrics();
console.log(metrics);
Building from Source
If you want to build the native modules from source:
npm run build:native
For development and testing:
npm run build:native:test
Examples
Check out the examples directory for more usage examples:
- Basic server setup (
npm run example:basic
) - Middleware usage (
npm run example:middleware
) - Performance optimization (
npm run example:performance
) - Native module usage (
npm run example:native
) - Security best practices (
npm run example:security
)
Benchmarks
Run benchmarks to compare performance:
npm run benchmark # Run all benchmarks
npm run benchmark:http # HTTP parser benchmark
npm run benchmark:json # JSON processor benchmark
npm run benchmark:native # Compare native vs JavaScript implementations
Documentation
For detailed documentation, see the docs directory:
Requirements
- Node.js 18.0.0 or later
- For building native modules:
- C++ compiler (GCC, Clang, or MSVC)
- Python 2.7 or 3.x
- node-gyp
Platform-Specific Requirements
Windows:
- Visual Studio Build Tools
- Windows-build-tools (
npm install --global --production windows-build-tools
)
macOS:
- Xcode Command Line Tools (
xcode-select --install
)
Linux:
- build-essential package (
sudo apt-get install build-essential
) - Python 3 (
sudo apt-get install python3
)
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
Releasing
NexureJS follows Semantic Versioning for releases.
To create a new release:
# For patch releases (bug fixes)
npm run release:patch
# For minor releases (new features)
npm run release:minor
# For major releases (breaking changes)
npm run release:major
# For a specific version
npm run release 1.2.3
The release script handles version bumping, changelog updates, git tagging, GitHub releases, prebuilt binary uploads, and npm publishing.
For detailed information about the release process, see Release Documentation.
License
MIT
Acknowledgments
- Inspired by frameworks like Express, Fastify, and NestJS
- Built with modern Node.js and TypeScript best practices
- Optimized with lessons from high-performance C++ and Rust frameworks