Runtime Workflow
The runtime workflow is the part of Vix.cpp that takes an input, resolves what it represents, prepares the environment, builds when needed, executes the target, and reports the result.
The input can be a single C++ file:
vix run main.cppIt can be the current project:
vix runIt can also be an already built executable:
vix run ./build-ninja/apiThe command stays simple, but the runtime workflow decides what must happen.
The basic model
The runtime workflow follows this model:
input
-> resolve target
-> prepare environment
-> build if needed
-> execute
-> report statusVix.cpp does not run every target in the same way.
A single C++ file is different from a backend project. A vix.app application is different from a CMake project. An already built executable is different from a replayed run.
Vix.cpp first resolves the target, then chooses the correct execution path.
What vix run means
When you run:
vix runyou are asking Vix.cpp to run the current application or project.
When you run:
vix run main.cppyou are asking Vix.cpp to run a specific C++ file.
When you run:
vix run ./build-ninja/apiyou are asking Vix.cpp to run an existing executable.
These commands belong to the same runtime family, but each target uses a different strategy.
Runtime targets
Vix.cpp runtime can work with several target types.
| Target | Example | Meaning |
|---|---|---|
| Current project | vix run | Resolve and run the application in the current folder. |
| C++ file | vix run main.cpp | Compile and run one file. |
vix.app project | vix run | Generate the internal project if needed, build, then run. |
| CMake project | vix run | Configure or build with the CMake workflow, then run. |
| Executable | vix run ./build-ninja/api | Run an already built binary. |
| Replay record | vix replay last | Re-run a recorded execution. |
| Docker workflow | vix run docker ... | Run through a Docker-aware runtime path when configured. |
The runtime should not guess randomly. It should resolve the target from the input and project files, then explain failures clearly when resolution is impossible.
Project resolution
For a project directory, Vix.cpp looks for project files.
Resolution order:
1. CMakeLists.txt
2. vix.appIf CMakeLists.txt exists, Vix.cpp uses the CMake project.
If there is no CMakeLists.txt and vix.app exists, Vix.cpp uses the vix.app application model.
This rule matters because it protects existing CMake projects while still giving simpler applications a manifest-based path.
Running a vix.app application
A vix.app file describes the application.
Example:
name = api
type = executable
standard = c++23
sources = [
src/main.cpp,
src/app/AppFactory.cpp,
]
include_dirs = [
src,
]
modules = [
core,
json,
http,
]When Vix.cpp runs this application, the workflow is:
read vix.app
-> validate manifest
-> generate internal CMake project
-> configure if needed
-> build target
-> run targetThe generated CMake project lives under:
.vix/generated/app/The developer continues to edit vix.app. The generated build layer remains an implementation detail.
Running a CMake project
If the project has CMakeLists.txt, Vix.cpp keeps the CMake path.
Typical flow:
read CMakeLists.txt
-> select preset or default build configuration
-> configure if needed
-> build target
-> run executableExamples:
vix run
vix run --preset dev
vix run --preset releaseThis is the right path for projects that need direct CMake control.
Running one C++ file
For a single file:
vix run main.cppVix.cpp can use a direct compile path when the file is simple enough.
The simple path is:
main.cpp
-> compile
-> link
-> runThis is useful for learning, testing ideas, writing small tools, running examples, and validating short programs without creating a full project.
CMake fallback for scripts
Some single-file programs need more than direct compilation.
Examples include:
Vix runtime modules
registry dependencies
database support
sanitizers
special linker flags
project-level configurationIn those cases, Vix.cpp can use a CMake fallback.
The command remains the same:
vix run server.cppThe strategy changes:
direct compile when enough
CMake fallback when saferThis lets a file grow from a small experiment into something more serious without forcing the developer to rewrite the workflow immediately.
Running a built executable
You can run an existing executable:
vix run ./build-ninja/apiOther examples:
vix run ./build-ninja/api
vix run ./dist/serverIn this case, Vix.cpp does not need to resolve a project target first. The binary is already the target.
This is useful when the application has already been built and you want Vix.cpp to handle the execution workflow around it.
Runtime arguments
Application arguments go after --.
vix run -- --port 8080The rule is:
before -- = Vix.cpp arguments
after -- = application argumentsExample:
vix run main.cpp -- --name gaspard --debugHere:
main.cpp belongs to Vix.cpp
--name gaspard --debug belongs to the applicationThis distinction avoids confusion between runtime options and application options.
Environment variables
Runtime behavior often depends on environment variables.
Example:
VIX_LOG_LEVEL=debug vix runFor application configuration, use .env when the application supports it.
Example:
APP_ENV=development
SERVER_HOST=127.0.0.1
SERVER_PORT=8080
VIX_LOG_LEVEL=info
DATABASE_ENGINE=sqlite
DATABASE_DEFAULT_NAME=./data/app.dbBefore running a project seriously, check the local environment:
vix env checkFor production:
vix env check --productionEnvironment configuration should be explicit. A runtime workflow should not depend on invisible assumptions.
Development runtime
vix run is for one execution.
vix dev is for active development.
vix devThe development workflow is:
start application
-> watch files
-> classify changes
-> rebuild or reconfigure
-> restart when usefulUse vix dev while editing the application.
Use vix run when you want to start it directly.
Replay-enabled runs
A normal run does not automatically record replay data.
To record a run:
vix run --replayFor one file:
vix run main.cpp --replayThen replay it:
vix replay lastReplay the latest failed run:
vix replay failedReplay records are stored under:
.vix/runs/A recorded run can include:
command
working directory
arguments
environment additions
status
stdout
stderr
combined logs
durationReplay exists so developers do not have to debug from memory when the exact run can be reproduced.
Runtime output
Runtime output should show what matters.
For a server application, output can include:
application name
mode
HTTP URL
WebSocket URL
thread count
status
hint to stopExample shape:
Vix.cpp READY
HTTP: http://localhost:8080/
WS: ws://localhost:9090/
Threads: 8/8
Mode: run
Status: ready
Hint: Ctrl+C to stop the serverThe output should make the runtime state visible. When the application is ready, the developer should see how to reach it. When it fails, the developer should see enough information to understand what happened next.
Exit behavior
Runtime commands should return meaningful exit codes.
| Exit code | Meaning |
|---|---|
0 | Run completed successfully. |
1 | Run failed. |
130 | Interrupted by user, usually with Ctrl+C. |
When a server is interrupted manually, that should be reported clearly.
Example:
Program interrupted by user (SIGINT).An intentional interruption is not the same as a crash.
Runtime errors
Runtime errors should be readable.
Unhelpful output:
errorUseful output:
error: failed to run target
target: api
reason: executable not found
fix: run vix buildThe model is:
what failed
where it failed
why it failed
what to try nextA runtime and developer toolkit should not only run commands. It should help the developer recover when a command fails.
Runtime and dependencies
If a project depends on registry packages, install them first:
vix installAfter adding a dependency:
vix add softadastra/json
vix runAfter cloning a project:
git clone https://github.com/example/api.git
cd api
vix install
vix runRuntime should not silently ignore missing dependencies. If dependencies are missing, the fix should be clear.
Runtime and modules
A vix.app project can declare modules:
modules = [
core,
json,
http,
db,
]The runtime does not directly “run modules”, but modules affect the build and linking steps required before execution.
If a runtime target needs db, the build must include database support.
If a runtime target needs http, the build must link the correct HTTP module.
The runtime workflow depends on correct module composition.
Runtime and health
For backend applications, runtime is connected to health checks.
A backend should expose:
GET /healthThen local runtime can be checked with:
vix health localPublic runtime can be checked with:
vix health publicA process that starts is not automatically healthy.
Runtime means the application is actually usable, not only that a process exists.
Runtime and logs
When running locally, logs usually appear in the terminal.
In production, logs may come from systemd and Nginx.
Use:
vix logs app
vix logs proxy
vix logs errorsThe runtime workflow should leave enough trace to debug failures.
A process that fails silently is not production-ready.
Runtime and services
Production runtime usually runs through a service manager such as systemd.
A common model is:
systemd starts the Vix.cpp application
Nginx exposes it publicly
health checks verify it
logs explain it
deployment updates itCommands:
vix service init
vix service status
vix service restartThe same application can run locally with:
vix runand in production through systemd.
The application remains the same. The runtime environment changes.
Runtime and Docker
Some workflows can involve Docker.
The important model is:
Vix.cpp owns the runtime intent.
Docker can be one execution backend when configured.A Docker-aware runtime flow should still be visible and explainable.
The developer should know:
which image or container is used
which ports are exposed
which command is executed
which environment values are passedDocker should not be hidden behind unclear behavior.
Runtime and production
A production run should not rely on manual terminal sessions.
Local:
vix runDevelopment:
vix devProduction:
vix service init
vix deploy
vix healthThe production model is not:
ssh into a server and run random commands foreverThe production model is:
configured service
repeatable deployment
checked health
available logsCommon workflows
Run one file:
vix run main.cppRun the current project:
vix runRun with application arguments:
vix run -- --port 8080Record and replay:
vix run --replay
vix replay lastRun development mode:
vix devRun after dependency installation:
vix install
vix runBuild release, then run:
vix build --preset release
vix runCommon mistakes
Passing application arguments before --
Wrong:
vix run --port 8080Correct:
vix run -- --port 8080Expecting replay without recording
Wrong:
vix run
vix replay lastCorrect:
vix run --replay
vix replay lastRunning before installing dependencies
Wrong after cloning:
vix runCorrect:
vix install
vix runUsing vix run for active development
This works:
vix runBut while editing, prefer:
vix devTreating “process started” as “application healthy”
A backend can start and still be broken.
Check it:
vix health localRuntime checklist
Before trusting a runtime workflow, check:
Can the application be resolved?
Can dependencies be installed?
Can the target be built?
Can the executable be found?
Can application arguments be passed?
Can environment variables be loaded?
Can failures be diagnosed?
Can important runs be replayed?
Can health be checked?
Can logs be read?If the answer is yes, the runtime workflow is usable.
What you should remember
Runtime is not only execution.
Runtime is:
resolve target
prepare environment
build when needed
run with clear arguments
record when requested
report useful statusUse:
vix run main.cppfor one file.
Use:
vix runfor the current application.
Use:
vix devwhile editing.
Use:
vix run --replay
vix replay failedwhen reproduction matters.
The core model is:
same command
right target
safe strategy
clear output