Build your Root App
Building an App with Root requires a few key steps to set up your App's test environment and compile your project. In this guide, we’ll walk you through adding your DEV_TOKEN to your server project and compiling your App’s source code. After going through these steps, your App will be ready to run locally.
Add your DEV_TOKEN to the server project
-
Open the
.envfile in the App'sserverfolder. -
Add your previously generated
DEV_TOKENto the file. The completed file should look something like this (but contain yourDEV_TOKENrather than this sample):Complete content of a sample .env fileDEV_TOKEN=ACROZj4Ilajlkgjoilkjdljfb5l2jln426k42548fdlj4359204undlajf_lkaejrln3904280294FLWalPd35aoier82m_lkad4lkjas0kj-aeheccewqioclbaljer34akjwqpz_-lk-kO52jQjlaljbjlk5299elk2aklbwpcast67lka0as2lgxlmqJSO98absLa34s90gask2ac
Build your App
Root Apps generally have three top-level source folders: client, networking, and server. These are the folder names Root recommends, and they'll be the names used by Root's starter-code generator.
An App's source code is a mix of protobuf and TypeScript. The networking source code is protbuf, so the Root tooling will first compile the protobuf into TypeScript and then run the TypeScript compiler. The server and client source is TypeScript, so the tooling will only run a TypeScript compile.
-
Open a terminal in your App's project folder.
-
Install the packages by running the following command:
npm i -
Build the App by running the following command:
npm run build
The build command will compile all three source folders and produce two things for you:
- Your App's client in the
client/distfolder. - Your App's server in the
server/distfolder.