App scaffolding
Every Viam app follows the same scaffolding pattern regardless of language. The per-language pages in this section walk through each step for a specific SDK, but the shape is always the same:
- Create a project. Set up a directory with the build tooling for your language:
npm initfor TypeScript,flutter createfor Flutter,go mod initfor Go, a virtual environment for Python, a CMake project for C++. - Add the Viam SDK as a dependency. Each language has its own package manager and package name:
npm install @viamrobotics/sdkfor TypeScript,flutter pub add viam_sdkfor Flutter,pip install viam-sdkfor Python,go get go.viam.com/rdk/robot/clientfor Go, and a CMakefind_packagefor C++. Some platforms need additional dependencies (WebRTC polyfills for Node.js, platform permissions for iOS and Android). - Configure credentials. Store your machine’s address, API key, and API key ID in environment variables or a
.envfile. Never commit credentials to source control. - Write a connection verification. A short program that connects to your machine and prints the resource count. This confirms the SDK is installed correctly, credentials are valid, and the connection works.
- Run it. Execute the program and confirm you see
Connected. Found N resources.If you do, the scaffold is complete and you can start writing your app.
After scaffolding, the next step is Connect to a machine for the connection patterns your app will actually use, or one of the tutorials for a guided project.
Pick your language
| Language | Page | Notes |
|---|---|---|
| TypeScript (browser) | TypeScript setup | Web app: dashboards, operator interfaces, any browser-based app. The setup page uses Vite; any bundler that handles TypeScript and ESM works. |
| TypeScript (Node.js) | Node.js setup | Node process for backend services and CLI tools. Requires WebRTC polyfills and a custom gRPC transport. |
| Flutter | Flutter setup | Cross-platform project for iOS, Android, and desktop. Includes iOS/Android platform configuration. |
| React Native | React Native setup | Mobile project for teams with existing React Native codebases. Requires six polyfill packages and a custom transport. For new projects, prefer Flutter. |
| Python | Python setup | Virtual environment for scripts, services, and backend integrations |
| Go | Go setup | Go module for backend services, fleet orchestrators, and CLI tools |
| C++ | C++ setup | CMake project for embedded and high-performance apps. Requires system-level dependencies (Boost, gRPC, protobuf). |
Where credentials come from
Every scaffolding page asks for three values: the machine’s address, an API key, and an API key ID. Get all three from the same place:
- Go to the machine’s page in the Viam app.
- Click the CONNECT tab.
- Select the language tab that matches the page you are following.
- Toggle Include API key on.
- Copy the address, API key ID, and API key from the generated code sample.
For apps that access multiple machines or the Viam cloud APIs, use an organization-scoped or location-scoped API key instead of a machine-scoped one. Create these in Admin and access.
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!