An intelligent intermediary platform between employers and freelancers that:
- Auto-decomposes project descriptions into verifiable milestones using AI
- Holds payments in escrow locked per milestone
- Verifies deliverables using AI evaluation + Docker sandbox test execution
- Auto-releases payments when confidence ≥ 80%
- Scores freelancers via the Professional Fidelity Index (PFI, 300–850)
┌─────────────────────────────────────────────────────────┐
│ FRONTEND (Next.js) │
│ Employer Dashboard │ Freelancer Dashboard │ Auth │
└──────────────────────────────┬──────────────────────────┘
│ HTTP/REST
┌──────────────────────────────▼──────────────────────────┐
│ BACKEND (FastAPI) │
│ │
│ /auth /projects /milestones /payments /reputation │
│ │
│ ┌───────────────┐ ┌─────────────────┐ ┌───────────┐ │
│ │ Milestone │ │ QA Engine │ │ Escrow │ │
│ │ Generator │ │ (LLM + Docker) │ │ Service │ │
│ │ (LLM Chain) │ └────────┬────────┘ └─────┬─────┘ │
│ └───────┬───────┘ │ │ │
│ │ ┌──────▼──────┐ ┌──────▼─────┐ │
│ │ │ Docker │ │ PFI │ │
│ │ │ Sandbox │ │ Scoring │ │
│ │ └─────────────┘ └────────────┘ │
└──────────┼──────────────────────────────────────────────┘
│
┌──────────▼──────────┐
│ PostgreSQL 16 │
│ users, projects, │
│ milestones, escrow,│
│ evaluations, PFI │
└─────────────────────┘
- Docker & Docker Compose
- OpenAI or Anthropic API key
git clone <repo-url> bitlance
cd bitlance
cp .env.example .env
# Edit .env and add your OPENAI_API_KEY or ANTHROPIC_API_KEYdocker compose up --buildServices:
| Service | URL |
|---|---|
| Frontend | http://localhost:3000 |
| Backend API | http://localhost:8000 |
| API Docs (Swagger) | http://localhost:8000/docs |
| PostgreSQL | localhost:5432 |
bash infra/scripts/seed.shThis creates:
- employer@test.com /
Password123!(employer) - freelancer@test.com /
Password123!(freelancer)
cd backend
# Create virtualenv
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install deps
pip install -r requirements.txt
# Start PostgreSQL locally (or use Docker just for DB)
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_DB=bitlance postgres:16-alpine
# Copy and configure env
cp .env.example .env
# Start API
uvicorn app.main:app --reload --port 8000cd frontend
npm install
cp .env.example .env.local
npm run devcd backend
pip install pytest pytest-asyncio httpx
pytest tests/ -vbitlance/
├── backend/
│ ├── app/
│ │ ├── main.py # FastAPI app entry point
│ │ ├── config.py # Settings (env vars)
│ │ ├── database.py # Async SQLAlchemy engine
│ │ ├── api/ # Route handlers
│ │ │ ├── auth.py
│ │ │ ├── projects.py
│ │ │ ├── milestones.py
│ │ │ ├── payments.py
│ │ │ └── reputation.py
│ │ ├── models/ # SQLAlchemy ORM models
│ │ ├── schemas/ # Pydantic request/response schemas
│ │ ├── services/ # Business logic
│ │ │ ├── escrow_service.py
│ │ │ └── pfi_service.py
│ │ ├── ai/ # AI modules
│ │ │ ├── milestone_generator.py
│ │ │ ├── qa_engine.py
│ │ │ ├── code_evaluator.py
│ │ │ └── prompts.py
│ │ └── utils/
│ │ └── security.py # JWT auth helpers
│ └── tests/
├── frontend/
│ └── src/
│ ├── app/ # Next.js App Router pages
│ └── lib/ # API client & types
├── infra/
│ ├── sql/init.sql # Full DB schema
│ └── scripts/
├── docs/api.md
└── docker-compose.yml
- Employer submits project description + budget
- AI (GPT-4o/Claude) decomposes into 3–8 milestones
- Milestones stored with acceptance criteria
- Employer deposits funds → locked in escrow per milestone
- Freelancer submits work (repo URL, content, etc.)
- Milestone status →
submitted
- Employer triggers evaluation
- QA Engine runs:
- Code: Docker sandbox tests + LLM review
- Content: LLM rubric scoring
- Returns
{ completion_status, confidence_score, feedback } - If
complete+ confidence ≥ 80% → payment auto-released - PFI score updated for freelancer
PFI = (0.40 × success_rate
+ 0.30 × avg_quality_score
+ 0.20 × deadline_adherence
+ 0.10 × (1 − dispute_rate)) × 550 + 300
Range: 300 (worst) → 850 (perfect)
| Variable | Required | Description |
|---|---|---|
OPENAI_API_KEY |
One of these | OpenAI API key |
ANTHROPIC_API_KEY |
One of these | Anthropic Claude API key |
AI_MODEL |
No | Default: gpt-4o |
SECRET_KEY |
Yes | JWT signing secret |
DATABASE_URL |
Yes | PostgreSQL async URL |
PLATFORM_FEE_PERCENT |
No | Default: 5.0 |
- Create a PostgreSQL database on Render
- Create a Web Service pointing to
/backend, build command:pip install -r requirements.txt, start:uvicorn app.main:app --host 0.0.0.0 --port $PORT - Create a second Web Service for
/frontend, build:npm install && npm run build, start:npm start - Set environment variables from
.env.example
railway login
railway init
railway add postgresql
railway upSee the Manual Tasks section at the bottom for what you must configure yourself.
- JWT tokens expire after 24 hours (configurable)
- Docker sandbox runs with
--network none,--read-only,--memory 256m - Escrow funds never released without AI verification
- Role-based access: employers create/fund, freelancers submit, both can view
MIT — built as an MVP prototype. Not production-ready for real financial transactions without proper payment provider integration.