Skip to content

ScrapMetal1/GridLock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GridLock

Energy grid simulation with a Next.js frontend and a FastAPI backend.

Prerequisites

  • Python 3.10+ (with pip)
  • Node.js 18+ (with npm)

Backend

Run these from the repository root (GridLock/).

  1. Create and activate a virtual environment (recommended):

    python -m venv .venv
    .\.venv\Scripts\Activate.ps1

    On macOS/Linux:

    python -m venv .venv
    source .venv/bin/activate
  2. Install dependencies:

    pip install -r requirements.txt
  3. Start the API server (defaults to http://127.0.0.1:8000):

    python -m uvicorn backend.api.server:app --reload --host 127.0.0.1 --port 8000

    If python is not available as a command on Windows, use:

    py -m uvicorn backend.api.server:app --reload --host 127.0.0.1 --port 8000

    Check it is up: open or request http://127.0.0.1:8000/health.

Frontend

Run these from the frontend/ directory.

  1. Install dependencies:

    cd frontend
    npm install
  2. Start the dev server:

    npm run dev

    The app is usually at http://localhost:3000.

The UI expects the API at http://127.0.0.1:8000. To use a different URL, set:

set NEXT_PUBLIC_API_BASE_URL=http://127.0.0.1:8000
npm run dev

(PowerShell: $env:NEXT_PUBLIC_API_BASE_URL="http://127.0.0.1:8000". On Unix, use export.)

Production-style runs

  • Frontend: npm run build then npm start (from frontend/).
  • Backend: same python -m uvicorn command without --reload for a stable process.

Typical workflow

  1. Terminal 1: start the backend with python -m uvicorn from the repo root.
  2. Terminal 2: cd frontend, npm run dev.
  3. Use the browser on the Next.js URL; it will call the local API.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors