This project is a web-based station–vehicle–route planning system for cargo collected from districts of Kocaeli and delivered to Kocaeli University.
The application consists of two main parts:
- Backend: REST API implemented with FastAPI (
backend/) - Frontend: Web UI built with plain HTML/CSS/JavaScript (
frontend/)
- Station Management: List and manage cargo stations
- Vehicle Management: Manage vehicles, capacities and basic properties
- Route & Trip Management: Manage routes and trips between stations
- Cargo Status Tracking: View cargo status per station on the user side
- Admin Panel: Screens for stations, routes, vehicles and reports
- User Panel: View cargo status and trips after logging in
-
Backend
- FastAPI (Python)
- SQLAlchemy (ORM)
- PostgreSQL database
- Alembic / SQL migration files (
backend/migrations/)
-
Frontend
- Plain HTML, CSS, JavaScript
- Simple multi-page structure (not SPA)
- Python 3.10+
- PostgreSQL (local installation recommended)
- Optional:
pgAdminor any DB management tool
cd backend
# Create virtual environment (recommended)
python -m venv venv
venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Create .env from example
copy env.example .env # In PowerShell you can also use: cp env.example .envConfigure the database connection in .env:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/cargo_plan
DEBUG=TrueThen create a PostgreSQL database named cargo_plan.
cd backend
python scripts/seed_stations.py
python scripts/seed_vehicles.pycd backend
uvicorn app.main:app --reloadThe API will be available at http://localhost:8000 by default.
This folder does not use Node/Vite/React; files are served as static HTML/CSS/JS.
To avoid CORS and browser security issues, do not open HTML files via file://, use an HTTP server instead.
cd frontend
python -m http.server 8001Then open in your browser: http://localhost:8001 (you will be redirected to the login page).
npm install -g http-server
cd frontend
http-server -p 8001The backend URL is defined in frontend/js/api.js via the API_BASE_URL constant. Default:
const API_BASE_URL = "http://localhost:8000/api";Change this value if your backend is running on a different host/port.
- Start the backend
cd backend uvicorn app.main:app --reload - Serve the frontend with an HTTP server (e.g.
python -m http.server 8001infrontend/) - Open
http://localhost:8001in your browser - Create a new user if needed (
register.html) - Log in as admin or regular user and use the corresponding panels
Prolab-Project-cargo-plan/
├── backend/
│ ├── app/
│ │ ├── api/ # API endpoints
│ │ ├── models/ # SQLAlchemy models
│ │ ├── schemas/ # Pydantic schemas
│ │ ├── services/ # Business logic / service layer
│ │ └── utils/ # Helper utilities
│ ├── scripts/ # Seed and helper scripts
│ ├── migrations/ # SQL migration files
│ └── README.md # Backend-specific notes
│
├── frontend/
│ ├── css/ # Stylesheets
│ ├── js/ # Frontend JavaScript
│ ├── admin/ # Admin HTML pages
│ ├── user/ # User HTML pages
│ └── README.md # Frontend-specific notes
│
├── data/
│ └── stations.json # Station data
└── README.md # This file
There are ready-to-run backend test scripts:
cd backend
# General API tests
python test_api.py
# Scenario tests
python test_scenarios.py
# Route finding test
python test_route_finding.pyThis project is a sample university course (Prolab) cargo planning system.