Getting Started with Tenki Cloud Development
Last updated: 2025-06-12
This guide will help you set up your development environment and run Tenki Cloud locally.
Prerequisites
Required Software
- Nix
- Devenv
- Direnv
- 1Password
- 1Password CLI
- Integrate with 1Password CLI
- Verify you have access to luxor/Engineering by running:
op account list op vault list --account=luxor - If
luxorisn’t showing asluxor.1password.com, try other accounts fromop account list:op vault list --account=<account_name> - If
luxoraccount isn’t showing at all, contact administrator
Verify Prerequisites
nix --version
devenv version
direnv --version
op --version
Hardware Requirements
- RAM: 16GB minimum (32GB recommended)
- CPU: 4 cores minimum (8 cores recommended)
- Disk: 50GB free space
Initial Setup
1. Clone the Repository
git clone https://github.com/luxorlabs/tenki.app.git
cd tenki.app
2. Pull Setup Keys
sh tools/scripts/setup.sh
If you run into an issue where it’s using the wrong account, try this:
op account list
# account can be `luxor` if url is `luxor.1password.com`,
# or `my` if url is `my.1password.com` and there's only one account
# or the 3rd column (USER ID) if you have multiple accounts if you're getting the same url for all accounts.
sh tools/scripts/setup.sh <account>
Example: sh tools/scripts/setup.sh luxor
If you run into permission issues, try
chmod +x ./tools/scripts/*.sh
3. Enable Development Environment
direnv allow
This will:
- Install all required tools (Go, Node.js, pnpm, etc.)
- Set up environment variables
- Configure Git hooks
4. Install Dependencies
# Install all npm dependencies
pnpm install
# Generate protobuf code
bufgen
# Run Go mod tidy
tidy
# Update /etc/hosts entries
sync-hosts
# Initialize database
tb-format
5. Hosts and Other Setup
NOTE: Before running this script, the host needs to have
hostctlinstalled since it requires elevated execution. Verify withhostctl --version
Add tenki.lab hosts:
sync-hosts
Format TigerBeetle database:
tb-format
Managing Environment and Secrets
Secret Files
resources/secrets/*.sops.yaml- Encrypted secrets pushed/committed to gitresources/secrets/*.local.yaml- Decrypted secrets (gitignored)
Commands
env-sync- Decrypt secrets and create a copy on individual apps/backend foldersenv-decrypt- Decrypt secrets,*.sops.yamlto*.local.yamlenv-encrypt- Encrypt secrets,*.local.yamlto*.sops.yaml
Pulling Latest Secrets
git pullto get the latest secretsenv-syncto create your own copy of the secrets
Updating Secrets
- Locate the secret you want to update in
resources/secrets/*.local.yaml - Run
env-encryptto encrypt the secret - Commit the changes and push to GitHub
Overwriting Secrets (usually only needed once per setup)
- For Next.js apps:
.env.localwill overwrite.env. Copy.env.sampleto.env.localand update values - For backend:
engine.local.yamlwill overwriteengine.yaml. Copyengine.sample.yamltoengine.local.yamland update values
Seeding and Migrations
NOTE: Before running these commands, the database must be up and running. Run
dev upordevenv up
- Run
db upto migrate the database - Run
psql -U postgres -d tenki -f ./tools/seed/20240915152331_seed.sqlto seed the database with CSP & related data
Or run db deploy to run both.
- Run
db seedto seed the database with users, workspaces, projects, VMs. After this you can start the dev server & login with:- Email:
odin@tenki.cloud - Password:
tenki.app
- Email:
Database Commands
db up # Run migrations
db down # Rollback last migration
db reset # Reset database
db status # Check migration status
db create add_users_table # Create new migration
db deploy # Run migrations and seed
db nuke # Complete database reset
db seed # Seed test data
For Redpanda, see internal docs to set it up.
NOTE: This should be automated in the future
Running the Application
Quick Start
# Start all services
dev up
# Access the application
open https://app.tenki.lab:4001
Development Domains
- Frontend: https://app.tenki.lab:4001
- Temporal UI: https://temporal.tenki.lab
- Redpanda Console: https://redpanda.tenki.lab
- Grafana: https://grafana.tenki.lab
- API: https://api.tenki.lab
Individual Services
# Start specific service
dev up postgres
dev up temporal
dev up engine
# Other options
dev up --simple # Minimal output
dev up -D # Detached mode
# Service management
dev start [service] # Start specific service
dev stop [service] # Stop specific service
dev restart [service] # Restart service
dev logs [service] # View service logs
dev list # List all services
# Examples
dev start # (enter, then choose services, hit tab to select multiple)
dev start engine
dev logs -f postgres # Follow logs
Development Workflow
Frontend Development
cd apps/app
pnpm dev
# Run type checking
pnpm type-check
# Run linting
pnpm lint
pnpm lint:fix
Backend Development
# Run Go services
cd backend
go run cmd/engine/main.go
# Run tests
gotest
# Generate mocks
gomocks
# Build binaries
make build-engine
Database Changes
# Create new migration
db create add_user_preferences
# Apply migrations
db up
# Rollback migration
db down
# Reset database
db reset
Resetting Existing/Flaky Local Environment
- Close/stop all services
- Run
reset-local - In another terminal:
- Run
db deploy
- Run
Common Tasks
Adding shadcn/ui Components
# Add a new component
pnpm -F @shared/ui ui:add
# or
pnpm -F @shared/ui ui:add <component>
Then add the component to the exports in packages/ui/package.json:
"exports": {
"./button": "./src/components/ui/button.tsx",
"./alert-dialog": "./src/components/ui/alert-dialog.tsx"
}
Generating App Icons
pnpm -F app generate-icon
Then:
- Copy
public/images/favicon-196.pngto:src/app/favicon.pngsrc/app/icon.png
- Copy all
rel="apple-touch-startup-image"fromsrc/asset-generator.htmltosrc/app/layout.tsx
Adding a New API Endpoint
- Define proto in
proto/tenki/cloud/ - Run
bufgento generate code - Implement service in
backend/internal/domain/ - Add tRPC router in
apps/app/src/server/api/
Running Tests
# All tests
pnpm test
gotest
# Specific package
pnpm -F app test
cd backend && go test ./pkg/...
# Integration tests
gotest-integration
# With coverage
cd backend && go test -v -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
Debugging
# Check service health
dev list
# View all logs
dev logs
# Restart a service
dev restart engine
# Database console (direct connection)
psql -h localhost -U postgres -d tenki
# Temporal CLI
temporal workflow list
Troubleshooting
Port Already in Use
# Find process using port
lsof -i :4001
# Kill process
kill -9 <PID>
Database Connection Issues
# Restart postgres
dev restart postgres
# Check logs
dev logs postgres
# Reset database
db nuke
Proto Generation Fails
# Clean and regenerate
rm -rf backend/pkg/proto
bufgen
Node Modules Issues
# Clean and reinstall
rm -rf node_modules apps/*/node_modules packages/*/node_modules
pnpm install
Next Steps
- Read the Architecture Overview
- Set up your IDE/Editor
- Join the development Slack channel
- Pick a starter issue from GitHub
Editor Setup
VS Code
-
Install recommended extensions:
- Go
- ESLint
- Prettier
- Proto3
-
Use workspace settings:
{ "editor.formatOnSave": true, "go.lintTool": "golangci-lint" }
GoLand/WebStorm
- Enable Go modules
- Set up file watchers for:
- gofmt
- prettier
- eslint
Runner Prerequisites
Setting up GitHub App
- Create Github Organization, skip this if you already have one
- Create a github app
- run
pnpm -F github-app run createorpnpm -F github-app run create -o <org> - if
namealready exist, change it and continue - once done it’ll redirect you to a success screen, close the tab,
- run
- In
github-app-response.jsontake note of theslug,pem,webhook_secret,client_idandclient_secret