Skip to content

Commit fe3ed89

Browse files
committed
📌 Nodepp | Stable Version | V1.4.0 📌
1 parent fe9c8e4 commit fe3ed89

223 files changed

Lines changed: 10792 additions & 6081 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/FUNDING.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# These are supported funding model platforms
2+
3+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: edbc_repo # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12+
polar: # Replace with a single Polar username
13+
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14+
thanks_dev: # Replace with a single thanks.dev username
15+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/main.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Nodepp C++ Cross-Platform CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build_and_test:
11+
# 1. Define the runners for the matrix strategy
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
17+
# 2. Use the matrix variable to set the runner OS
18+
runs-on: ${{ matrix.os }}
19+
20+
steps:
21+
- name: ⬇️ Checkout code
22+
uses: actions/checkout@v4
23+
24+
# --- 🧪 Unit Test Compilation and Run ---
25+
26+
- name: 🧪 Unit Test (Linux/macOS)
27+
# Uses -lssl -lcrypto -lpthread flags
28+
if: runner.os != 'Windows'
29+
run: |
30+
echo "Running Unix-like Unit Test build..." ; cd ./test
31+
g++ -o main main.cpp -I../include -lpthread ; ./main
32+
33+
- name: 🧪 Unit Test (Windows)
34+
# Uses -lssl -lcrypto -lws2_32 flags
35+
if: runner.os == 'Windows'
36+
run: |
37+
echo "Running Windows Unit Test build..." ; cd ./test
38+
g++ -o main main.cpp -I../include -lws2_32; ./main.exe
39+
40+
# --- End of the workflow ---

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
image.jpg
2+
main.exe
3+
build
4+
main

CMakeLists.txt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
cmake_minimum_required(VERSION 4.0.0)
1+
cmake_minimum_required(VERSION 3.10)
2+
project(nodepp VERSION 1.3.0)
23

3-
project(nodepp VERSION 1.0.0)
4-
5-
set(CMAKE_CXX_STANDARD 17)
4+
set(CMAKE_CXX_STANDARD 11)
65
set(CMAKE_CXX_STANDARD_REQUIRED ON)
76
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
8-
97
set(NODEPP_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
108

11-
# Search for OpenSSL
9+
# Search for Dependencies
1210
find_package(OpenSSL REQUIRED COMPONENTS Crypto SSL)
13-
if(NOT OpenSSL_FOUND)
14-
message(FATAL_ERROR "OpenSSL not found. Please install OpenSSL development files.")
15-
endif()
16-
17-
# Search for ZLIB
11+
find_package(Threads REQUIRED)
1812
find_package(ZLIB REQUIRED)
19-
if(NOT ZLIB_FOUND)
20-
message(FATAL_ERROR "ZLIB not found. Please install ZLIB development files.")
21-
endif()
13+
14+
# interface-target
15+
add_library(nodepp INTERFACE)
16+
target_include_directories(nodepp INTERFACE ${NODEPP_INCLUDE_DIR})
17+
target_link_libraries(nodepp INTERFACE
18+
Threads::Threads
19+
OpenSSL::Crypto
20+
OpenSSL::SSL
21+
ZLIB::ZLIB
22+
$<$<OR:$<BOOL:${MSVC}>,$<STREQUAL:${CMAKE_SYSTEM_NAME},Windows>>:ws2_32> )

README.md

Lines changed: 118 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,174 +1,161 @@
1-
# Nodepp
1+
# Nodepp: The Unified Asynchronous Real-Time C++ Runtime
22

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+
[![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4+
[![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20Windows%20%7C%20WASM-blue)](https://github.com/NodeppOfficial/nodepp)
5+
[![Build Status](https://github.com/NodeppOfficial/nodepp/actions/workflows/main.yml/badge.svg)](https://github.com/NodeppOfficial/nodepp/actions)
6+
[![Valgrind Memory Test](https://img.shields.io/badge/memory-zero_leaks-green)](https://github.com/NodeppOfficial/nodepp/blob/main/benchmark/valgrind_benchmark/readme.md)
47

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!
68

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.
1210

13-
# Zlib
14-
🪟: pacman -S mingw-w64-ucrt-x86_64-zlib
15-
🐧: sudo apt install zlib1g-dev
1611
```
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
4131
```
4232

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
4834

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`.
5336

54-
using namespace nodepp;
37+
## 🌿 Sustainability & Performance (Green Computing)
5538

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.
5940

60-
// note that we are using onMain() instead of main()
61-
```
41+
### 📈 Performance Benchmark: HTTP Throughput vs. Resource Tax
6242

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)
6644
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 |
6952

70-
using namespace nodepp;
53+
### 📈 Performace Benchmark: Resource Management & Latency Jitter Analysis
7154

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)
7356
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 |
8062

81-
http::fetch( args )
63+
> **Note:** Go's <1ms measurement reflects allocation latency only; reclamation is deferred to concurrent garbage collection cycles.
8264
83-
.then([]( http_t cli ){
84-
console::log( stream::await( cli ) );
85-
})
65+
### 📈 Performace Benchmark: High-Concurrency Benchmark - 100k Task Challenge
8666

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)
9068
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 |
9375

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
9788

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
9899
#include <nodepp/nodepp.h>
100+
#include <nodepp/regex.h>
99101
#include <nodepp/http.h>
100102
#include <nodepp/date.h>
103+
#include <nodepp/os.h>
101104

102105
using namespace nodepp;
103106

104-
void onMain(){
107+
void onMain() {
105108

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 ){
109110
110111
cli.write_header( 200, header_t({
111112
{ "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();
116121

117122
});
118123

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");
121126
});
122127

123128
}
124129
```
125130

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
169132

170-
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](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)
171149

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+
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/edbc_repo)
173159

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

Comments
 (0)