Barfinex

Blog

TutorialBarfinex Team

Quick Start: Run Barfinex Provider in 30 Minutes

Step-by-step guide to get your first Barfinex data pipeline running locally. Clone, configure, start — and verify data is flowing.

#tutorial#getting-started#provider#docker

Prerequisites

  • Docker and Docker Compose
  • Node.js 20+
  • Git

On Windows, use WSL2 for smooth Docker networking.

1. Clone

git clone https://github.com/barfinex/monorepo.git
cd monorepo/trading.apps

2. Configure

cp apps/provider/.env.example apps/provider/.env

Edit apps/provider/.env:

PROVIDER_PORT=8081
PROVIDER_BEARER_TOKEN=your-dev-token-here
DATABASE_URL=postgresql://barfinex:barfinex@localhost:5432/barfinex_provider
REDIS_URL=redis://localhost:6379

The bearer token can be any string for local development.

3. Start Infrastructure

docker-compose -f docker-compose.infra.yml up -d

This starts PostgreSQL (candle storage) and Redis (event bus). Wait ~10 seconds for them to be ready.

4. Run Migrations

cd apps/provider
npm install
npx prisma migrate deploy

5. Start Provider

npm run start:dev

You should see:

[Provider] Bootstrap complete
[Provider] REST API listening on :8081
[Provider] WebSocket gateway ready

6. Verify

Check health:

curl -H "Authorization: Bearer your-dev-token-here" http://localhost:8081/api/health

7. Add Your First Subscription

curl -X POST \
  -H "Authorization: Bearer your-dev-token-here" \
  -H "Content-Type: application/json" \
  -d '{"exchange": "binance", "symbol": "BTCUSDT", "timeframes": ["1m", "5m", "1h"]}' \
  http://localhost:8081/api/subscriptions

8. Check Data

curl -H "Authorization: Bearer your-dev-token-here" \
  "http://localhost:8081/api/candles?symbol=BTCUSDT&timeframe=1m&limit=5"

Five candles in the response = your pipeline is working.

Next Steps

Troubleshooting

Can't connect to PostgreSQL — check that Docker Compose is running and DATABASE_URL matches.

Empty candles response — wait 30-60 seconds after subscribing. Provider backfills history on first subscription.

Auth errors — make sure the Bearer token matches PROVIDER_BEARER_TOKEN in .env.

Related articles

Let’s Get in Touch

Have questions or want to explore Barfinex? Send us a message.