| backend | ||
| frontend | ||
| .env.example | ||
| .gitignore | ||
| docker-compose.yml | ||
| Dockerfile | ||
| entrypoint.sh | ||
| README.md | ||
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
- In Authentik, create an OAuth2/OpenID Provider for TradeLog.
- Set the redirect URI to
https://your-domain/api/auth/oidc/{slug}/callback. - Add the link redirect URI
https://your-domain/api/auth/oidc/{slug}/link-callback. - Copy the generated Client ID and Client Secret.
- Find the Discovery URL. For Authentik this is typically
https://authentik.domain/application/o/{app-name}/.well-known/openid-configuration. - In TradeLog, sign in as an admin and go to Admin Panel → OIDC Providers → Add Provider.
- Fill in Name, Slug, Discovery URL, Client ID, Client Secret, and Scopes (
openid email profileis the default). - Click Test connection, then Save.
- 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