1+ # Vix.cpp
2+
13<p align =" center " style =" margin :0 ;" >
24 <img
35 src="https://res.cloudinary.com/dwjbed2xb/image/upload/v1762524350/vixcpp_etndhz.png "
2022 <img src =" https://img.shields.io/badge/License-MIT-green " >
2123</p >
2224
23- ** Vix.cpp** is a next-generation ** modular C++ backend framework** — inspired by ** FastAPI** , ** Vue.js** , and ** React.js** .
24- It brings modern developer ergonomics, productivity, and extreme performance to native C++ — with a fully modular design.
25+ ---
26+
27+ # 🌍 What is Vix?
28+
29+ ** Vix** is a next-generation ** offline-first, peer-to-peer, ultra-fast runtime for modern C++** .
30+
31+ Its goal is clear:
32+
33+ > ** A runtime capable of running apps like Node / Deno / Bun —
34+ > but engineered for unstable, low-quality, real-world networks.**
35+
36+ Vix is more than a backend framework:
37+ it is a ** modular runtime** , designed for distributed applications, edge systems, offline devices, and environments where traditional cloud frameworks fail.
38+
39+ Inspired by ** FastAPI** , ** Vue.js** , ** React** , and modern runtimes — but rebuilt from scratch in C++20 for raw speed and full control.
2540
2641---
2742
28- ## ⚡ Benchmarks
43+ # ⚡ Benchmarks
2944
3045All benchmarks were executed using ** wrk**
3146` 8 threads ` , ` 200 connections ` , for ` 30 seconds ` , on the same machine (Ubuntu 24.04, Intel Xeon, C++20 build).
3247
3348| Framework | Requests/sec | Avg Latency | Transfer/sec |
3449| --------------------- | ------------ | ----------- | -------------- |
35- | ** Vix.cpp (v1.10.1 )** | ** 88,973** | ** 2.21 ms** | ** 18.25 MB/s** |
50+ | ** Vix.cpp (v1.10.3 )** | ** 88,973** | ** 2.21 ms** | ** 18.25 MB/s** |
3651| Go (Fiber) | 81,336 | 0.67 ms | 10.16 MB/s |
3752| Node.js (Fastify) | 4,220 | 16.00 ms | 0.97 MB/s |
3853| PHP (Slim) | 2,804 | 16.87 ms | 0.49 MB/s |
3954| Crow (C++) | 1,149 | 41.60 ms | 0.35 MB/s |
4055| FastAPI (Python) | 752 | 63.71 ms | 0.11 MB/s |
4156
42- ⚙️ Tested with: ` wrk -t8 -c200 -d30s http://localhost:8080/ `
43- 🧩 Environment: Ubuntu 24.04, GCC 13, Asio standalone (no Boost).
44-
4557---
4658
47- ## 🧭 Quick Example
59+ # 🧭 Quick Example
4860
4961``` cpp
5062#include < vix.hpp>
@@ -53,36 +65,54 @@ using namespace Vix;
5365int main () {
5466 App app;
5567
56- // GET /
5768 app.get("/", [](auto&, auto& res) {
58- res.json({
59- "message", "Hello world"
60- });
69+ res.json({ "message", "Hello world" });
6170 });
6271
6372 app.run(8080);
6473}
6574```
6675
67- Run benchmark locally:
76+ ---
6877
69- ``` bash
70- wrk -t8 -c200 -d30s --latency http://localhost:8080/
71- ```
78+ # 🧱 Why Vix Exists
79+
80+ Cloud-first frameworks assume:
81+
82+ - stable networks
83+ - predictable latency
84+ - always-online connectivity
85+
86+ ** But in most of the world, this is not reality.**
87+
88+ Vix is built for:
89+
90+ ### ✔ Offline-first
91+
92+ Applications continue functioning even without internet.
93+
94+ ### ✔ Peer-to-Peer
95+
96+ Nodes sync and communicate locally without a central server.
97+
98+ ### ✔ Ultra-Fast Native Execution
99+
100+ C++20 + Asio + zero-overhead abstractions.
72101
73102---
74103
75- ## 🧩 Key Features
104+ # 🧩 Key Features
76105
77- - ✅ ** Modern C++20** — clean syntax, type safety, RAII
78- - ⚙️ ** Async HTTP server** — powered by standalone Asio
79- - 🧭 ** Routing system** — expressive path parameters (` /users/{id} ` )
80- - 💾 ** ORM for MySQL/SQLite** — repository & query builder patterns
81- - 🧠 ** Middleware support** — logging, validation, sessions
82- - 💡 ** JSON-first design** — integrates ` nlohmann::json ` with helpers
83- - 🧰 ** Modular architecture** — core, cli, utils, orm, middleware, websocket
84- - ⚡ ** High performance** — 80k+ requests/sec on commodity hardware
85- - 🪶 ** Header-only modules** — easy to embed in any C++ project
106+ - 🌍 Offline-first runtime
107+ - 🔗 P2P-ready communication model
108+ - ⚙️ Async HTTP server
109+ - 🧭 Expressive routing
110+ - 💾 ORM for MySQL/SQLite
111+ - 🧠 Middleware system
112+ - 📡 WebSocket engine
113+ - 🧰 Modular design
114+ - 🚀 Developer experience similar to Node/Deno/Bun
115+ - ⚡ 80k+ requests/sec performance
86116
87117---
88118
@@ -98,12 +128,6 @@ cmake --build build -j
98128./build/hello_routes
99129```
100130
101- > For full installation steps (Windows, Linux, macOS):
102- > 📘 [ docs/installation.md] ( ./docs/installation.md )
103-
104- > For build flags, packaging, and sanitizers:
105- > ⚙️ [ docs/build.md] ( ./docs/build.md )
106-
107131---
108132
109133## 🧰 Example (CLI Project)
@@ -125,25 +149,56 @@ Expected output:
125149
126150---
127151
152+ # 🎯 Script Mode — Run ` .cpp ` Files Directly
153+
154+ Vix can execute a single ` .cpp ` file ** like a script** , without creating a full project.
155+
156+ ``` bash
157+ vix run file.cpp
158+ ```
159+
160+ ### ✔ How it works
161+
162+ - Generates a temporary CMake project under:
163+ ` ./.vix-scripts/<filename>/ `
164+ - Compiles the ` .cpp ` file as a standalone executable
165+ - Runs it immediately
166+ - Stops cleanly on Ctrl+C (no gmake noise)
167+
168+ ### Example:
169+
170+ ``` bash
171+ ~ /myapp/test$ vix run server.cpp
172+ Script mode: compiling server.cpp
173+ Using script build directory:
174+ • .vix-scripts/server
175+
176+ ✔ Build succeeded
177+ [I] Server running on port 8080
178+ ^C
179+ ℹ Server interrupted by user (SIGINT)
180+ ```
181+
182+ ---
183+
128184## 📚 Documentation
129185
130- - 🧭 [ Introduction] ( ./docs/introduction.md )
131- - ⚡ [ Quick Start] ( ./docs/quick-start.md )
132- - 🧱 [ Architecture & Modules] ( ./docs/architecture.md )
133- - 💾 [ ORM Overview] ( ./docs/orm/overview.md )
134- - 📈 [ Benchmarks] ( ./docs/benchmarks.md )
135- - 🧰 [ Examples] ( ./docs/examples/overview.md )
186+ - 🧭 Introduction
187+ - ⚡ Quick Start
188+ - 🧱 Architecture & Modules
189+ - 💾 ORM Overview
190+ - 📈 Benchmarks
191+ - 🧰 Examples
136192
137193---
138194
139195## 🤝 Contributing
140196
141197Contributions are welcome!
142- See [ CONTRIBUTING.md ] ( ./CONTRIBUTING.md ) for details .
198+ Please read the contributing guidelines .
143199
144200---
145201
146202## 🪪 License
147203
148- Licensed under the ** MIT License** .
149- See [ LICENSE] ( ./LICENSE ) for more information.
204+ Licensed under the ** MIT License** .
0 commit comments