A full-stack monorepo for monitoring global trade disruptions and supply chain risks in real-time.
tradeguard-ai/
βββ apps/
β βββ web/ # Next.js frontend application
β βββ app/ # Next.js 13+ app directory (routes)
β βββ public/ # Static assets
β βββ styles/ # Global styles
β βββ package.json # Web app dependencies
β
βββ services/
β βββ api/ # FastAPI backend service
β βββ routes/ # API route handlers
β βββ main.py # FastAPI app entry point
β βββ database.py # Database configuration
β βββ models.py # SQLAlchemy models
β βββ seed_data.py # Mock data generator
β βββ requirements.txt # Python dependencies
β
βββ packages/ # Shared packages (monorepo)
β βββ ui/ # React UI components library
β β βββ ui/ # Base shadcn/ui components
β β βββ *.tsx # Custom business components
β βββ hooks/ # Shared React hooks
β β βββ use-auth.ts
β β βββ use-websocket.ts
β β βββ use-toast.ts
β βββ lib/ # Shared utilities
β βββ utils.ts # Helper functions (cn, etc.)
β
βββ infra/ # Infrastructure & DevOps
β βββ docker-compose.yml # Local development setup
β βββ Dockerfile.prod # Production Docker image
β βββ nginx.conf # Nginx reverse proxy config
β
βββ .github/
β βββ workflows/ # CI/CD pipelines
β
βββ pnpm-workspace.yaml # PNPM workspace configuration
βββ .gitattributes # Git line ending normalization
βββ .editorconfig # Editor consistency settings
βββ README.md # This file
Monorepo Structure (managed by PNPM workspaces):
TradeGuardAI/
βββ apps/
β βββ web/ # Next.js 16 frontend (React 19, Tailwind CSS 4)
βββ services/
β βββ api/ # FastAPI backend (Python 3.11+, SQLite)
βββ packages/
β βββ ui/ # Shared React components (shadcn/ui)
β βββ hooks/ # Shared React hooks
β βββ lib/ # Shared utilities
βββ infra/ # Docker & deployment configs
Tech Stack:
- Frontend: Next.js 16, TypeScript, Tailwind CSS 4, Radix UI, Recharts
- Backend: FastAPI, SQLAlchemy, Uvicorn
- Infrastructure: Docker, GitHub Actions
Dashboard:
- π Real-time event feed with risk map
- π 30-day risk forecasts for SKUs
- π Event notifications
- π Multi-SKU analytics
Analytics:
- π Risk trend analysis
- π― Sentiment analysis
- π Custom report builder
- π Advanced filtering
Data:
- 10 mock trade disruption events
- 5 SKUs with risk profiles
- Real-time WebSocket updates
- Node.js 18+ & pnpm 8+
- Python 3.11+
- Docker (optional)
# 1. Install frontend dependencies
pnpm install
# 2. Initialize database (Terminal 1)
cd services/api
python seed_data.py
# 3. Start backend (keep Terminal 1 running)
python -m uvicorn main:app --reload
# β http://127.0.0.1:8000
# 4. Start frontend (Terminal 2)
cd ../..
pnpm dev
# β http://localhost:3000cd infra
docker-compose up
# Frontend: http://localhost:3000
# Backend: http://localhost:8000That's it! Visit http://localhost:3000 to see the dashboard.
Base URL: http://localhost:8000
GET /api/health # Health check
GET /api/events # List events (limit: 10)
GET /api/events/{id} # Event details
GET /api/sku # List SKUs (sorted by risk)
GET /api/sku/{id} # SKU details
GET /api/forecast/{sku_id} # 30-day risk forecast
GET /api/analytics/gtri # Global Trade Risk Index
GET /docs # Interactive API docs
MIT License - See LICENSE for details.