Your First App
Building your first Workrock app is easy. We provide a CLI to handle the boilerplate and authentication.
Prerequisites
Section titled “Prerequisites”- Node.js (v18 or higher)
- A registered Partner account on the Marketplace.
1. Install the CLI
Section titled “1. Install the CLI”Install our command-line tool globally:
npm install -g @workrock/cli2. Authenticate
Section titled “2. Authenticate”Link your machine to your developer account:
workrock loginThis will open your browser to authenticate.
3. Create a Project
Section titled “3. Create a Project”We recommend starting with a Next.js application:
npx create-next-app@latest my-workrock-app --typescript --tailwind --eslintcd my-workrock-app4. Link to Marketplace
Section titled “4. Link to Marketplace”Connect your local folder to an app ID registered in the Marketplace:
workrock linkFollow the prompts to select your application. This creates a workrock.json file.
5. Configure Development Environment
Section titled “5. Configure Development Environment”To run your app locally and access the Workrock Core API, you need a Sandbox and a Development Token.
Create a Sandbox
Section titled “Create a Sandbox”This creates an isolated environment seeded with mock data (Projects, Leads, Tasks):
workrock sandbox --create "My Dev Store"Set up Environment Variables
Section titled “Set up Environment Variables”- Get your Auth Token: Run this CLI command to see your token:
Terminal window cat ~/.workrock/config.json - Create
.env.local: Create a file named.env.localin your project root:# Points to Workrock Core APINEXT_PUBLIC_API_URL=http://localhost:8000# Allows bypassing iframe check for localhost development# (Copy the 'token' value from config.json)NEXT_PUBLIC_WORKROCK_DEV_TOKEN=eyJhbGciOi...
6. Run the App
Section titled “6. Run the App”Start the development server with the Workrock CLI wrapper:
workrock devYou can now open http://localhost:3000 to verify your app is running and fetching data from the API!
Note: When you are ready to test within the Workrock OS iframe, the CLI automatically tunnels your localhost to the platform.