No description
Find a file
TradeLog Builder 9dfd234fdc
Update
2026-05-21 15:45:18 +02:00
backend Update 2026-05-21 15:45:18 +02:00
frontend Update 2026-05-21 15:45:18 +02:00
.env.example chore: scaffold tradelog project 2026-05-21 12:26:19 +02:00
.gitignore chore: scaffold tradelog project 2026-05-21 12:26:19 +02:00
docker-compose.yml docs: add deployment guide 2026-05-21 13:24:30 +02:00
Dockerfile chore: scaffold tradelog project 2026-05-21 12:26:19 +02:00
entrypoint.sh chore: scaffold tradelog project 2026-05-21 12:26:19 +02:00
README.md docs: add deployment guide 2026-05-21 13:24:30 +02:00

TradeLog

TradeLog is a self-hostable personal trading journal for futures and CFD traders. It helps you log trades by account, attach chart screenshots, calculate risk and reward at save time, and review performance by day, session, instrument, setup, direction, and trend.

The application is built as a single deployable web app: FastAPI serves the API and the production Vite React build, with SQLite and uploaded chart screenshots stored in a mounted data/ directory. It supports local username/password auth, forced password rotation for the default admin, and optional OpenID Connect providers for external sign-in.

Features

  • Local registration and login with bcrypt password hashing
  • JWT access and refresh tokens with automatic frontend refresh
  • OIDC login, auto-provisioning, auto-association, and user-side provider linking
  • Admin controls for users, password resets, auth settings, OIDC providers, instruments, and setups
  • Multiple trading accounts per user with account switching
  • Futures and CFD instruments with configurable tick or pip values
  • Trade logging with chart screenshots, paste/upload support, reorderable images, notes, and live risk/reward preview
  • Trade list with filters, session grouping, pagination, detail sheet, editing, and deletion
  • Dashboard with summary cards, daily P&L, instrument breakdown, recent sessions, and setup win rate
  • Analytics with equity curve, performance tables, weekday/session analysis, and calendar heatmap
  • Responsive app shell with desktop sidebar and mobile navigation sheet
  • Docker deployment with SQLite and upload volume mounts

Quick Start With Docker

git clone <your-repo-url> tradelog
cd tradelog
cp .env.example .env
# Edit .env and set SECRET_KEY to a random string at least 32 characters long
docker compose up -d
# Open http://localhost:8000
# Default login: admin / admin

On first login, the default admin account is forced to change its password.

Environment Variables

Name Description Default Required
SECRET_KEY Random secret used to sign JWTs and OIDC state. Use at least 32 characters. Development fallback only Yes
DATABASE_URL SQLAlchemy async database URL. For Docker, use sqlite+aiosqlite:////app/data/tradelog.db. sqlite+aiosqlite:///./data/tradelog.db No
UPLOAD_DIR Directory for uploaded chart screenshots. ./data/uploads No
BASE_URL Public base URL used to build OIDC callback URLs. http://localhost:8000 Yes for OIDC
CORS_ORIGINS Comma-separated origins for local frontend development. http://localhost:5173,http://127.0.0.1:5173 No

OIDC Setup Guide: Authentik

  1. In Authentik, create an OAuth2/OpenID Provider for TradeLog.
  2. Set the redirect URI to https://your-domain/api/auth/oidc/{slug}/callback.
  3. Add the link redirect URI https://your-domain/api/auth/oidc/{slug}/link-callback.
  4. Copy the generated Client ID and Client Secret.
  5. Find the Discovery URL. For Authentik this is typically https://authentik.domain/application/o/{app-name}/.well-known/openid-configuration.
  6. In TradeLog, sign in as an admin and go to Admin Panel → OIDC Providers → Add Provider.
  7. Fill in Name, Slug, Discovery URL, Client ID, Client Secret, and Scopes (openid email profile is the default).
  8. Click Test connection, then Save.
  9. Confirm the provider appears on the login page. Auto-provision and auto-associate can be toggled per provider.

If you disable password login, TradeLog requires at least one enabled OIDC provider so administrators cannot lock everyone out.

Development Setup

Backend:

cd backend
python -m venv ../.venv
source ../.venv/bin/activate
pip install -r requirements.txt
alembic upgrade head
python seed.py
uvicorn app.main:app --reload

Frontend:

cd frontend
npm install
VITE_API_URL=http://localhost:8000 npm run dev

The Vite dev server proxies /api to the backend when VITE_API_URL is set. For production, run npm run build; the FastAPI app serves frontend/dist.

Data Storage

  • SQLite database: data/tradelog.db
  • Uploads: data/uploads/{trade_id}/

Back up the whole data/ directory to preserve both database records and chart screenshots.

License

MIT