Development Setup
This guide covers setting up the TradeEntry project locally for development.
Prerequisites
| Tool | Version | Download |
|---|---|---|
| Python | 3.11+ | python.org |
| Node.js | 18+ | nodejs.org |
| PostgreSQL | 14+ | postgresql.org |
| Git | Any | git-scm.com |
| VS Code | Latest | code.visualstudio.com |
Clone the Repository
git clone <repository-url>
cd tradeentry-VPS
Backend Setup
cd backend
python -m venv venv
# Windows
venv\Scripts\activate
# Linux / macOS
source venv/bin/activate
pip install -r requirements.txt
Environment Variables
Create backend/.env:
DATABASE_URL=postgresql://user:password@localhost:5432/tradeentry
CSV_PATH=C:/path/to/csv/storage
AMI_PATH=C:/path/to/ami/output
APP_ENV=LOCAL
Frontend Setup
cd frontend
npm install
Docs Setup
cd docs
npm install
Database Migrations
cd backend
alembic upgrade head
VS Code Setup (Recommended)
VS Code is the recommended editor for this project. It is configured to launch all three services — Backend, Frontend, and Docs — directly from the editor with dedicated terminal tabs for each.
Step 1 — Install Recommended Extensions
Open VS Code, then press Ctrl + Shift + P and run:
Extensions: Show Recommended Extensions
Install all suggested extensions. Key ones for this project:
| Extension | Purpose |
|---|---|
| Python (Microsoft) | FastAPI backend development |
| Pylance | Python type checking and IntelliSense |
| ES7+ React/Redux | React snippets and IntelliSense |
| TypeScript (built-in) | Frontend type checking |
| Tailwind CSS IntelliSense | Autocomplete for Tailwind classes |
| Prettier | Code formatting |
| GitLens | Enhanced Git history and blame |
| Thunder Client | Test API endpoints inside VS Code |
Step 2 — Open the Project
Always open the project root — not a subfolder:
File → Open Folder → select tradeentry-VPS/
Do not open backend/, frontend/, or docs/ individually.
Always open the root tradeentry-VPS/ folder so VS Code picks up
the .vscode/tasks.json configuration correctly.
Step 3 — Configure Python Interpreter
- Press
Ctrl + Shift + P - Type: Python: Select Interpreter
- Choose the venv interpreter:
.\backend\venv\Scripts\python.exe (Windows)
./backend/venv/bin/python (Linux / macOS)
This ensures Pylance and the debugger use the correct environment.
Running the Project from VS Code
All three services start with a single keyboard shortcut.
Start All Services
Ctrl + Shift + B
This runs the Start All - TradeEntry compound task which opens three dedicated terminal tabs simultaneously:
TERMINAL
┌─────────────┬──────────────┬──────────────┐
│ Backend │ Frontend │ Docs │
│ │ │ │
│ Uvicorn │ VITE ready │ Building... │
│ :8000 ✓ │ :5173 ✓ │ then :3000 ✓ │
└─────────────┴──────────────┴──────────────┘
| Terminal Tab | Service | URL |
|---|---|---|
| Backend | FastAPI + Uvicorn | http://localhost:8000 |
| Frontend | React + Vite | http://localhost:5173 |
| Docs | Docusaurus (build + serve) | http://localhost:3000 |
The Docs tab runs npm run build first to generate the search index,
then starts the server. Wait for "Serving build directory" to appear
in the Docs terminal before opening http://localhost:3000.
Search is fully available once the build completes.
Run a Single Service
To start only one service (e.g. to restart just the backend):
Ctrl + Shift + P → type: Run Task → select the service
Available individual tasks:
| Task Name | What it starts |
|---|---|
Backend - FastAPI | Uvicorn dev server on :8000 |
Frontend - Vite | Vite dev server on :5173 |
Docs - Docusaurus | Docusaurus build + serve on :3000 |
Start All - TradeEntry | All three in parallel |
Stop All Services
Ctrl + Shift + P → Terminal: Kill All Terminals
Or click the trash icon on each terminal tab to stop services individually.
Running Without VS Code
If you prefer terminals directly, use the provided scripts from the project root:
Windows — BAT file (opens 3 separate CMD windows)
.\start-dev.bat
To stop:
.\stop-dev.bat
Any platform — Node script (mixed output in one terminal)
npm run dev:all
Service URLs Quick Reference
| Service | URL | Notes |
|---|---|---|
| Backend API | http://localhost:8000 | FastAPI |
| Swagger UI | http://localhost:8000/docs | Interactive API docs |
| ReDoc | http://localhost:8000/redoc | Alternative API docs |
| Frontend | http://localhost:5173 | React app |
| Docs | http://localhost:3000 | Docusaurus (search enabled) |
NSE Data Sync (standalone)
Always run from backend/ using the module flag:
cd backend
python -m nseeod.downloadbhav
python nseeod\downloadbhav.py # Wrong — breaks module imports
See Architecture for system design details.