vix make
vix make generates C++ files quickly from the folder you are working in.
Use it when you want to create common C++ scaffolding such as classes, structs, enums, functions, concepts, exceptions, tests, lambdas, or JSON runtime config files.
vix make is a file generator. It does not create a full project layout.
Use vix new when you want to create a new project.
Use vix modules when you want structured module scaffolding.
Usage
vix make <kind> <name> [options]
vix make:<kind> [name] [options]2
What it does
vix make generates files in the current directory by default.
If --in is provided, generated files are written inside that folder.
If --dir is provided, it becomes the project root, and --in is resolved from that root.
vix make class User
vix make class User --in src/domain
vix make class User --dir ./apps/api --in src/domain2
3
With the last command, files are generated inside:
./apps/api/src/domainBasic usage
vix make class User
vix make struct Claims
vix make enum Status
vix make function parse_token
vix make lambda visit_all
vix make concept EqualityComparable
vix make exception InvalidToken
vix make test AuthService
vix make config app2
3
4
5
6
7
8
9
Interactive generator form
You can also use the vix make:<kind> form:
vix make:class
vix make:class User
vix make:config
vix make:config app2
3
4
If the name is missing, Vix starts an interactive prompt.
Current interactive support:
| Kind | Interactive support |
|---|---|
class | Yes |
config | Yes |
struct | Not yet |
enum | Not yet |
function | Not yet |
lambda | Not yet |
concept | Not yet |
exception | Not yet |
test | Not yet |
module | Redirected to vix modules |
Supported kinds
| Kind | What it generates |
|---|---|
class | A C++ class. Generates .hpp and .cpp by default. |
struct | A plain data struct. Header-only by design. |
enum | An enum class with helpers. Header-only by design. |
function | A free function. Generates .hpp and .cpp by default. |
lambda | A modern generic lambda. Header-only by design. |
concept | A C++20 concept. Header-only by design. |
exception | A std::exception derived type. Generates .hpp and .cpp by default. |
test | A GoogleTest skeleton. |
module | Redirects to the modules workflow. |
config | A JSON runtime configuration file. |
Output behavior
By default, vix make behaves like a direct file generator.
It does not force generated files into include/, src/, or tests/.
mkdir src/domain
cd src/domain
vix make class User2
3
This generates:
User.hpp
User.cpp2
Using --in:
vix make class User --in src/domainThis generates:
src/domain/User.hpp
src/domain/User.cpp2
Using --dir and --in:
vix make class User --dir ./apps/api --in src/domainThis generates:
apps/api/src/domain/User.hpp
apps/api/src/domain/User.cpp2
Project root and default namespace
--dir sets the project root.
If a CMakeLists.txt exists, Vix tries to detect the project name from the CMake project(...) declaration.
That project name is used to guess a default namespace.
Example:
project(MyApi)Then:
vix make class User --dir .Can use the default namespace:
namespace myapi
{
}2
3
You can override it:
vix make class User --namespace app::domainName validation
Names must be valid C++ identifiers.
Valid:
vix make class User
vix make struct AccessToken
vix make enum Status2
3
Invalid:
vix make class 123User
vix make class user-name
vix make class class2
3
C++ reserved keywords are rejected.
Namespace values are also validated:
vix make class User --namespace app::domainInvalid namespace example:
vix make class User --namespace app::classExisting files
Existing files are not overwritten by default.
vix make class User
vix make class User2
The second command fails because the files already exist.
Use --force to overwrite:
vix make class User --forceUse --force carefully.
Preview and dry run
Use --dry-run to see what would be generated without writing files:
vix make class User --dry-runUse --print to print the generated preview or snippet:
vix make lambda visit_all --print
vix make class User --print2
Difference:
| Option | Behavior |
|---|---|
--dry-run | Prints the kind, name, and target file paths. Does not write files. |
--print | Prints the generated preview or code snippet. Does not write files. |
Generate a class
vix make class UserBy default, class generation creates:
User.hpp
User.cpp2
Default class generation includes:
default constructor
value constructor
virtual destructor
copy/move operations
getters and setters
one default field: std::string id2
3
4
5
6
Example:
vix make class User --namespace app::domainGenerate in a specific folder:
vix make class User --in src/domainGenerate header-only:
vix make class User --header-onlyPreview:
vix make class User --dry-run
vix make class User --print2
Overwrite existing files:
vix make class User --forceInteractive class generation
vix make:classThe interactive class generator asks for:
class name
namespace
number of fields
field names and types
default constructor
value constructor
getters/setters
copy/move operations
virtual destructor
header-only mode
target folder2
3
4
5
6
7
8
9
10
11
Example field input:
id:string
email:std::string
age:int2
3
string is normalized to:
std::stringGenerate a struct
vix make struct ClaimsStruct generation is header-only by design.
It creates:
Claims.hppThe generated struct includes a simple data payload skeleton:
id
label
valid
version
tags2
3
4
5
Examples:
vix make struct Claims --namespace auth
vix make struct Claims --in src/auth2
Generate an enum
vix make enum StatusEnum generation is header-only by design.
It creates:
Status.hppThe generated enum includes:
enum class Status
to_string(Status)
is_known(Status)2
3
Default enum values:
Unknown
Active
Disabled2
3
Examples:
vix make enum Status --in src/domain
vix make enum Status --namespace app::domain2
Generate a free function
vix make function parse_tokenBy default, function generation creates:
parse_token.hpp
parse_token.cpp2
The generated function uses std::string_view for lightweight input.
Example:
vix make function parse_token --in src/authHeader-only:
vix make function parse_token --header-onlyGenerate a lambda
vix make lambda visit_allLambda generation is header-only by design.
It creates:
visit_all.hppThe generated lambda is a modern generic lambda:
inline constexpr auto visit_all = []<typename T>(const T &value)
{
return value;
};2
3
4
For snippet usage:
vix make lambda visit_all --printGenerate a concept
vix make concept EqualityComparableConcept generation is header-only by design.
It creates:
EqualityComparable.hppThe generated concept uses:
requires-expressions
std::convertible_to
std::is_reference_v2
3
It is useful for generic C++20 constraints.
Example:
vix make concept EqualityComparable --namespace appGenerate an exception
vix make exception InvalidTokenBy default, exception generation creates:
InvalidToken.hpp
InvalidToken.cpp2
The generated exception:
derives from std::exception
stores the message in std::string
overrides what() const noexcept2
3
Examples:
vix make exception InvalidToken --in src/auth
vix make exception InvalidToken --namespace auth
vix make exception InvalidToken --header-only2
3
Generate a test
vix make test AuthServiceTest generation creates a GoogleTest skeleton.
It creates a file like:
test_auth_service.cppThe generated test contains:
#include <gtest/gtest.h>
TEST(AuthService, DefaultCase)
{
EXPECT_TRUE(true);
}2
3
4
5
6
Replace EXPECT_TRUE(true) with real assertions.
Example:
vix make test AuthService --in testsGenerate a config file
vix make config appConfig generation creates a JSON runtime configuration file.
For app, it creates:
app.jsonBy default, config generation includes:
server
logging
waf2
3
By default, it does not include:
websocket
database2
Examples:
vix make config app
vix make config app --websocket --database
vix make config app --server --logging --waf
vix make config app --no-websocket2
3
4
Config sections
| Option | Meaning |
|---|---|
--server | Enable server section. |
--no-server | Disable server section. |
--logging | Enable logging section. |
--no-logging | Disable logging section. |
--waf | Enable WAF section. |
--no-waf | Disable WAF section. |
--websocket | Enable WebSocket section. |
--no-websocket | Disable WebSocket section. |
--database | Enable database section. |
--no-database | Disable database section. |
At least one config section must be enabled.
This is invalid:
vix make config app \
--no-server \
--no-logging \
--no-waf \
--no-websocket \
--no-database2
3
4
5
6
Default config content
Default command:
vix make config appGenerates a JSON config with sections like:
{
"server": {
"port": 8080,
"request_timeout": 2000,
"io_threads": 0,
"session_timeout_sec": 300,
"bench_mode": true
},
"logging": {
"async": true,
"queue_max": 20000,
"drop_on_overflow": true
},
"waf": {
"mode": "off",
"max_target_len": 4096,
"max_body_bytes": 1048576
}
}2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
With WebSocket:
vix make config app --websocketAdds:
"websocket": {
"port": 9090,
"max_message_size": 65536,
"idle_timeout": 60,
"ping_interval": 30,
"enable_deflate": true,
"auto_ping_pong": true
}2
3
4
5
6
7
8
With database:
vix make config app --databaseAdds:
"database": {
"default": {
"host": "localhost",
"port": 3306,
"name": "mydb",
"user": "myuser",
"password": ""
}
}2
3
4
5
6
7
8
9
Generate a module
vix make module authModule generation does not belong to vix make.
Vix returns an error and points you to the modules workflow.
Use:
vix modules add authvix make is for direct file generation.
vix modules is for structured module scaffolding.
Options
| Option | Description |
|---|---|
-d, --dir <path> | Project root. Default is the current directory. |
--in <path> | Folder where files should be generated. |
--namespace <ns> | Override namespace. |
--header-only | Generate only header files when supported. |
--print | Print preview or snippet without writing files. |
--dry-run | Show what would be generated without writing files. |
--force | Overwrite existing files. |
--server | Enable server section for config generation. |
--no-server | Disable server section for config generation. |
--logging | Enable logging section for config generation. |
--no-logging | Disable logging section for config generation. |
--waf | Enable WAF section for config generation. |
--no-waf | Disable WAF section for config generation. |
--websocket | Enable WebSocket section for config generation. |
--no-websocket | Disable WebSocket section for config generation. |
--database | Enable database section for config generation. |
--no-database | Disable database section for config generation. |
-h, --help | Show command help. |
Common workflows
Generate a domain class
vix make class User --in src/domain --namespace app::domainGenerate a header-only class
vix make class User --in include/domain --namespace app::domain --header-onlyGenerate an auth struct
vix make struct Claims --in src/auth --namespace authGenerate an enum for status values
vix make enum Status --in src/domainGenerate a parser function
vix make function parse_token --in src/authGenerate a reusable lambda snippet
vix make lambda visit_all --printGenerate a C++20 concept
vix make concept EqualityComparable --in src/coreGenerate a custom exception
vix make exception InvalidToken --in src/authGenerate a test skeleton
vix make test AuthService --in testsGenerate app configuration
vix make config app --websocket --databasePreview before writing
vix make class User --in src/domain --dry-runPrint generated snippet
vix make lambda visit_all --printRecommended workflow
# 1. Generate the file
vix make class User --in src/domain --namespace app::domain
# 2. Format generated files
vix fmt
# 3. Build
vix build
# 4. Run tests
vix tests2
3
4
5
6
7
8
9
10
11
For tests:
vix make test AuthService --in tests
vix fmt
vix tests2
3
For config:
vix make config app --websocket --database
vix run2
Common mistakes
Using vix make instead of vix new
vix make generates files.
It does not create a full project layout.
Wrong:
vix make class apiCorrect for a new project:
vix new apiThen generate files inside the project:
cd api
vix make class User --in src/domain2
Using vix make module instead of vix modules
vix make module redirects to the modules workflow.
Use:
vix modules add authConfusing --dir and --in
--dir is the project root.
--in is the output folder.
vix make class User --dir ./apps/api --in src/domainThis means:
project root: ./apps/api
output folder: ./apps/api/src/domain2
Expecting files to be generated in include/ and src/
vix make does not force include/ or src/.
It writes into the current folder by default.
cd src/domain
vix make class User2
Generates:
User.hpp
User.cpp2
To write into a specific folder, use:
vix make class User --in src/domainMissing a name
This starts interactive mode when supported:
vix make class
vix make:class2
Direct generation:
vix make class UserInteractive mode is currently implemented for:
class
config2
For other kinds, provide the name directly:
vix make struct Claims
vix make enum Status
vix make function parse_token2
3
Using an invalid C++ name
Wrong:
vix make class 123User
vix make class user-name
vix make class class2
3
Correct:
vix make class User
vix make class UserProfile
vix make function parse_token2
3
Overwriting files accidentally
Vix does not overwrite existing files unless --force is provided.
vix make class User --forceUse --dry-run first when unsure:
vix make class User --dry-runDisabling every config section
Wrong:
vix make config app \
--no-server \
--no-logging \
--no-waf \
--no-websocket \
--no-database2
3
4
5
6
At least one section must remain enabled.
When to use vix make
Use vix make when:
your project already exists
you want to generate one or more C++ files quickly
you want a class, struct, enum, function, concept, exception, lambda, or test skeleton
you want to generate a runtime JSON config file
you want to preview generated code before writing files2
3
4
5
Use vix new when:
you need a new project
you need a full project layout
you need templates such as app, backend, web, vue, game, or library2
3
Use vix modules when:
you need structured module scaffolding
you want module-level folders and integration
you are adding a module to an existing Vix project2
3
Related commands
| Command | Purpose |
|---|---|
vix new | Create a new project. |
vix modules | Manage structured modules. |
vix fmt | Format generated files. |
vix build | Build the project. |
vix dev | Run the project in development mode. |
vix run | Build and run. |
vix check | Validate the project. |
vix tests | Run tests. |
Next step
Continue with formatting.