-
Notifications
You must be signed in to change notification settings - Fork 49
Getting‐Started‐&‐Local‐Setup
This guide walks you through setting up the Truxify monorepo on your local machine for development. Truxify runs a hybrid stack of Flutter client apps, a Node.js Express server, a FastAPI Python service, a local Polygon/Hardhat environment, and databases running in Docker.
Before starting, ensure you have the following installed:
- Flutter SDK 3.x (with Android Studio or Xcode for mobile emulators)
- Node.js 20.x + npm
- Python 3.10+ + pip (virtual environments recommended)
- Docker Desktop (or Docker engine with Compose V2)
- Git
Truxify is structured as a monorepo:
Truxify/
├── apps/
│ ├── customer/ # Flutter customer (manufacturer) app
│ └── driver/ # Flutter driver app
├── backend/
│ ├── api/ # Node.js + Express API Gateway
│ └── ml/ # FastAPI + Python Machine Learning Engine
├── blockchain/ # Polygon Solidity contracts (Hardhat project)
├── automation/ # n8n automation pipeline json configurations
├── packages/
│ └── truxify_shared/ # Shared Dart package for apps (models, styles)
├── docs/ # System diagrams, SQL schema, migrations, and wiki
└── docker-compose.yml # Local database & services launcher
-
Clone the repository to your local machine:
git clone https://github.com/KanishJebaMathewM/Truxify.git cd Truxify -
Copy the example root environment file to
.env:cp .env.example .env
Note: For local development, placeholder values are provided. Keep sensitive keys out of version control.
Truxify utilizes Docker Compose to run PostgreSQL (with PostGIS extensions), MongoDB, and Redis.
Start the database services in the background:
docker compose up -d db mongo redisThis starts the databases on their default ports:
-
PostgreSQL:
localhost:5432 -
MongoDB:
localhost:27017 -
Redis:
localhost:6379
To set up the 27 database tables and required RPC functions:
- Ensure the PostgreSQL container is active.
- Open your preferred SQL client (e.g., pgAdmin, DBeaver) or run the SQL script using your client, pointing to
postgresql://postgres:postgres@localhost:5432/postgres. - Execute the contents of
docs/supabase_setup.sqlto set up all tables, indices, and functions. - Execute any outstanding migrations located in
docs/migrations/if you are catching up to the latest features.
The gateway server coordinates authentication, web sockets, database transactions, and blockchain relaying.
- Navigate to the backend directory:
cd backend/api - Install npm packages:
npm install
- Copy the backend-specific environment template:
(Ensure credentials match your local Docker database ports and Firebase configurations)
cp .env.example .env
- Run the API server in development mode (with hot-reloading):
The API will run at
npm run dev
http://localhost:5000. You can verify it by checkinghttp://localhost:5000/health.
The ML engine runs demand forecasting and matching calculations on FastAPI.
- Navigate to the ML folder:
cd ../ml - Create and activate a Python virtual environment:
-
Windows:
python -m venv venv venv\Scripts\activate
-
macOS / Linux:
python3 -m venv venv source venv/bin/activate
-
Windows:
- Install dependencies:
pip install -r requirements.txt
- Start the development server:
The service will be available at
uvicorn app.main:app --reload --port 8000
http://localhost:8000. You can view the interactive API swagger documentation athttp://localhost:8000/docs.
Truxify uses smart contracts to manage trustless escrow and reputational scoring.
- Navigate to the blockchain directory:
cd ../../blockchain - Install dependencies:
npm install
- Copy the environment config:
cp .env.example .env
- Start a local Ethereum/Polygon network node:
This will spin up a local JSON-RPC server at
npx hardhat node
http://127.0.0.1:8545and print 20 test accounts with private keys. - In a new terminal tab (keeping the node running), deploy the smart contracts:
Save the outputted contract addresses (e.g.,
npx hardhat run scripts/deploy.js --network localhost
EscrowandReputation) and add them to yourbackend/api/.envfile.
Ensure you have your Android emulator or iOS simulator running, or connect a physical device in developer mode.
- Open a terminal and navigate to the customer app directory:
cd apps/customer - Fetch Flutter packages:
flutter pub get
- Launch the application:
flutter run
- Navigate to the driver app directory:
cd ../driver - Fetch Flutter packages:
flutter pub get
- Launch the application:
flutter run
If you do not want to run individual command lines, you can run the full backend ecosystem (Express API, MongoDB, PostgreSQL, Redis, FastAPI ML Engine) inside a unified container stack:
docker compose up --buildOnce the Docker containers or local commands are running, you can reach endpoints at:
-
Node.js Express API:
http://localhost:5000 -
FastAPI ML Swagger Docs:
http://localhost:8000/docs(orhttp://localhost:8001/docsin Docker Compose) -
Local Hardhat RPC Node:
http://localhost:8545 -
PostgreSQL Connection String:
postgresql://postgres:postgres@localhost:5432/postgres -
MongoDB Connection URI:
mongodb://localhost:27017 -
Redis Connection URI:
redis://localhost:6379