@@ -76,7 +76,6 @@ int main()
7676 auto db = vix::db::Database::sqlite("app.db");
7777
7878 db.exec("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)");
79-
8079 db.exec("INSERT INTO users (name) VALUES (?)", "Ada");
8180
8281 auto rows = db.query("SELECT id, name FROM users");
@@ -89,33 +88,39 @@ int main()
8988 label : "WebSocket" ,
9089 lang : "cpp" ,
9190 file : "ws.cpp" ,
92- code : `#include <vix/websocket.hpp>
91+ code : `#include <vix/websocket/Runtime .hpp>
9392
9493int main()
9594{
96- vix::websocket::Server ws;
95+ vix::config::Config config{".env"};
96+ auto executor = std::make_shared<vix::executor::RuntimeExecutor>(1u);
97+ vix::websocket::Server ws{config, executor};
9798
98- ws.on_text ([](auto&, std::string_view msg) {
99- // realtime messaging
99+ ws.on_message ([](auto &, const std::string & msg) {
100+ // realtime message
100101 });
101102
102- ws.listen_blocking(9090 );
103+ ws.listen_blocking();
103104}` ,
104105 } ,
105106 {
106107 key : "p2p" ,
107108 label : "P2P" ,
108109 lang : "cpp" ,
109110 file : "p2p.cpp" ,
110- code : `#include <vix/p2p/P2P .hpp>
111+ code : `#include <vix/p2p/all .hpp>
111112
112113int main()
113114{
114- vix::p2p::P2PRuntime p2p;
115- p2p.listen(9001);
115+ vix::p2p::NodeConfig cfg;
116+ cfg.node_id = "node-a";
117+ cfg.listen_port = 9001;
118+
119+ auto node = vix::p2p::make_tcp_node(cfg);
120+ vix::p2p::P2PRuntime p2p(node);
116121
117122 p2p.start();
118- p2p.wait ();
123+ p2p.stop ();
119124}` ,
120125 } ,
121126 ] ,
@@ -137,19 +142,22 @@ int main()
137142 "Write a C++ file, run it directly, and move from prototype to real application without fighting the build system first." ,
138143 visual : {
139144 fileName : "main.cpp" ,
140- code : `<span class="cpp-directive">#include</span> <span class="cpp-include"><iostream></span>
145+ code : `<span class="cpp-directive">#include</span> <span class="cpp-include"><vix/print.hpp></span>
146+
147+ <span class="cpp-keyword">int</span> <span class="cpp-fn">main</span>()
148+ std::vector<<span class="cpp-keyword">int</span>> ports{8080, 9090, 3000};
149+ vix::print(<span class="cpp-string">"Vix is ready"</span>);
141150
142- <span class="cpp-keyword">int</span> <span class="cpp-fn">main</span>() {
143- std::cout << <span class="cpp-string">"Hello, Vix!"</span> << "\n";
144- <span class="cpp-keyword">return</span> 0;
151+ vix::print(<span class="cpp-string">"ports:"</span>, ports);
145152}` ,
146153 terminal : `<span class="shell-prompt">$</span> <span class="shell-cmd">vix run</span> main.cpp
147- Hello, Vix!` ,
154+ Vix is ready
155+ ports: [8080, 9090, 3000]` ,
148156 } ,
149157 content : {
150158 title : "Write. Run. Ship." ,
151159 badge : "C++ runtime" ,
152- text : "Vix removes the early friction from C++ development. Start with a single file, then grow into projects, packages, servers, realtime systems, and production binaries." ,
160+ text : "Vix removes the early friction from C++ development. Start with a single file, run it directly, then grow into projects, packages, servers, realtime systems, and production binaries." ,
153161 cta : {
154162 label : "More about vix run" ,
155163 to : "https://docs.vixcpp.com/modules/cli/run" ,
@@ -168,25 +176,66 @@ Hello, Vix!`,
168176 cards : {
169177 top : {
170178 fileName : "main.cpp" ,
171- code : `<span class="cpp-directive">#include</span> <span class="cpp-include"><pdf/pdf .hpp></span>
179+ code : `<span class="cpp-directive">#include</span> <span class="cpp-include"><cnerium/app/app .hpp></span>
172180
173- <span class="cpp-keyword">int</span> <span class="cpp-fn">main</span>() {
174- pdf::Document doc;
175- <span class="cpp-keyword">auto</span>& page = doc.add_page();
176- page.text(50, 759, <span class="cpp-string">"Hello, world!"</span>, pdf::Font::Helvetica, 24);
177- doc.save(<span class="cpp-string">"hello.pdf"</span>);
181+ <span class="cpp-keyword">int</span> <span class="cpp-fn">main</span>()
182+ {
183+ cnerium::app::App app;
184+ app.listen(<span class="cpp-string">"127.0.0.1"</span>, <span class="cpp-type">8080</span>);
178185}` ,
179186 } ,
180187 bottom : {
181188 fileName : "terminal" ,
182- code : `<span class="shell-path">~$</span> <span class="shell-cmd">vix add</span> <span class="shell-flag">@gk/pdf</span>
183- <span class="shell-success">✔ added:</span> gk/pdf@0.1.0
184-
185- <span class="shell-path">~$</span> <span class="shell-cmd">vix install</span>
186- <span class="shell-success">✔ Dependencies ready</span>
189+ code : `<span class="shell-path">~$</span> <span class="shell-cmd">vix install</span> <span class="shell-flag">-g</span> cnerium/app
190+ <span class="shell-success">✔</span> Installed cnerium/app
187191
188192<span class="shell-path">~$</span> <span class="shell-cmd">vix run</span> main.cpp
189- <span class="shell-success">✔ hello.pdf generated</span>` ,
193+ <span class="shell-success">✔</span> Running on 127.0.0.1:8080` ,
194+ } ,
195+ } ,
196+ } ,
197+
198+ templateEngine : {
199+ title : "Built-in template engine" ,
200+ subtitle :
201+ "Render dynamic HTML from C++ with variables, loops, conditions, includes, layouts, caching, and streaming." ,
202+ badge : "Template" ,
203+ cta : {
204+ label : "Read template docs" ,
205+ to : "https://docs.vixcpp.com/modules/template" ,
206+ } ,
207+ cards : {
208+ template : {
209+ fileName : "index.html" ,
210+ code : `<span class="tpl-tag"><h1></span>{{ title }}<span class="tpl-tag"></h1></span>
211+
212+ <span class="tpl-tag"><ul></span>
213+ {% for feature in features %}
214+ <span class="tpl-tag"><li></span>{{ feature }}<span class="tpl-tag"></li></span>
215+ {% endfor %}
216+ <span class="tpl-tag"></ul></span>` ,
217+ } ,
218+ cpp : {
219+ fileName : "main.cpp" ,
220+ code : `<span class="cpp-directive">#include</span> <span class="cpp-include"><vix.hpp></span>
221+ <span class="cpp-keyword">using namespace</span> vix;
222+
223+ <span class="cpp-keyword">int</span> <span class="cpp-fn">main</span>()
224+ {
225+ App app;
226+ app.templates(<span class="cpp-string">"./views"</span>);
227+
228+ app.get(<span class="cpp-string">"/"</span>, [](Request &, Response &res) {
229+ vix::template_::Context ctx;
230+ ctx.set(<span class="cpp-string">"title"</span>, <span class="cpp-string">"Template Features"</span>);
231+ vix::template_::Array features;
232+ features.emplace_back(<span class="cpp-string">"Built-in template engine"</span>);
233+ ctx.set(<span class="cpp-string">"features"</span>, features);
234+ res.render(<span class="cpp-string">"index.html"</span>, ctx);
235+ });
236+
237+ app.run(<span class="cpp-type">8080</span>);
238+ }` ,
190239 } ,
191240 } ,
192241 } ,
@@ -331,6 +380,7 @@ $ cat vix.lock`,
331380 "Create a project, start dev mode, and begin building native backend, realtime, CLI, or systems applications with Vix." ,
332381 code : `vix new api
333382cd api
383+ vix build
334384vix dev` ,
335385 note : "Start with dev mode, then move to run, package, registry, and deployment workflows as your project grows." ,
336386 ctas : [
0 commit comments