Skip to content

vixcpp/examples – Example applications demonstrating real-world usage of vix.cpp: Todo API, Blog, and Chat with WebSockets.

License

Notifications You must be signed in to change notification settings

vixcpp/examples

Repository files navigation

Vix.cpp Runtime examples

Vix.cpp Banner

Vix.cpp

vixcpp/examples – Example applications demonstrating real-world usage of vix.cpp: Todo API, Blog, and Chat with WebSockets.

🚀 Getting Started

To build Vix.cpp from source:

🐧 Linux / Ubuntu

Prerequisites

sudo apt update
sudo apt install -y \
  g++-12 cmake make git \                # Build tools
  libboost-all-dev \                     # Boost (asio, beast)
  nlohmann-json3-dev \                   # JSON (nlohmann/json)
  libspdlog-dev \                        # Logging (spdlog)
  zlib1g-dev \                           # gzip / ZLIB
  libmysqlcppconn-dev                   # Optional: MySQL Connector/C++ for ORM

Optional dependencies:

sudo apt install -y libmysqlcppconn-dev libsqlite3-dev

🍎 macOS

Prerequisites

Install Homebrew first, then:

brew install cmake ninja llvm boost nlohmann-json spdlog fmt mysql sqlite3 zlib
export ZLIB_ROOT="$(brew --prefix zlib)"

Build

git clone https://github.com/vixcpp/vix.git
cd vix
git submodule update --init --recursive
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
sudo cmake --install build --prefix /usr/local

This builds the Vix runtime and CLI.
Make sure the resulting vix binary is available in your PATH.

Watch mode (vix dev)

Runs the file in watch mode.
Vix recompiles and restarts automatically when the file changes.

~/dev/scripts$ vix dev main.cpp
Starting Vix dev mode.
➜ Tip: use `Ctrl+C` to stop dev mode; edit your files and Vix will rebuild & restart automatically.
Watcher Process started (hot reload).
➜ Watching: /home/softadastra/dev/scripts/main.cpp
🏃 Script started (pid=125953)
Hello, world

✔ How Script Mode Works

When running a .cpp file directly, Vix:

  • Creates a temporary build directory under:
    ./.vix-scripts/<filename>/
    
  • Generates a minimal CMake project internally
  • Compiles the file as a standalone executable
  • Runs it immediately
  • In dev mode:
    • Watches the source file
    • Rebuilds and restarts automatically on changes
  • Stops cleanly on Ctrl+C (no noisy build output)

Mental model

Command Behavior
vix run main.cpp Compile → run once
vix dev main.cpp Compile → run → watch & hot-reload

About

vixcpp/examples – Example applications demonstrating real-world usage of vix.cpp: Todo API, Blog, and Chat with WebSockets.

Resources

License

Stars

Watchers

Forks

Packages

No packages published