# Path Trader

> Self-funded SaaS for Brazilian traders: journaling, analytics, broker imports and an AI assistant with RAG and an MCP server. Technical co-founder and only engineer, now serving about 70 customers.

Case study · Vinícius Albuquerque · Technical co-founder · only engineer · Jan 2026 – present · https://www.vinicius-albuquerque.com.br/en

- Live site: https://www.path-trader.com.br/
- Case study (HTML): https://www.vinicius-albuquerque.com.br/en/projeto/path-trader

## Problem

Brazilian traders journal their trades in spreadsheets, if at all, so they can't see their own patterns: which setups pay, when they overtrade, how much risk they really take. Path Trader turns imported trades into a journal and analytics, with an AI assistant that answers questions over the trader's own data.

## What I built

- pnpm + Turborepo monorepo: four Next.js 16 apps and a NestJS 11 API (56 modules) sharing 11 packages and a 74-model Prisma schema
- AI assistant: multi-agent router with tool calling and RAG on pgvector, on OpenAI or AWS Bedrock, with per-plan monthly cost budgets
- OAuth-protected MCP server so traders can use their journal from Claude and other MCP clients
- Asaas billing with authenticated, idempotent webhook handlers, daily reconciliation and automatic NFS-e invoices
- Eight broker import parsers and pg-boss queues for AI turns, imports and notifications, with Pusher realtime and AWS S3/SES
- ~500 Jest and Playwright test files and 16 GitHub Actions workflows: tests, e2e suites, automated releases, backups and deploys to Vercel and Fly

## Hard part: Billing that never loses an event

Subscriptions run on Asaas, and a payment webhook that is dropped or delivered twice means a customer loses access or gets charged wrong. Webhooks are authenticated and processed asynchronously by idempotent handlers, so a retry is a no-op; a daily job reconciles with Asaas to catch anything missed, and service invoices (NFS-e) are issued automatically. The AI assistant gets the same care on cost: every request is priced from its tokens and checked against a monthly budget per plan.

## Result

About 70 customers, 540 merged pull requests and about 56 production deployments, each gated by GitHub Actions running type checks, unit and end-to-end tests. Built and run as the only engineer and technical co-founder; my partner brought the idea and runs marketing.

## Architecture

Next.js apps (Web app (PWA); Admin; Marketing site) → NestJS API (56 modules; Rate limiting) → Services (PostgreSQL + pgvector; pg-boss jobs; Asaas billing; OpenAI / Bedrock; S3, SES, Pusher)

Sentry across the API and public apps · 16 GitHub Actions workflows deploy to Vercel and Fly

## Overview

Path Trader is an independent, self-funded platform that helps Brazilian traders journal their operations, review performance and manage risk. I co-founded it with a partner who brought the idea and runs marketing; as the only engineer I own the whole technology side, and it now serves about 70 customers. It is a pnpm + Turborepo monorepo with four Next.js 16 apps (the web app, the marketing site, the admin panel and a landing page) and a NestJS 11 API, sharing eleven internal packages and one Prisma schema of 74 models on PostgreSQL across 56 API modules. Trades come in through eight broker-specific import parsers (MetaTrader 4/5, Profit, TradingView and others). The AI assistant is a multi-agent chat router with tool calling and retrieval over a pgvector corpus; it runs on OpenAI or AWS Bedrock behind a provider abstraction, prices every request from its tokens, and enforces a monthly cost budget per plan. An OAuth-protected MCP server lets traders query their own journal from Claude and other MCP clients. Billing runs on Asaas subscriptions: webhooks are authenticated and processed asynchronously by idempotent handlers, a daily job reconciles missed events, and service invoices (NFS-e) are issued automatically. Long-running work such as AI turns, imports and notifications goes through pg-boss queues on Postgres, with realtime updates over Pusher and storage and email on AWS S3/SES. The web app is a Serwist PWA, the API is hardened with helmet and global rate limiting, Sentry covers the API and public apps, and about 500 Jest and Playwright test files run across 16 GitHub Actions workflows that release and deploy to Vercel and Fly.

## Technologies

Turborepo, Next.js, NestJS, TypeScript, PostgreSQL, Prisma, pgvector, OpenAI, AWS, Playwright

## Screenshots

![Path Trader analytics: P&L, trade duration and holding time plotted over the month](https://www.vinicius-albuquerque.com.br/projects/path-trader/path-trader-analytics.webp)

![Path Trader dashboard: KPI cards and a monthly P&L calendar](https://www.vinicius-albuquerque.com.br/projects/path-trader/path-trader-dashboard.webp)

![Path Trader trader routine: daily discipline chart, habit stats and monthly checklist](https://www.vinicius-albuquerque.com.br/projects/path-trader/path-trader-routine.webp)
