Skip to content

👨‍💻 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

  1. Install git
bash
brew install git

Backend

Prerequisites

  1. Clone the repository
bash
git clone https://github.com/maisonbleue/agri_backend
  1. Install packages.
    Run the setup script to prepare your local development environment:

    CAUTION

    Only MacOS supported

    bash
    cd agri_backend
    ./dev/scripts/setup.sh
    Or install manually these packages
    - Docker
    - Docker compose
    - MongoDB Compass (optional but recommended)
    - Node.js `22` (we recommend using NVM to manage NodeJS versions)
    - [1password desktop](https://1password.com/downloads/)
    
  2. Install dependencies
bash
npm install

.env

Setup your local env file from 1password desktop application.

  1. Open settings

    alt text

  2. Set Show 1Password Developer experience

    alt text

  3. In Developer Click View Environment

    alt text

  4. Select backend-local

    alt text

  5. Click Configure destination

    alt text

  6. Check file is present
bash
ls /Users/${USER}/Documents/Git/tellai/agri_frontend/.env
# /Users/acouty/Documents/Git/tellai/agri_frontend/.env

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.

bash
# Starts docker containers in the background
docker-compose up -d

Connecting to MongoDB

Use MongoDB Compass with the following connection string:

mongodb://user:pass@localhost:27017/?authSource=admin&directConnection=true

Local database seed

WARNING

This will copy the production database to your local environment!

Create or refresh your development database:

bash
# Standard, will only download once
./dev/scripts/create-user-db.sh

# Force re-sync with production
./dev/scripts/create-user-db.sh --dump

Start the backend

Your favorite IDE must be base on vscode.

  1. Run the 🍃 Backend debugging configuration.
  2. Validate start
bash
curl http://localhost:3888
# Hello World%

Alternatively you can you the command line:

bash
npm run start:dev

Frontend

Prerequisites

  1. Clone the repository
bash
git clone https://github.com/maisonbleue/agri_frontend
  1. Install dependencies
bash
npm install

Setup .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

  1. Set .envfile Follow previouw steps with 1password to setup fyour .envfile.
  2. After set up, copy the .envfile
  3. Disable 1password sync
  4. Re-create the .env with the previously copied content

Start the frontent

Your favorite IDE must be base on vscode.

  1. Run the 🍃 Backend debugging configuration.
  2. Validate start
bash
curl http://localhost:3888
# Hello World%

Alternatively, run

bash
npm run dev

Troubleshooting

  • Ensure all required environment variables are set
  • Check Docker is running
  • Verify network ports are not conflicted

Next steps