|
1 | | -# Nodepp |
| 1 | +# Nodepp: The Unified Asynchronous Real-Time C++ Runtime |
2 | 2 |
|
3 | | -Nodepp is a groundbreaking open-source project that simplifies C++ application development by bridging the gap between the language's raw power and the developer-friendly abstractions of Node.js. By providing a high-level API, Nodepp empowers developers to write C++ code in a familiar, Node.js-inspired style. |
| 3 | +[](https://opensource.org/licenses/MIT) |
| 4 | +[](https://github.com/NodeppOfficial/nodepp) |
| 5 | +[](https://github.com/NodeppOfficial/nodepp/actions) |
| 6 | +[](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/valgrind_benchmark/readme.md) |
4 | 7 |
|
5 | | -One of the standout features of Nodepp is its 100% asynchronous architecture, powered by an internal Event Loop. This design efficiently manages Nodepp’s tasks, enabling you to develop scalable and concurrent applications with minimal code. Experience the power and flexibility of Nodepp as you streamline your development process and create robust applications effortlessly! |
6 | 8 |
|
7 | | -## Dependencies |
8 | | -```bash |
9 | | -# Openssl |
10 | | - 🪟: pacman -S mingw-w64-ucrt-x86_64-openssl |
11 | | - 🐧: sudo apt install libssl-dev |
| 9 | +**Nodepp** is a vertically integrated C++ runtime engineered to eliminate the Hardware Tax in cloud and edge computing. It bridges the gap between high-level developer velocity and low-level mechanical sympathy. |
12 | 10 |
|
13 | | -# Zlib |
14 | | - 🪟: pacman -S mingw-w64-ucrt-x86_64-zlib |
15 | | - 🐧: sudo apt install zlib1g-dev |
16 | 11 | ``` |
17 | | - |
18 | | -## Features |
19 | | - |
20 | | -- 📌: **Node.js-like API:** Write C++ code in a syntax and structure similar to Node.js, making it easier to learn and use. |
21 | | -- 📌: **High-performance:** Leverage the speed and efficiency of C++ for demanding applications. |
22 | | -- 📌: **Scalability:** Build applications that can handle large workloads and grow with your needs. |
23 | | -- 📌: **Open-source:** Contribute to the project's development and customize it to your specific requirements. |
24 | | - |
25 | | -## Bateries Included |
26 | | - |
27 | | -- 📌: Include a **build-in JSON** parser / stringify system. |
28 | | -- 📌: Include a **build-in RegExp** engine for processing text strings. |
29 | | -- 📌: Include Support for **UTF** manipulation | **UTF8 - UTF16 - UTF32** |
30 | | -- 📌: Include a **build-in System** that make every object **Async Task** safety. |
31 | | -- 📌: Include a **Smart Pointer** base **Garbage Collector** to avoid **Memory Leaks**. |
32 | | -- 📌: Include support for **Reactive Programming** based on **Events** and **Observers**. |
33 | | -- 📌: Include an **Event Loop** that can handle multiple events and tasks on a single thread. |
34 | | -- 📌: Include support for **TCP | TLS | UDP | HTTP | WS** making it easy to create networked applications. |
35 | | -- 📌: Include Support for **Poll | Epoll | Kqueue | WSAPoll** making it easy to handle multiple file descriptors. |
36 | | - |
37 | | -## Build & Run |
38 | | -```bash |
39 | | -🐧: g++ -o main main.cpp -O3 -I ./include ; ./main |
40 | | -🪟: g++ -o main main.cpp -O3 -I ./include -lws2_32 ; ./main |
| 12 | +NODEPP UNIFIED ARCHITECTURE: Co-designed components MODEL |
| 13 | +========================================================= |
| 14 | +
|
| 15 | +[ APPLICATION LAYER ] Logic: High-Level Async |
| 16 | + || |
| 17 | ++---------||--------------------------------------------+ |
| 18 | +| || UNIFIED ptr_t DATA CARRIER | |
| 19 | +| || (Zero-Copy / Reference Counted) | |
| 20 | +| \/ | |
| 21 | +| [ PROTOCOL LAYER ] Protocol Layer: HTTP / WS / TLS | |
| 22 | +| || Parser: ptr_t Slicing | |
| 23 | +| || | |
| 24 | +| \/ | |
| 25 | +| [ REACTOR LAYER ] Reactor Layer: kernel_t | |
| 26 | +| || Engine: Epoll/KQUEUE/IOCP/NPOLL | |
| 27 | ++---------||--------------------------------------------+ |
| 28 | + || |
| 29 | + \/ OS Layer: LINUX / WINDOWS / MAC |
| 30 | +[ HARDWARE / KERNEL ] Source: Sockets / Registers |
41 | 31 | ``` |
42 | 32 |
|
43 | | -## Test Unit |
44 | | -```bash |
45 | | -🐧: ( cd ./test; g++ -o main main.cpp -I../include -lssl -lcrypto -lpthread ; ./main ) |
46 | | -🪟: ( cd ./test; g++ -o main main.cpp -I../include -lssl -lcrypto -lws2_32 ; ./main ) |
47 | | -``` |
| 33 | +## 📃 Whitepaper |
48 | 34 |
|
49 | | -## Examples |
50 | | -### Hello world |
51 | | -```cpp |
52 | | -#include <nodepp/nodepp.h> |
| 35 | +[Scaling the Talent Bridge for Green Computing: Achieving Silicon-Logic Parity through Deterministic RAII](https://nodeppofficial.github.io/nodepp-doc/whitepaper) Read the full technical breakdown, including architectural deep-dives into `ptr_t`, `kernel_t` and `coroutine_t`. |
53 | 36 |
|
54 | | -using namespace nodepp; |
| 37 | +## 🌿 Sustainability & Performance (Green Computing) |
55 | 38 |
|
56 | | -void onMain() { |
57 | | - console::log("Hello World!"); |
58 | | -} |
| 39 | +In the post-Moore's Law era, hardware is no longer infinitely cheap. Traditional managed runtimes (Node.js, Go, Java) prioritize abstractions that create a 11,000x Virtual Memory Gap. Nodepp reclaims this efficiency, enabling Resource-Dense Computing where a single node does the work of an entire cluster. |
59 | 40 |
|
60 | | -// note that we are using onMain() instead of main() |
61 | | -``` |
| 41 | +### 📈 Performance Benchmark: HTTP Throughput vs. Resource Tax |
62 | 42 |
|
63 | | -### HTTP Client |
64 | | -```cpp |
65 | | -//#pragma comment(lib, "Ws2_32.lib") msvc compiler |
| 43 | +> **Test:** 100k requests | 1k Concurrency | Environment: Localhost | Device: Educational-grade Dual-Core Apollo lake Chromebook [see benchmark](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/server_benchmark/readme.md) |
66 | 44 |
|
67 | | -#include <nodepp/nodepp.h> |
68 | | -#include <nodepp/http.h> |
| 45 | +| Metric | Bun (v1.3.5) | Go (v1.18.1) | Nodepp (V1.4.0) | Impact | |
| 46 | +| --- | --- | --- | --- | --- | |
| 47 | +| Requests / Sec | 5,985 | 6,139 | 6,851.33 | +11.6% Performance | |
| 48 | +| Memory (RSS) | 69.5 MB | 14.1 MB | 2.9 MB | 95.8% Reduction | |
| 49 | +| Max Latency | 1,452 ms | 326 ms | 245 ms | Elimination of GC Spikes | |
| 50 | +| p99 Latency | 1,159 ms | 249 ms | 187 ms | High-precision SLA stability | |
| 51 | +| Energy Efficiency | Low | Medium | Extreme | Maximum hardware utilization | |
69 | 52 |
|
70 | | -using namespace nodepp; |
| 53 | +### 📈 Performace Benchmark: Resource Management & Latency Jitter Analysis |
71 | 54 |
|
72 | | -void onMain(){ |
| 55 | +> **Test:** 1k Cycles | 100k Allocations | Environment: Educational-grade Dual-Core Apollo lake Chromebook [see benchmark](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/gc_benchmark/readme.md) |
73 | 56 |
|
74 | | - fetch_t args; |
75 | | - args.method = "GET"; |
76 | | - args.url = "http://www.google.com/"; |
77 | | - args.headers = header_t({ |
78 | | - { "Host", url::host(args.url) } |
79 | | - }); |
| 57 | +| Runtime | Avg. Cycle Time | VIRT (Address Space) | RES (Physical RAM) | Memory Model | |
| 58 | +| --- | --- | --- | --- | --- | |
| 59 | +| Nodepp | 3.0 ms (±0.1 ms) | 6.1 MB | 2.7 MB | Deterministic RAII | |
| 60 | +| Bun | 7.2 ms (5-11 ms range) | 69.3 GB | 72.6 MB | Generational GC | |
| 61 | +| Go | < 1.0 ms* | 703.1 MB | 2.2 MB | Concurrent GC | |
80 | 62 |
|
81 | | - http::fetch( args ) |
| 63 | +> **Note:** Go's <1ms measurement reflects allocation latency only; reclamation is deferred to concurrent garbage collection cycles. |
82 | 64 |
|
83 | | - .then([]( http_t cli ){ |
84 | | - console::log( stream::await( cli ) ); |
85 | | - }) |
| 65 | +### 📈 Performace Benchmark: High-Concurrency Benchmark - 100k Task Challenge |
86 | 66 |
|
87 | | - .fail([]( except_t err ){ |
88 | | - console::error( err ); |
89 | | - }); |
| 67 | +> **Test:** 100k asynchronous tasks | Environment: Educational-grade Dual-Core Apollo lake Chromebook [see benchmark](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/task_benchmark/readme.md) |
90 | 68 |
|
91 | | -} |
92 | | -``` |
| 69 | +| Runtime | RSS (Memory) | CPU Load | VIRT Memory | Strategy | |
| 70 | +| --- | --- | --- | --- | --- | |
| 71 | +Nodepp (Balanced) | 59.1 MB | 75.9% | 153 MB | Multi-Worker Pool | |
| 72 | +Nodepp (Single) | 59.0 MB | 59.9% | 62 MB | Single Event Loop | |
| 73 | +Bun | 64.2 MB | 24.2% | 69.3 GB | JavaScriptCore Loop | |
| 74 | +Go | 127.9 MB | 169.4% | 772 MB | Preemptive Goroutines | |
93 | 75 |
|
94 | | -### HTTP Server |
95 | | -```cpp |
96 | | -//#pragma comment(lib, "Ws2_32.lib") msvc compiler |
| 76 | +### 📈 Performace Benchmark: Nodepp Stability & Memory Benchmarks |
| 77 | + |
| 78 | +> **Test:** 4 Valgrind-based stress tests | Environment: Educational-grade Dual-Core Apollo lake Chromebook [see benchmark](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/valgrind_benchmark/readme.md) |
| 79 | +
|
| 80 | +| Test Case | Objective | Iterations / Load | Memory Leaks | Result | |
| 81 | +| --- | --- | --- | --- | --- | |
| 82 | +| Atomic Longevity | High-concurrency HTTP | 100k requests | 0 bytes | PASSED | |
| 83 | +| Rapid Lifecycle | Smart Pointer stress | 1M object cycles | 0 bytes | PASSED | |
| 84 | +| Broken Pipe | Resilience to I/O failure | 100k interruptions | 0 bytes | PASSED | |
| 85 | +| Multi-Thread Atomicity | race conditions stress | 100k Messages * 2 workers | 0 bytes | PASSED | |
| 86 | + |
| 87 | +## ⭐ Architectural Philosophy |
97 | 88 |
|
| 89 | +- **📌: 1. Deterministic RAII (`ptr_t`):** Eliminates the unpredictable latency spikes (Stop-the-World) of Garbage Collectors. By utilizing Small Stack Optimization (SSO) and reference counting, memory is reclaimed with microsecond precision. |
| 90 | + |
| 91 | +- **📌: 2. Cooperative Multitasking (`coroutine_t`):** Stackless coroutines eliminate context-switching overhead. This allows for massive connection density on low-power hardware, from 8-bit industrial sensors to cloud-scale reactors. |
| 92 | + |
| 93 | +- **📌: 3. Platform-Agnostic Reactor (`kernel_t`):** A unified abstraction over native kernel I/O (Epoll, Kqueue, IOCP, and Npoll). It provides a consistent non-blocking interface across Linux, Windows, Mac, and Bare-Metal, ensuring that I/O multiplexing is always native to the silicon. |
| 94 | + |
| 95 | +## 🧭 Quick Start: High-Density HTTP |
| 96 | +Nodepp abstracts complex socket management into a clean, event-driven API. |
| 97 | + |
| 98 | +```cpp |
98 | 99 | #include <nodepp/nodepp.h> |
| 100 | +#include <nodepp/regex.h> |
99 | 101 | #include <nodepp/http.h> |
100 | 102 | #include <nodepp/date.h> |
| 103 | +#include <nodepp/os.h> |
101 | 104 |
|
102 | 105 | using namespace nodepp; |
103 | 106 |
|
104 | | -void onMain(){ |
| 107 | +void onMain() { |
105 | 108 |
|
106 | | - auto server = http::server([=]( http_t cli ){ |
107 | | - |
108 | | - console::log( cli.path, cli.get_fd() ); |
| 109 | + auto server = http::server([]( http_t cli ){ |
109 | 110 | |
110 | 111 | cli.write_header( 200, header_t({ |
111 | 112 | { "content-type", "text/html" } |
112 | | - })); |
113 | | - |
114 | | - cli.write( date::fulltime() ); |
115 | | - cli.close(); // optional | GC automaticaly close unused sockets |
| 113 | + }) ); |
| 114 | + |
| 115 | + cli.write( regex::format( R"( |
| 116 | + <h1> hello world </h1> |
| 117 | + <h2> ${0} </h2> |
| 118 | + )", date::fulltime() )); |
| 119 | + |
| 120 | + cli.close(); |
116 | 121 |
|
117 | 122 | }); |
118 | 123 |
|
119 | | - server.listen( "localhost", 8000, [=]( socket_t server ){ |
120 | | - console::log("server started at http://localhost:8000"); |
| 124 | + server.listen( "0.0.0.0", 8000, []( socket_t /*unused*/ ){ |
| 125 | + console::log("Server listening on port 8000"); |
121 | 126 | }); |
122 | 127 |
|
123 | 128 | } |
124 | 129 | ``` |
125 | 130 |
|
126 | | -### More Examples [here](https://github.com/NodeppOfficial/Nodepp/tree/main/examples) |
127 | | - |
128 | | -## Projects made with NodePP |
129 | | -- 🔗: [Draw on your PC using your smartphone](https://github.com/ScreenDraw/PCDraw) |
130 | | -- 🔗: [Simple multiplayer Game With Raylib](https://medium.com/@EDBCBlog/create-your-own-online-multiplayer-small-fast-and-fun-with-raylib-nodepp-and-websockets-190f5c174094) |
131 | | -- 🔗: [Cursed Luna - A simple Raylib Game](https://github.com/EDBCREPO/Space-Shocker) |
132 | | -- 🔗: [Smart Card Reader(Nodepp-Arduino)](https://github.com/EDBCREPO/emv-reader) |
133 | | -- 🔗: [Serial Port arduino using Nodepp](https://github.com/EDBCREPO/Arduino_PC) |
134 | | -- 🔗: [Simple Raylib Real-Time Chat](https://github.com/EDBCREPO/simple-raylib-websocket-chat) |
135 | | -- 🔗: [Simple Bitget Trading Bot](https://github.com/EDBCREPO/simple-binance-bot-nodepp) |
136 | | - |
137 | | -Check out some articles on [Medium](https://medium.com/@EDBCBlog) |
138 | | - |
139 | | -## Compatibility |
140 | | -- 🔗: [NodePP for Window | Linux | Mac | Bsd ](https://github.com/NodeppOfficial/nodepp) |
141 | | -- 🔗: [NodePP for Arduino](https://github.com/NodeppOfficial/nodepp-arduino) |
142 | | -- 🔗: [Nodepp for WASM](https://github.com/NodeppOfficial/nodepp-wasm) |
143 | | - |
144 | | -## Official Libraries for Nodepp |
145 | | -- 🔗: [ExpressPP](https://github.com/NodeppOfficial/nodepp-express) -> Express equivalent for Nodepp |
146 | | -- 🔗: [ApifyPP](https://github.com/NodeppOfficial/nodepp-apify) -> Socket.io equivalent for Nodepp |
147 | | -- 🔗: [SerialPP](https://github.com/NodeppOfficial/nodepp-serial) -> Serial Port for Nodepp |
148 | | -- 🔗: [Argon2](https://github.com/NodeppOfficial/nodepp-argon2) -> Argon2 for Nodepp |
149 | | -- 🔗: [Torify](https://github.com/NodeppOfficial/nodepp-torify) -> HTTP|Ws over Tor |
150 | | -- 🔗: [NginxPP](https://github.com/NodeppOfficial/nodepp-nginx) -> Reverse Proxy |
151 | | -- 🔗: [InputPP](https://github.com/NodeppOfficial/nodepp-input) -> Fake Inputs |
152 | | -- 🔗: [JWT](https://github.com/NodeppOfficial/nodepp-jwt) -> JSON Web Token |
153 | | -- 🔗: [NmapPP](https://github.com/NodeppOfficial/nodepp-nmap) -> Scan IPs and Ports |
154 | | -- 🔗: [Redis](https://github.com/NodeppOfficial/nodepp-redis) -> Redis Client for Nodepp |
155 | | -- 🔗: [Sqlite](https://github.com/NodeppOfficial/nodepp-sqlite) -> Sqlite Client for Nodepp |
156 | | -- 🔗: [MariaDB](https://github.com/NodeppOfficial/nodepp-mariadb) -> MariaDB Client for Nodepp |
157 | | -- 🔗: [Postgres](https://github.com/NodeppOfficial/nodepp-postgres) -> Postgres Client for Nodepp |
158 | | - |
159 | | -## Contribution |
160 | | - |
161 | | -If you want to contribute to **Nodepp**, you are welcome to do so! You can contribute in several ways: |
162 | | - |
163 | | -- ☕ Buying me a Coffee |
164 | | -- 📢 Reporting bugs and issues |
165 | | -- 📝 Improving the documentation |
166 | | -- 📌 Adding new features or improving existing ones |
167 | | -- 🧪 Writing tests and ensuring compatibility with different platforms |
168 | | -- 🔍 Before submitting a pull request, make sure to read the contribution guidelines. |
| 131 | +## 🛟 Ecosystem |
169 | 132 |
|
170 | | -[](https://ko-fi.com/edbc_repo) |
| 133 | +The Nodepp project is supported by a suite of modular extensions designed to follow the same unified design patterns: |
| 134 | + |
| 135 | +- **📌: Data Parsing:** [XML](https://github.com/NodeppOfficial/nodepp-xml) |
| 136 | +- **📌: Tor:** [Torify](https://github.com/NodeppOfficial/nodepp-torify), [JWT](https://github.com/NodeppOfficial/nodepp-jwt). |
| 137 | +- **📌: Security:** [Argon2](https://github.com/NodeppOfficial/nodepp-argon2), |
| 138 | +- **📌: Web:** [ExpressPP](https://github.com/NodeppOfficial/nodepp-express), [ApifyPP](https://github.com/NodeppOfficial/nodepp-apify). |
| 139 | +- **📌: IoT/Embedded:** [SerialPort](https://github.com/NodeppOfficial/nodepp-serial), [Bluetooth](https://github.com/NodeppOfficial/nodepp-bluetooth). |
| 140 | +- **📌: Databases:** [Redis](https://github.com/NodeppOfficial/nodepp-redis), [Postgres](https://github.com/NodeppOfficial/nodepp-postgres), [MariaDB](https://github.com/NodeppOfficial/nodepp-mariadb), [Sqlite](https://github.com/NodeppOfficial/nodepp-sqlite). |
| 141 | + |
| 142 | +## 🌐 One Codebase, Every Platform |
| 143 | +Nodepp is the only framework that lets you share logic between the deepest embedded layers and the highest web layers. |
| 144 | + |
| 145 | +- **📌: Hardware:** [NodePP for Arduino](https://github.com/NodeppOfficial/nodepp-arduino) |
| 146 | +- **📌: Desktop:** [Nodepp for Desktop](https://github.com/NodeppOfficial/nodepp) |
| 147 | +- **📌: Browser:** [Nodepp for WASM](https://github.com/NodeppOfficial/nodepp-wasm) |
| 148 | +- **📌: IOT:** [ Nodepp for ESP32 ](https://github.com/NodeppOfficial/nodepp-esp32) |
171 | 149 |
|
172 | | -## License |
| 150 | +## ❤️🩹 Contributing |
| 151 | + |
| 152 | +Nodepp is an open-source project that values Mechanical Sympathy and Technical Excellence. |
| 153 | + |
| 154 | +- **📌: Sponsorship:** Support the project via [Ko-fi](https://ko-fi.com/edbc_repo). |
| 155 | +- **📌: Bug Reports:** Open an issue via GitHub. |
| 156 | +- **📌: License:** MIT. |
| 157 | + |
| 158 | +[](https://ko-fi.com/edbc_repo) |
173 | 159 |
|
174 | | -**Nodepp** is distributed under the MIT License. See the LICENSE file for more details. |
| 160 | +## 🛡️ License |
| 161 | +**Nodepp** is distributed under the MIT License. See the LICENSE file for more details. |
0 commit comments