Skip to content

VYDev37/Trade-Performance-Tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Trade Performance Tracker

A premium, full-stack, real-time portfolio management and financial auditing application tailored for tracking stock portfolios, analyzing trade performances, and monitoring personal cashflows.

✨ Core Features

  • Advanced Security & Authentication: Secure login and registration system utilizing JWT verification and Argon2id password hashing, enhanced with automated skeleton suspense loaders for a seamless user experience.
  • IDX Composite Terminal: A high-performance trading terminal rendering real-time stock details, fundamental metrics, and interactive charts powered by TradingView's lightweight-charts.
  • Automated Market Feeds: Integration of background daemons and modules to fetch live tick prices and historical candlestick data directly from Yahoo Finance.
  • Multi-Account Financial Tracker: Manage multiple distinct broker portfolios and bank accounts under a single unified dashboard. Includes dynamic budget tracking, consolidated balance sheets, and mobile-responsive chronological cashflow views.
  • Trade Management & Audits: Record buy/sell actions with custom execution fee inputs. Track current holdings and live performance with detailed, paginated transaction histories equipped with server-side filtering and search.
  • Interactive Analytics Dashboard: A visual overview of account balances and portfolio allocations with interactive data visualization powered by Recharts.
  • Shareable Trade Cards: Instant generation of clean, professional PnL and ROI performance report cards, perfect for sharing trading results.
  • Comprehensive Trading Journals: Document trading plans and personal notes with rich-text support, cloud-backed image attachments, and responsive card-based layouts for both desktop and mobile.
  • Profile Configuration: Manage user settings and adjust balance sheet structures dynamically to fit evolving financial needs.
  • AI Portfolio Auditor (Coming Soon): A built-in intelligent agent designed to analyze trading habits, detect performance anomalies, and offer custom advisory insights..

πŸ›  Tech Stack

Backend (Go Engine)

  • Language & Runtime: Go 1.25+
  • Core HTTP Engine: Fiber v3 (High-performance, low-overhead routing)
  • Database Engine: PostgreSQL with connection pooling
  • ORM Persistence Layer: GORM (Auto-migrations and relational bindings)
  • Data Validation & Security: Argon2id crypt hashes, struct validations
  • Architecture: Domain-Driven Design (DDD) & Clean Architecture

Frontend (Next.js Platform)

  • Core Platform: Next.js 16 (App Router, Server Components by default)
  • View Layer: React 19
  • State Management: Zustand
  • Data Validation: Zod (Type-safe schemas)
  • Styling & UI: Vanilla CSS and Tailwind CSS v4
  • Components System: shadcn/ui (Radix UI), Lucide Icons
  • Data Fetching: Axios
  • Interactive Visualizers: Recharts & TradingView Lightweight Charts
  • Package Manager: pnpm

πŸ“‚ Project Structure

Trade-Performance-Tracker/
β”œβ”€β”€ backend/                    # Go API Engine
β”‚   β”œβ”€β”€ cmd/                    # Application Entrypoints
β”‚   β”‚   └── api/                # Fiber API runtime
β”‚   β”‚       └── main.go         # Bootstraps configuration, DB, handlers, and routers
β”‚   β”œβ”€β”€ core/                   # Domain-Driven Design Core
β”‚   β”‚   β”œβ”€β”€ config/             # DB connectivity, pooling & environment configs
β”‚   β”‚   β”œβ”€β”€ delivery/           # Request controllers & endpoint routing
β”‚   β”‚   β”‚   β”œβ”€β”€ handlers/       # Endpoint handlers (user, positions, notes, assets, etc.)
β”‚   β”‚   β”‚   └── http/           # Fiber router configuration (routers.go)
β”‚   β”‚   β”œβ”€β”€ domain/             # Core business models, GORM structures & contracts
β”‚   β”‚   β”œβ”€β”€ integrations/       # Live market data scrapers & scanner feeds
β”‚   β”‚   β”‚   └── providers/      # TV Scanner (TradingView) & Yahoo Finance adapters
β”‚   β”‚   β”œβ”€β”€ repositories/       # Database access layers & persistence queries
β”‚   β”‚   β”œβ”€β”€ script/             # Executable utilities (auto-migrate.go script)
β”‚   β”‚   β”œβ”€β”€ services/           # Enterprise logic, use cases & calculations
β”‚   β”‚   └── worker/             # Background daemons (update_stock.go price synchronizer)
β”‚   β”œβ”€β”€ pkg/                    # Reusable framework utilities
β”‚   β”‚   β”œβ”€β”€ middleware/         # Security & JWT router guards
β”‚   β”‚   └── utils/              # Crypt encoders, number formatters, error wrappers
β”‚   β”œβ”€β”€ .dockerignore           # Excluded files for containerization
β”‚   β”œβ”€β”€ .env.example            # Backend environment blueprint
β”‚   β”œβ”€β”€ .gitignore              # Git patterns to ignore in backend
β”‚   β”œβ”€β”€ Dockerfile              # Go lightweight production container
β”‚   β”œβ”€β”€ go.mod                  # Go engine dependencies
β”‚   β”œβ”€β”€ go.sum                  # Dependecies checksum verification
β”‚   └── README.md               # Backend technical guide
β”‚
β”œβ”€β”€ frontend/                   # Next.js Application
β”‚   β”œβ”€β”€ app/                    # Next.js App Router (Strictly route pages and layouts)
β”‚   β”‚   β”œβ”€β”€ (account)/          # Auth routes (login, register) with Server/Client splits
β”‚   β”‚   β”‚   β”œβ”€β”€ loading.tsx     # Animated auth page skeleton loader
β”‚   β”‚   β”‚   β”œβ”€β”€ login/          # LoginPage Server parent + LoginClient interactive form
β”‚   β”‚   β”‚   └── register/       # RegisterPage Server parent + RegisterClient interactive form
β”‚   β”‚   β”œβ”€β”€ admin/              # Secured administrative dashboard views
β”‚   β”‚   β”‚   β”œβ”€β”€ assistant/      # AI Copilot layout and conversational workspace
β”‚   β”‚   β”‚   β”œβ”€β”€ calculator/     # Position sizing & risk-reward ratio calculator
β”‚   β”‚   β”‚   β”œβ”€β”€ composite/      # IDX Composite Terminal details & lightweight-charts UI
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/      # Unified balance summaries & key statistics
β”‚   β”‚   β”‚   β”œβ”€β”€ journals/       # Notebook space & formatted journal cards
β”‚   β”‚   β”‚   β”œβ”€β”€ profile/        # Accounts management, asset splits & passwords
β”‚   β”‚   β”‚   β”œβ”€β”€ stocks/         # Holdings trackers with dynamic metadata routing
β”‚   β”‚   β”‚   └── transactions/   # Filterable logs, trade audits & fee records
β”‚   β”‚   β”œβ”€β”€ favicon.ico         # App Favicon
β”‚   β”‚   β”œβ”€β”€ globals.css         # Typography, tailwind layers & scroll themes
β”‚   β”‚   β”œβ”€β”€ layout.tsx          # Root HTML frame & fonts binding
β”‚   β”‚   └── page.tsx            # Main landing page route entrypoint
β”‚   β”œβ”€β”€ components/             # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ calculator/         # Custom numeric pads and input screens
β”‚   β”‚   β”œβ”€β”€ dashboard/          # Account balance widgets & charts cards
β”‚   β”‚   β”œβ”€β”€ journal/            # Note editors & popup sheet displays
β”‚   β”‚   β”œβ”€β”€ profile/            # Allocation charts & manage-balance side sheets
β”‚   β”‚   β”œβ”€β”€ shared/             # Common Dialog wrappers, image boxes & modals
β”‚   β”‚   β”œβ”€β”€ stock/              # Position selectors & custom charts
β”‚   β”‚   β”œβ”€β”€ terminal/           # TradingView lightweight chart visualizers
β”‚   β”‚   β”œβ”€β”€ tracker/            # Budgeting columns & mobile-friendly lists
β”‚   β”‚   β”œβ”€β”€ trades/             # Performance modal wrappers & ROI sheets
β”‚   β”‚   β”œβ”€β”€ transaction/        # Responsive table structures & data columns
β”‚   β”‚   β”œβ”€β”€ ui/                 # Shadcn/ui core primitive components
β”‚   β”‚   β”œβ”€β”€ user/               # Authentication controls & reusable input forms
β”‚   β”‚   β”œβ”€β”€ AdminSidebar.tsx    # Main navigation bar layout
β”‚   β”‚   └── ThemeProvider.tsx   # System theme contexts switcher
β”‚   β”œβ”€β”€ hooks/                  # Custom React hooks (domain-specific & viewport helpers)
β”‚   β”‚   β”œβ”€β”€ asset/              # IDX composite details and candle chart queries
β”‚   β”‚   β”œβ”€β”€ calculator/         # Formulas and evaluations helpers
β”‚   β”‚   β”œβ”€β”€ note/               # Journal fetchers, adders, modifiers, and deleters
β”‚   β”‚   β”œβ”€β”€ position/           # Holdings mutations and live-prices socket listeners
β”‚   β”‚   β”œβ”€β”€ table/              # Sorting and paginating helpers
β”‚   β”‚   β”œβ”€β”€ transaction/        # Historical lists queries and migrations handlers
β”‚   β”‚   β”œβ”€β”€ use-mobile.ts       # Global viewport width detector helper
β”‚   β”‚   └── user/               # Auth session actions, registration flows, and profiles
β”‚   β”œβ”€β”€ lib/                    # Standard utilities, formatting, and axios configurations
β”‚   β”‚   β”œβ”€β”€ axios.ts            # Preconfigured axios instance routing to backend endpoints
β”‚   β”‚   β”œβ”€β”€ formatter.ts        # Currency conversion, dates, and number formatters
β”‚   β”‚   └── utils.ts            # Class merging utility (cn) helper
β”‚   β”œβ”€β”€ schemas/                # Safe runtime validators enforced via Zod
β”‚   β”‚   β”œβ”€β”€ asset.schema.ts     # IDX asset data formats validation
β”‚   β”‚   β”œβ”€β”€ auth.schema.ts      # Authentication models validation
β”‚   β”‚   β”œβ”€β”€ balance.schema.ts   # Capital and balance transaction data validator
β”‚   β”‚   β”œβ”€β”€ journal.schema.ts   # Journal logs and attachments validator
β”‚   β”‚   └── transaction.schema.ts # Orders and trade executions validator
β”‚   β”œβ”€β”€ stores/                 # Global stores managed via Zustand
β”‚   β”‚   β”œβ”€β”€ useTransactionStore.ts # Synced cache for user order histories
β”‚   β”‚   └── useUserStore.ts     # Active profile context and authentication session store
β”‚   β”œβ”€β”€ app.config.ts           # App constant configuration options
β”‚   β”œβ”€β”€ public/                 # Static graphical assets & icons
β”‚   β”œβ”€β”€ tsconfig.json           # Compiler rules for TypeScript
β”‚   β”œβ”€β”€ next.config.ts          # Core Next.js configuration rules
β”‚   β”œβ”€β”€ package.json            # Node modules dependencies and task runners
β”‚   β”œβ”€β”€ pnpm-lock.yaml          # Pnpm lockfile for deterministic installs
β”‚   β”œβ”€β”€ pnpm-workspace.yaml     # Monorepo workspaces definition
β”‚   β”œβ”€β”€ eslint.config.mjs       # Code style enforcement rules
β”‚   β”œβ”€β”€ postcss.config.mjs      # CSS compile specifications
β”‚   β”œβ”€β”€ proxy.ts                # Dev server connection proxies
β”‚   └── README.md               # Frontend user guide
β”‚
β”œβ”€β”€ .gitignore                  # Global project files to ignore
β”œβ”€β”€ backup-trade-tracker.sql    # Relational database seed snapshot
β”œβ”€β”€ CHANGELOG.md                # Historic record of releases & milestones
β”œβ”€β”€ DEPLOYMENT.md               # Production cloud deployment guide
β”œβ”€β”€ docker-compose.yml          # Container orchestration blueprints
β”œβ”€β”€ vercel.json                 # Monorepo vercel routing config
└── README.md                   # Main workspace manual

πŸš€ Installation & Setup

Prerequisites

  • Go (1.25 or higher)
  • Node.js (20 or higher)
  • pnpm (Preferred package manager)
  • PostgreSQL (Main database)
  • Cloudinary (Media management for image uploads and CDN.)
  • Vercel (Managed PostgreSQL & Connection Pooling.)
  • Supabase (Managed PostgreSQL & Connection Pooling, use this if you're going to online)

1. Backend Engine Setup

  1. Navigate to the backend directory:
    cd backend
  2. Setup environment variables:
    cp .env.example .env
    Edit .env to configure your PostgreSQL credentials.
  3. Download dependencies:
    go mod tidy
  4. Perform auto-migration:
    go run core/script/auto-migrate.go
  5. Boot the server engine:
    go run cmd/api/main.go
    The server starts on the configured port (default :8080).

2. Frontend Platform Setup

  1. Open a new terminal session and navigate to the frontend directory:
    cd frontend
  2. Install clean dependencies:
    pnpm install
  3. Boot the Next.js development server:
    pnpm run dev
    Access the client directly at http://localhost:3000.

βš™οΈ Environment Blueprint

Copy the .env.example file to .env in both /frontend and /backend directories, then fill in the following variables:

🌐 Frontend (/frontend)

Variable Description Source
NEXT_PUBLIC_API_URL Go Backend Engine URL Default: http://localhost:8080/api
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME Cloudinary Account Name Cloudinary Console Dashboard

βš™οΈ Backend (/backend)

Variable Description Source
DB_CONNECTION PostgreSQL Connection String See Database Setup Guide
PORT Server Port Default: 8080.
JWT_SECRET Secret key for JWT signing Create a random secure string (e.g., using openssl rand -base64 32).
PRODUCTION_MODE App environment state Set to false for local dev, true for production/Vercel.
PRODUCTION_ENVIRONMENT App environment name Example: Vercel, localhost, etc.
API_GROUP_NAME Fiber route prefix Default: /api.
ALLOW_ORIGINS Allowed CORS Origins (splitted with comma) Example: http://localhost:3000, https://tpt-v3.vercel.app.

πŸ”§ Database Setup Guide

  • Cloud (Recommended): Go to Supabase > Connect > Transaction Pooler. Use Port 6543.
  • Local Dev: Use your local PostgreSQL connection string (e.g., postgres://user:pass@localhost:5432/db).

Image 1

Image 2

Image 3

Image 4


🌍 Deployment

For comprehensive production deployment instructions on Vercel, including our seamless "Zero-Config" True Monorepo setup, please refer to the Deployment Guide.


πŸ“ License

This project is licensed under the MIT License.

About

Trade Performance Tracker built with Next.js + TypeScript + Go (Currently only support IDX stocks for inventory items)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages