vixcpp/examples – Example applications demonstrating real-world usage of vix.cpp: Todo API, Blog, and Chat with WebSockets.
To build Vix.cpp from source:
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 ORMOptional dependencies:
sudo apt install -y libmysqlcppconn-dev libsqlite3-devInstall Homebrew first, then:
brew install cmake ninja llvm boost nlohmann-json spdlog fmt mysql sqlite3 zlib
export ZLIB_ROOT="$(brew --prefix zlib)"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/localThis builds the Vix runtime and CLI.
Make sure the resultingvixbinary is available in yourPATH.
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, worldWhen 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
devmode:- Watches the source file
- Rebuilds and restarts automatically on changes
- Stops cleanly on
Ctrl+C(no noisy build output)
| Command | Behavior |
|---|---|
vix run main.cpp |
Compile → run once |
vix dev main.cpp |
Compile → run → watch & hot-reload |
