Welcome to the AlgoBlocks team! This project uses a decoupled architecture: a React + Vite + Blockly frontend and a Python + FastAPI backend, designed to be deployed on Vercel.
Please follow these instructions sequentially to set up your local development environment.
Before writing or running any code, ensure your computer has the core engines installed:
-
Git Download and install Git.
-
Node.js (for the Frontend) Download and install the Node.js LTS version. This includes npm (Node Package Manager), required to install React, Vite, and Blockly.
-
Python (for the Backend) Download and install Python 3.10 or newer.
⚠️ CRITICAL WINDOWS STEP: During installation, check the box "Add Python to PATH" on the first screen. -
Code Editor Recommended: Visual Studio Code (VS Code).
Open your terminal (or VS Code terminal) and run:
# Clone the repository
git clone <YOUR_GITHUB_REPOSITORY_URL_HERE>
# Navigate into the project folder
cd algoblocks_prototypeThe frontend lives inside the frontend/ folder and uses package.json to track dependencies like @blockly/theme-dark, react-split, and Vite.
- Navigate to the frontend folder:
cd frontend- Install all Node.js dependencies:
npm installThe backend is in the api/ folder (named api to comply with Vercel serverless architecture).
It uses a Virtual Environment (venv) to isolate Python packages.
- Navigate to the
apifolder:
cd api- Create a virtual environment:
python -m venv venv- Activate the virtual environment:
-
Windows (Command Prompt):
.\venv\Scripts\activate
-
Windows (PowerShell):
.\venv\Scripts\Activate.ps1
-
Mac/Linux:
source venv/bin/activate
(Success indicator: (venv) appears at the beginning of your terminal prompt.)
- Install Python dependencies:
pip install -r requirements.txtYou must run both the frontend and backend servers simultaneously. Open two terminal windows:
cd frontend
npm run devThis will start the React UI. A local URL (usually http://localhost:5173) will appear. Ctrl+Click to open.
cd api
# Activate the venv first
.\venv\Scripts\activate
# Start the server
python -m uvicorn index:app --reload --port 8000The complexity analyzer runs on port 8000. The --reload flag restarts the server automatically on code changes.
-
Time Complexity Table is blank or shows "Error" The Vite frontend proxies
/apicalls tohttp://127.0.0.1:8000. ✅ Fix: Ensure Terminal 2 (backend) is running without errors. -
"Execution of scripts is disabled on this system" (Windows PowerShell)
⚠️ Fix: Run PowerShell as Administrator and execute:Set-ExecutionPolicy Unrestricted -Force
Then reactivate your venv.
-
"ModuleNotFoundError: No module named 'fastapi'"
⚠️ Fix: Activate venv, install requirements, and restart server:.\venv\Scripts\activate pip install -r requirements.txt python -m uvicorn index:app --reload
-
"Port 8000 is already in use"
⚠️ Fix: Stop the running Python process in Task Manager or change the port:python -m uvicorn index:app --reload --port 8001
Update
vite.config.jsaccordingly if you change the port. ?