createproject

gox createproject create a GOX project within the current directory and prepare the tools needed to start developing it.

The generated project includes server configuration, an initial Page, a bug page and a basic test.


Use

bash
gox createproject <projectName>
ArgumentDescription
projectNameName of the directory that will contain the project.

The command requires exactly a name:

bash
gox createproject hello

Generated structure

The project initially contains:

text
hello/
├── .build/
├── app/
│   ├── config.gox
│   ├── http.gox
│   ├── ratelimit.gox
│   ├── routes.gox
│   ├── session.gox
│   ├── shutdown.gox
│   ├── startup.gox
│   ├── static.gox
│   └── websocket.gox
├── pages/
│   ├── .error.gox
│   └── index.gox
├── tests/
│   └── index.gox
├── public/
├── deps.go
├── go.mod
├── go.sum
└── gox.json

Rate limit and WebSocket start with Enabled: false; HTTP conserves RequireTrustedProxy: false. Configuration imports have explicit alias.

gox client add <framework> create client/<framework>/ and records its dependencies. The initial manifesto does not declare frameworks. By activating WebSocket and starting or recharging the configuration is created websocket/index.gox if it does not exist; it is never overwritten or eliminated by deactivating it. components/ is optional and is created when the project needs it. The compilation and results subfolders are created during the operations that use them.

See the project structure to know the function of each folder.


Toolchains

Before creating the files, GOX guarantees the availability of the compatible versions of:

  • Go.
  • Node.js.
  • PNPM.

It also resolves the SDK used by the project. GOX-administered tools do not need to be installed manually to run this command.


Initial dependencies

After creating the structure, GOX installs the declared dependencies and synchronizes the Go. Genera module files deps.go as a bridge of dependencies and runs go mod tidyupdating go.mod and generates go.sum when Checksums are required.

Subsequent administration is done by means of Dependency commands.


Errors

The command ends with an error when the name is missing, several arguments are provided, the destination cannot be created or some tool or dependence cannot be prepared.

It does not accept additional options other than the global help options.


Best practices

  • It uses a clear and stable directory name.
  • Run the command from the folder that will contain the project.
  • Check the generated configuration before deploying the application.
  • Preservation gox.json, go.mod and go.sum under version control.
  • Run the initial project before starting wide changes.

Next step

Continue with run to compile and run the project server.

run