Home platformOS Logo

Create Your Codebase

Last edit: Apr 27, 2020

Tip

If you go through the Hello, World! onboarding steps when registering on the Partner Portal, you can download the codebase of your demo Instance instead of creating it with the pos-cli init command.

In order to correctly communicate with the platformOS engine and API, your codebase should be organized into a specific directory structure. You can create your codebase organized into the the required directory structure using the pos-cli's init command.

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 all of your projects and a directory for your project inside of it.

Example directory structure before pos-cli init:

projects
└── hello-world

Change into the hello-world directory and run the pos-cli init command:


pos-cli init

This command creates the required directories, configuration files, and some example files in the directory you specified.

Important

Make sure you invoke this command where you have permissions to create a directory.

If the directory is empty, the command shows a success message:

$ pos-cli init
[11:35:06] Directory structure successfully created.

If it is not empty (don't forget to think of hidden files), 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 option force to override.
$ pos-cli init --force
[11:36:43] Directory structure successfully created.

Once you've installed the required directory structure, locate and explore it – this is how your codebase for your platformOS Instances should be organized.

Example directory structure after running pos-cli init:

.
├── LICENSE
├── app
│   ├── assets
│   │   ├── fonts
│   │   │   ├── Gotham-Bold.woff2
│   │   │   ├── Gotham-Book.woff2
│   │   │   ├── Gotham-Light.woff2
│   │   │   └── Gotham-Medium.woff2
│   │   ├── images
│   │   │   ├── logo-black.svg
│   │   │   ├── logo.svg
│   │   │   └── welcome.svg
│   │   ├── scripts
│   │   │   ├── app.js
│   │   │   ├── sw.js
│   │   │   └── vendor.js
│   │   └── styles
│   │       └── app.css
│   ├── authorization_policies
│   │   ├── example_policy.liquid
│   │   └── failing_policy.liquid
│   ├── forms
│   ├── graphql
│   │   └── example.graphql
│   ├── model_schemas
│   ├── api_calls
│   │   └── example.liquid
│   ├── emails
│   │   └── example.liquid
│   ├── smses
│   │       └── example.liquid
│   ├── translations
│   │   ├── en.yml
│   │   └── pl.yml
│   ├── user_profile_types
│   └── views
│       ├── layouts
│       │   ├── 1col.html.liquid
│       │   └── application.html.liquid
│       ├── pages
│       │   ├── admin.html.liquid
│       │   ├── index.html.liquid
│       │   └── unauthorized.html.liquid
│       └── partials
│           └── layout
│               ├── head.liquid
│               └── scripts.liquid
└── modules
    └── example
        ├── private
        │   ├── assets
        │   ├── authorization_policies
        │   ├── forms
        │   ├── graphql
        │   ├── model_schemas
        │   ├── api_calls
        │   ├── emails
        │   ├── smses
        │   ├── translations
        │   ├── user_profile_types
        │   └── views
        │       ├── layouts
        │       ├── pages
        │       └── partials
        └── public
            ├── assets
            ├── authorization_policies
            ├── forms
            ├── graphql
            ├── model_schemas
            ├── api_calls
            ├── emails
            ├── smses
            ├── translations
            ├── user_profile_types
            └── views
                ├── layouts
                ├── pages
                └── partials

To learn more about the required directories and files, see platformOS Codebase.



Next step: Change Something on Your Homepage

Contribute to this page

Github Icon

Questions?

We are always happy to help with any questions you may have.

contact us