π¨βπ» Local Environment β
IMPORTANT
Your local ${USER} variable is important to us. It helps us create separated local environments while still allowing you to use cloud infrastrure without conflicts. You will notice a number of things are created with your ${USER} name.
Try to keep it constant through your adventure at Tellia
Prerequisites β
- Install
git
brew install gitBackend β
Prerequisites β
- Clone the repository
git clone https://github.com/tell-ia/tell-ia-solutions- Install packages. Run the setup script to prepare your local development environment:
CAUTION
Only MacOS supported
bashcd tell-ia-solutions ./scripts/setup.shOr install manually these packages
- Docker
- Docker compose
- MongoDB Compass (optional but recommended)
- Node.js
24(we recommend using NVM to manage NodeJS versions) - 1password desktop
- 1password CLI
- Gcloud CLI
- Slack
- Install dependencies
pnpm install- Authenticate Docker with GCP Artifact Registry (required for running tests)
gcloud auth login
gcloud auth configure-docker europe-docker.pkg.devSecrets (env:sync) β
Secrets are synced from 1Password into a local gitignored .env on demand β not on every server start, so the server doesn't prompt 1Password on each restart. The committed apps/agri-backend/.env.tpl holds op:// references (from the backend-dev item), and env:sync resolves them with op inject.
- Sign in to the 1Password CLI once (
op signin) β you need read access to therailway-envvault. - Sync the secrets (prompts your 1Password unlock once):
pnpm --filter agri-backend env:sync # op inject .env.tpl β .env- Start the backend β it reads the generated
.env, no 1Password prompt:
pnpm --filter agri-backend devRe-run env:sync whenever the backend-dev item changes (new/rotated secret). The first pnpm dev / VS Code Backend: debug run auto-syncs if .env is missing, so a fresh clone works; after that it stays silent until you sync again.
The web apps use the same mechanism from their own 1Password items. agri-mcp also has an .env.tpl, but no shared dev secrets β its TELLIA_API_KEY is a personal key you generate (POST /api-keys, super admin) and put in apps/agri-mcp/.env.local. Sync every app at once (backend + agri-frontend + agri-admin + agri-mcp) with the root command β this is what the VS Code Sync secrets launch config runs:
pnpm env:sync # regenerate every apps/*/.env from its .env.tplOr one app at a time:
pnpm --filter agri-frontend env:sync # op inject apps/agri-frontend/.env.tpl (frontend-dev item) β .env
pnpm --filter agri-admin env:sync # op inject apps/agri-admin/.env.tpl (admin-dev item) β .env
pnpm --filter @tellia-solutions/mcp env:sync # apps/agri-mcp/.env.tpl (literals only) β .envpnpm --filter <app> dev auto-syncs when that app's .env is missing, same as the backend. Adding a new app to the sync = commit an apps/<app>/.env.tpl; pnpm env:sync picks it up automatically.
Machine-specific overrides (e.g. your frpc public URL for Vapi callbacks) go in a gitignored apps/agri-backend/.env.local β env:sync appends it after the resolved template, so it wins:
# apps/agri-backend/.env.local
CALL_WEBHOOK_URL=https://<your-frpc-subdomain>-api.dev.review-time.infoSee Environments & secrets for the full model (buckets, per-env items, adding a new secret).
The
OP_SERVICE_ACCOUNT_TOKENgotcha:env:syncrunsenv -u OP_SERVICE_ACCOUNT_TOKEN op inject β¦soopauthenticates as you, not a service account (a service account only sees the vaults it was granted).
Starting Services β
Start the local development environment. This will deploy a stack of several services used by the teal for testing, debugging and so on.
# Starts docker containers in the background (compose file lives in apps/agri-backend)
cd apps/agri-backend && docker compose up -dConnecting to MongoDB β
Use MongoDB Compass with the following connection string:
mongodb://user:pass@localhost:27017/?authSource=admin&directConnection=trueLocal database seed β
WARNING
This will copy the production database to your local environment!
create-user-db.sh does two things: restores the production MongoDB into your local agri-backend database, and seeds Firebase Auth users (from tell-ia-production) into a destination of your choice.
Prerequisites β
op(1Password CLI) installed and signed in (op signin, or enable the desktop-app CLI integration). You need access to the Engineering and terraform vaults β the script reads the Firebase admin service accounts and thetell-ia-productionSCRYPT password-hash params from there.jq(brew install jq).- For a
localFirebase seed: the Auth emulator container must be running:bashcd apps/agri-backend && docker compose --profile firebase up -d firebase-auth-emulator
Mongo restore β
# the script lives in apps/agri-backend
cd apps/agri-backend
# Standard, will only download the dump once
./dev/scripts/create-user-db.sh
# Force re-sync with production
./dev/scripts/create-user-db.sh --dumpFirebase Auth seed β
Source is always tell-ia-production (so Firebase UIDs match the prod Mongo data). Pick the destination with FIREBASE_TARGET:
# local Auth emulator (default) β matches your restored prod Mongo data
./dev/scripts/create-user-db.sh
# Real projects (prompts you to type the target name to confirm):
FIREBASE_TARGET=dev ./dev/scripts/create-user-db.sh
FIREBASE_TARGET=staging ./dev/scripts/create-user-db.sh
# Firebase only, skip the Mongo restore
SKIP_MONGO=true FIREBASE_TARGET=dev ./dev/scripts/create-user-db.shUsers import merge by UID (same UID overwrites, new UIDs are added, existing target-only users are kept). Migrated password hashes keep working because the script imports with tell-ia-production's SCRYPT params.
Production is never written
The script only exports (read-only) from tell-ia-production. All writes go to the chosen target (emulator / tell-ia-dev / tell-ia-staging), authenticated with that target's own service account.
| Variable | Default | Purpose |
|---|---|---|
FIREBASE_TARGET | local | Destination: local | dev | staging |
SKIP_MONGO | false | true β skip the MongoDB dump/restore |
SKIP_FIREBASE | false | true β skip the Firebase seed |
FIREBASE_YES | false | true β skip the typed confirmation for real targets |
Start the backend β
Your favorite IDE must be base on vscode.
- Run the
π Backenddebugging configuration. - Validate start
curl http://localhost:3888
# Hello World%Alternatively you can you the command line:
pnpm --filter agri-backend devFrontend β
Prerequisites β
- Clone the repository
git clone https://github.com/tell-ia/tell-ia-solutions- Install dependencies
pnpm installSetup .env β
CAUTION
It seems the dev setup does not allow env variables to be loaded correctly from 1password mounted file.
Use 1password to edit & sync dev .env, but keep it disabled for now
- Set
.envfile Follow previouw steps with 1password to setup fyour.envfile. - After set up, copy the
.envfile - Disable 1password sync
- Re-create the
.envwith the previously copied content
Start the frontend β
pnpm --filter agri-frontend devThe app runs on Vite at http://localhost:5173.
Troubleshooting β
- Ensure all required environment variables are set
- Check Docker is running
- Verify network ports are not conflicted
Next steps β
- Play with Tellia
- Check the Observability section, your local development is automatically monitored !