Quickstart Init

Quick start with nextmv init

The fastest way to scaffold and run a Nextmv application locally using the nextmv init command.

โŒ›๏ธ Approximate time to complete: 10 min.

In this tutorial you will scaffold a new Nextmv application from a template using nextmv init, run it locally, and inspect the results. Complete this tutorial if you:

  • Are new to Nextmv and want the fastest path to a working app.
  • Are fluent using Python ๐Ÿ.

At a high level, this tutorial will go through the following steps:

  1. Install the Nextmv CLI.
  2. Scaffold an app with nextmv init.
  3. Inspect the scaffolded files.
  4. Run the app locally.
  5. Get the results.

Let's dive right in ๐Ÿคฟ.

1. Install the CLI

Install the Nextmv CLI:

pip install nextmv
Copy

To verify the installation, run:

nextmv --help
Copy

2. Run nextmv init

The nextmv init command interactively scaffolds a new Nextmv application. Run it from the directory where you want to create your app:

nextmv init
Copy

Walk through the prompts as follows:

  1. Template โ€” start from a pre-built template (vs. wrapping an existing model).
  2. Python โ€” the language for your app. Go and Java are also available.
  3. JSON โ€” the content format for input and output. Multi-file is also available for CSV/Excel workflows.
  4. . โ€” the path where files will be created (default is the current directory).

The command scaffolds the app, installs dependencies, and registers it as a local application.

The nextmv init command is interactive and uses prompts to guide you. Each step can be skipped with "Maybe later" if you want to come back to it.

3. Inspect the scaffolded files

After running nextmv init, you should see the following files:

.
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ app.yaml
โ”œโ”€โ”€ input.json
โ”œโ”€โ”€ main.py
โ”œโ”€โ”€ visualizations.py
โ””โ”€โ”€ requirements.txt
Copy

The two most important files are:

  • app.yaml โ€” the app manifest. It tells the Nextmv CLI which files belong to your app, the runtime to use, and what options are available.
  • main.py โ€” the entrypoint. The default template reads data from input.json and returns a solution. Replace this logic with your own decision model.

4. Run locally

Use the Nextmv CLI to run your app locally. Make sure you are in the directory that contains app.yaml:

nextmv local run create --input input.json
Copy
{
  "run_id": "local-run-AbCdEfGh"
}
Copy

The CLI executes main.py with the provided input, stores the result locally, and returns a run ID.

Local runs are tracked in ~/.nextmv/runs/ and can be synced to Nextmv Cloud later.

5. Get results

Use the run ID from the previous step to retrieve the output:

nextmv local run get --run-id local-run-AbCdEfGh
Copy
{
  "options": { ... },
  "solution": { ... },
  "metrics": { ... },
  "assets": []
}
Copy

The output follows the standard Nextmv result schema:

  • options โ€” the configuration used for the run.
  • solution โ€” the result produced by your model.
  • metrics โ€” run metrics or KPIs about your result.
  • assets โ€” visualizations or other files produced by the run (see the custom visualizations tutorial).

6. Next steps

You now have a working Nextmv application running locally. From here you can:

  • Replace the template logic in main.py with your own decision model.
  • Sync local runs to the cloud with nextmv local app sync.
  • Push your app to run remotely with nextmv cloud app push.

For more detailed walkthroughs, check out these tutorials:

๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰ Congratulations, you have finished this tutorial!

Page last updated

Go to on-page nav menu