Creating the Codebase
This guide will help you create the codebase using the pos-cli.
In order to correctly communicate with the platformOS engine and API, your codebase should be organized into a specific directory structure. The root directory of your project should contain the
This guide explains how to create your codebase using the pos-cli. Alternatively, you can create your directory structure by Downloading the Codebase of an Instance you created or have access to.
You can create the codebase using the pos-cli, so you have to have it installed on your computer. This functionality is available from version 1.0.6, so make sure you update your pos-cli to the latest version.
Creating the codebase with the pos-cli is a two-step process:
Step 1: Create the directory structure
pos-cli init downloads the directory structure in a zip file, and extracts it into the current directory. This means the best way to start is to create a directory for your projects and a directory for your project inside of it.
Example directory structure before
projects └── my-first-app
my-first-app directory and enter:
If the directory is empty, the command shows a success message:
$ pos-cli init [11:35:06] Directory structure sucessfully created.
If it is not empty, it will require your confirmation by adding the
--force flag. Be aware that it will override your files if they conflict.
$ pos-cli init [11:36:10] Cloning failed. Reason: destination directory is not empty, aborting. Use options.force to override
$ pos-cli init --force [11:36:43] Directory structure sucessfully created.
Step 2: Explore your directory structure
Once you've downloaded the codebase, locate and explore it – this is how the directories and code of your platformOS Instances should be organized.
To learn more about the required directories and files, check out our detailed description of the platformOS Codebase.
Congratulations! You have created the codebase for your Instance using the pos-cli. You can now deploy and sync changes to your Instance.