Getting Started with Forge

If you have not yet created an account, now is the time to do it:

Create Account

Getting started with the command-line tools

The command-line tools are available via npm.

The first thing you'll need is a working Node.js installation.

You can either install Node.js via your favourite package manager or download it here:

Once you have verified that your Node.js installation is working you can perform the following tasks to get going with a new app:

Creating your first app

Note: If you have an existing app you'd like to work with, see Working with an existing app.

To keep each of your apps separate, we expect that you will want to work on them in different directories. In the terminal, we'll create a new directory and move into it:

mkdir demo_app
cd demo_app

Next, we need to initialize the npm package manager and create a package.json file:

npm init

This will allow us to install the command-line tools:

npm i @triggercorp/forge --save

Now, we can finally create our app, with the forge create command.

The first time you run this you will be prompted to enter your username and password.

On each run you will need to enter a descriptive name for your new app and the Project ID to associate it with.

You can find the Project ID on your account page.

$ npx forge create
[   INFO] Forge tools running at version 3.3.49
[   INFO] Update result: you already have the latest tools

You can find the ID for your project at
Project ID: 18

This name is what your application will be called on devices. You can change it later through config.json.
App Name: Weather Demo
[   INFO] Registering new app "Weather Demo" with
[   INFO] Fetching initial project template
[   INFO] Building app for the first time...
[   INFO] Update result: you already have the latest tools
[   INFO] Your Forge platform has been updated, downloading updated build instructions.
[   INFO] Fetching generation instructions for v1.4 into "/var/folders/g8/4rrh3bkx36qdcj819nkqgpj00000gn/T/forge-templates-zumPv5/.template"
[   INFO] Removing old templates if present
[   INFO] Using new templates
[   INFO] App structure created. To proceed:
[   INFO] 1) Put your code in the "src" folder
[   INFO] 2) Run forge build to make a build
[   INFO] 3) Run forge run to test out your build

At this point, you're ready to edit your app and start running builds!

Once you are ready to build your app you can build and run it for web:

npx forge build web
npx forge run web

...or run it for Android:

npx forge build android
npx forge run android

...or, if you're on a Mac, run it for iOS:

npx forge build ios
npx forge run ios

Working with an existing app

If you are already working with an app on your machine, simply change directory to where the app is:

cd my_existing_app

npx forge build web
npx forge run web

In that directory, you should have a src directory, containing the code for your app as well as the config.json and identity.json which are required by Forge

What next?

By now, you have a development environment set up.

From here, you could take a look at: