A full-stack multi-broker portfolio dashboard built with React (Vite) + FastAPI (Python). Connect your Alpaca and Binance accounts to view real-time positions, capital, and P&L in one unified interface.
- 📊 Real-time Dashboard — auto-syncs live data with customizable intervals (15/30/60s).
- 🔄 Manual Refresh — trigger an immediate sync from the Dashboard at any time.
- 🏦 Multi-Broker Hub — connect Alpaca and Binance accounts into one interface.
- 🔐 Dual-Layer Security — Two-Factor Authentication (MFA) and Fernet API secret encryption.
- 🌙 Theme Control — toggle between Dark, Light, and System themes in App Settings.
- 👤 UserProfile management — centered profile management with avatar uploading.
- 📄 Data Portability — export your full portfolio and activity as clean PDF reports or JSON backups.
- 🔑 Recovery Flow — dedicated Forgot Password and secure Reset Password screens.
We prioritize the safety of your financial credentials:
- At-Rest Encryption: Your Broker API Keys and Secrets are encrypted using AES-256 (via the Fernet specification) before they ever touch our database.
- 2FA Support: Enable Two-Factor Authentication in the App Settings for an extra layer of login security.
- Password Sovereignty: Dedicated, mobile-responsive screens for password recovery and account-rotation.
git clone https://github.com/anasfarock/portfolio-engine.git
cd portfolio-engine# Windows
cd backend
setup.bat# macOS / Linux
cd backend && chmod +x setup.sh && ./setup.shAlternatively:
python -m venv venv→ activate →pip install -r requirements.txt
Create backend/.env:
PORTFOLIO_DB_URL=postgresql://user:password@localhost/portfolio_db
SECRET_KEY=your_super_secret_jwt_key
ENCRYPTION_KEY=your_generated_fernet_keySQLite fallback: omit
PORTFOLIO_DB_URLand a localportfolio.dbfile will be used automatically.
Generate a valid ENCRYPTION_KEY:
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
⚠️ ENCRYPTION_KEYis required — the backend will refuse to start without it.
uvicorn main:app --reload.\venv\Scripts\python.exe -m uvicorn main:app --reloadBackend runs at → http://localhost:8000
cd frontend
npm install
npm run devFrontend runs at → http://localhost:5173
- Sign in and open the Avatar dropdown → Manage API Keys
- Click + Link Broker, select your broker, and optionally assign a Nickname (useful if connecting multiple accounts from the same provider).
| Field | Value |
|---|---|
| API Key | From app.alpaca.markets |
| Secret Key | Your Alpaca secret |
| Endpoint | https://paper-api.alpaca.markets (or leave blank) |
| Field | Value |
|---|---|
| API Key | From demo.binance.com → API Management |
| Secret Key | Your Binance Demo secret |
| Endpoint | https://demo-api.binance.com (or leave blank) |
- Click Connect — the dashboard will auto-sync on the next poll (within 15 seconds), or use the 🔄 Refresh button to sync immediately.
- Total Capital — total account equity across all connected brokers
- Assets Value — combined market value of all live positions
- Active Positions — count of open holdings
- 24h Return — unrealized return percentage
Use the 🏦 Accounts dropdown to filter the holdings table and trade history by specific accounts or nicknames.