Getting Started
Getting started
Setting up Optimizer-Lens involves configuring both the Python-based backend and the Next.js frontend to work together. This guide walks you through the installation and execution steps for both environments.
Optimizer-Lens requires a local Python environment for the mathematical computations and a Node.js environment for the interactive UI. You must have both running to use the "Real Algorithms" mode in the playground.
Prerequisites
Before starting the installation, ensure you have the following software installed on your machine:
- Node.js: version 18.0 or later.
- pnpm: (recommended) or npm.
- Python: version 3.8 or later.
- pip: Python package installer.
Backend setup
The backend handles the core machine learning logic using FastAPI and NumPy. Follow these steps to set it up:
-
Navigate to the project root directory.
-
Install the required Python dependencies:
pip install -r requirements.txt -
Start the FastAPI server:
python -m core.apiThe server runs on
http://localhost:8000by default. You should see a status message confirming that the API is running.
Frontend setup
The frontend provides the interactive user interface for dataset manipulation and visualization. Follow these steps to set it up:
-
Open a new terminal window and navigate to the project root directory.
-
Install the Node.js dependencies:
pnpm install # OR npm install -
Configure the environment variables (optional):
Create a
.env.localfile in the root directory if you want to override the default backend URL:NEXT_PUBLIC_SERVER_URL=http://localhost:8000 -
Run the development server:
pnpm dev # OR npm run devAccess the application by navigating to
http://localhost:3000/playgroundin your web browser.
Verifying the connection
Once both the backend and frontend are running, you can verify the connection in the playground:
- Look for the Configuration panel on the left side of the playground.
- Find the Use Real Algorithms toggle.
- Check the status message below the toggle. It should show a green checkmark indicating "API available."
[!TIP] If the API is unavailable, ensure the FastAPI server is running on the correct port and that your browser is not blocking cross-origin requests.
Next steps
Once you have the project running, explore the Algorithms documentation to understand the mathematical models behind the visualizations.