Project Templates | Vix.cpp Documentation
Vix.cpp v2.7.0 is here Read the blog
Skip to content

Project Templates

Project templates are the starting points generated by vix new. Each template creates a project with a different shape, depending on what the project is meant to become: a small Vix application, a production backend, a server-rendered web app, a Vue frontend with a Vix backend, a game project, or a reusable C++ library.

The template is not only a folder layout. It also decides which files are generated, which workflow is suggested after creation, how vix.app or CMake is used, which runtime resources are copied, and how the project is expected to grow.

bash
vix new my-app

When the command runs interactively, Vix lets you choose the project type. In non-interactive workflows, the template can be selected with flags or with --template.

Available templates

Vix currently provides these project templates:

txt
Application
Backend
Web
Vue
Game
Library

Each template has a different purpose. Choosing the right one matters because the generated files are meant to match the workflow of the project.

Application

The application template is the simplest Vix application shape. It creates a small C++ backend application with a vix.app manifest, a vix.json file, a minimal entry point, a basic test, and a module registry integration point.

bash
vix new hello --app

Use this template when you want a clean Vix application without the full backend production structure. It is a good starting point for small HTTP apps, experiments, internal tools, or applications that may later grow with vix modules.

txt
hello/
  include/
    app/
      ModuleRegistry.hpp
  src/
    main.cpp
    app/
      ModuleRegistry.cpp
  tests/
  vix.app
  vix.json

The important detail is the module registry. Even the simple application template keeps one stable place where generated application modules can be connected later.

Application Template

Backend

The backend template creates a more structured production backend. It keeps main.cpp small and moves startup into AppBootstrap. It also generates route and middleware registries, health routes, API routes, response helpers, runtime resources, tests, and production-oriented metadata in vix.json.

bash
vix new api --template backend

Use this template when the project is a backend service or API that needs a clearer long-term structure from the beginning.

txt
api/
  include/api/
    app/
    presentation/
    support/
  src/
    main.cpp
    api/
      app/
      presentation/
      support/
  public/
  views/
  storage/
  tests/
  vix.app
  vix.json

The backend template is also designed to work with application modules. Generated backend startup calls the generated module registration bridge, so feature modules can be added without turning AppBootstrap.cpp into a long list of manual includes.

Backend Template

Web

The web template creates a server-rendered Vix web application. It is different from the backend template because its main purpose is rendering HTML pages from views/ and serving static assets from public/.

bash
vix new site --template web

Use this template when the application should render pages on the server with the Vix template engine.

txt
site/
  include/site/
    app/
    presentation/
  src/
    main.cpp
    site/
      app/
      presentation/
  views/
    base.html
    header.html
    index.html
    dashboard.html
  public/
    app.css
    app.js
  storage/
  tests/
  vix.app
  vix.json

The generated app configures templates and static files from the bootstrap:

cpp
app.templates("views");
app.static_dir("public", "/");

Choose this template for server-rendered pages. Choose the backend template when the project is mainly an API service.

Web Template

Vue

The Vue template creates a Vix C++ backend with a Vue frontend under frontend/. The backend remains a Vix application, while the frontend is managed by Vite.

bash
vix new dashboard --template vue

Use this template when you want a browser frontend built with Vue and a Vix backend serving API routes.

txt
dashboard/
  src/
    main.cpp
  include/
    app/
  frontend/
    package.json
    index.html
    vite.config.js
    src/
      main.js
      App.vue
  vix.app
  vix.json

During development, the Vue app can call the backend through /api/*, and Vite proxies those requests to the Vix server.

txt
/api -> http://localhost:8080

This template should be understood as a combined project: Vue owns the frontend experience, and Vix owns the C++ backend.

Vue Template

Game

The game template creates a Vix game project. It links the game and IO modules, generates a game entry point, creates an assets/ directory, and includes game.package.json as runtime metadata.

bash
vix new space-demo --game

or:

bash
vix new space-demo --template game

A generated game project is centered on vix::game.

txt
space-demo/
  src/
    main.cpp
  assets/
  game.package.json
  vix.app
  vix.json

The game manifest links the game libraries and copies runtime resources beside the built target.

ini
links = [
  "vix::game",
  "vix::io",
]

resources = [
  "assets=assets",
  "game.package.json=game.package.json",
]

Use this template when the project is meant to run through the Vix game foundation.

Game Template

Library

The library template creates a reusable C++ library project. It is different from the application templates because it is centered on a library package shape, examples, tests, and CMake packaging.

bash
vix new mathkit --lib

A generated library project uses a normal CMake library layout.

txt
mathkit/
  include/
    mathkit/
      mathkit.hpp
  examples/
    basic.cpp
    CMakeLists.txt
  tests/
    test_basic.cpp
  CMakeLists.txt
  CMakePresets.json
  vix.json
  mathkit.vix

Use this template when the output is reusable C++ code instead of an application executable. It is the right starting point for packages that may later be consumed by another project.

Library Template

Choosing a template

Choose the smallest template that matches the real project.

txt
Application  small Vix application
Backend      structured API or backend service
Web          server-rendered HTML application
Vue          Vue frontend with Vix C++ backend
Game         Vix game project
Library      reusable C++ library

The application, backend, web, Vue, and game templates are application-oriented. They use vix.app to describe the main target and let Vix generate the internal CMake project. The library template is different because it is meant to produce reusable C++ code and keeps a normal CMake package structure.

Generated workflow

After creation, Vix prints the next steps for the selected template. A simple application usually starts with:

bash
cd hello/
vix build
vix run

A backend or web project also needs a local environment file:

bash
cd api/
cp .env.example .env
vix build
vix run

A Vue project installs frontend dependencies before development:

bash
cd dashboard/
npm install --prefix frontend
vix dev

A library project usually builds all targets and enables tests when needed:

bash
cd mathkit/
vix build --build-target all
vix tests

The generated command hints are intentionally short. The detailed pages in this section explain what each template creates and why those files exist.

Next step

Continue with the application template to understand the default Vix application layout and its module registry.

Application Template

Released under the MIT License.