No description
  • Python 53.5%
  • JavaScript 28.1%
  • CSS 14.3%
  • Dockerfile 3.2%
  • HTML 0.9%
Find a file
Adrian Kowalczyk ba94a5f707
Some checks failed
All Stages CI / Build Changed Stages (push) Successful in 3m34s
Showcase CI / Build Frontend (push) Successful in 53s
Showcase CI / Docker Build & Test (push) Failing after 33s
hotfix(l-stage-2): wrong project name in pyproject.toml
2025-11-22 23:15:46 +01:00
.archive/task-1-car-simulator refactor: move old task-1 to .archive as preparation for web version 2025-11-11 16:15:55 +01:00
.forgejo/workflows fix(ci): missing dependencies for stages 2025-11-19 23:23:14 +01:00
.vscode feat: add launch configuration and initial test suite for car simulator 2025-11-03 23:40:58 +01:00
Checkers feat(checkers): add initial frontend setup with docs and uml diagrams for showcase 2025-11-19 23:16:09 +01:00
Labs hotfix(l-stage-2): wrong project name in pyproject.toml 2025-11-22 23:15:46 +01:00
Showcase feat(checkers): add initial frontend setup with docs and uml diagrams for showcase 2025-11-19 23:16:09 +01:00
.dockerignore feat: .gitignore update for npm and .dockerignore as preparation for dockerized builds 2025-11-11 16:17:22 +01:00
.gitignore feat: .gitignore update for npm and .dockerignore as preparation for dockerized builds 2025-11-11 16:17:22 +01:00
PROJECT_IDEAS.md refactor: remove Battle Royale references and clarify project scope in documentation 2025-11-19 22:13:03 +01:00
README.md chore: remove unnecessary k8s information 2025-11-19 23:03:46 +01:00

Object-Oriented Programming 2

Course projects and assignments for Object-Oriented Programming 2.

Author: Adrian Kowalczyk Course: Object-Oriented Programming 2 Semester: 2025/2026

🌐 Live Demo

Showcase Platform: oop2.vzkn.eu

The Showcase aggregates all Labs and Checkers stages in a single platform with automatic stage discovery.

Structure

OOP2/
├── Labs/                    # Laboratory assignments (stage-1 to stage-7)
│   ├── stage-1/            # Domain Skeleton - Basic car simulator with Observer pattern
│   ├── stage-2/            # Kinematics - Physics-based movement with 1D motion
│   ├── stage-3/            # Fuel System
│   ├── stage-4/            # Transmission
│   ├── stage-5/            # Brakes & ABS
│   ├── stage-6/            # Environment
│   └── stage-7/            # Dashboard
├── Checkers/               # Checkers game assignments
│   ├── stage-1/            # Analysis & Planning
│   ├── stage-2/            # Basic Implementation
│   ├── stage-3/            # Extended Features
│   └── stage-4/            # Final Version
└── Showcase/               # Platform aggregating all stages
    ├── backend/            # FastAPI backend with WebSocket proxy
    └── frontend/           # React + Vite frontend with dynamic stage discovery

Requirements

  • Python 3.13+
  • Node.js 22+
  • Docker & Docker Compose (for containerized deployment)
  • uv package manager (for Python)
  • npm (for frontend)

Quick Start

Local Development

Labs Stage (any stage, e.g., stage-1 or stage-2)

# Backend
cd Labs/stage-1/backend  # or stage-2
uv sync
uv run uvicorn main:app --reload --host 0.0.0.0 --port 8000

# Frontend (in another terminal)
cd Labs/stage-1/frontend  # or stage-2
npm install
npm run dev

Visit: http://localhost:5173

Showcase Platform

# Backend
cd Showcase/backend
uv sync
uv run uvicorn main:app --reload --host 0.0.0.0 --port 8080

# Frontend (in another terminal)
cd Showcase/frontend
npm install
npm run dev

Visit: http://localhost:5173

Docker Deployment

Single Stage

cd Labs/stage-1
docker-compose up --build

Visit: http://localhost:3001

Showcase (All Stages)

cd Showcase
docker-compose up --build

Visit: http://localhost:8080

Architecture

Each stage is a single container with:

  • Backend: Python FastAPI serving WebSocket API and static files
  • Frontend: React + Vite (built during Docker image creation)
  • Deployment: Docker multi-stage build (Node builder + Python runtime)

The Showcase platform:

  • Uses Vite import.meta.glob() to import all stage components
  • Imports stage components directly from source (zero code duplication)
  • Dynamic routing with React Router
  • Single aggregated view of all Labs and Checkers stages

Development

Install Dependencies

Python (using uv):

cd Labs/stage-1/backend  # or Showcase/backend
uv sync

Frontend (using npm):

cd Labs/stage-1/frontend  # or Showcase/frontend
npm install

Run Tests

Python:

cd Labs/stage-1/backend
uv run pytest tests/ -v --cov=. --cov-report=term-missing

Linting:

# Python
uv run ruff check .
uv run ruff format --check .

# Frontend
npm run lint

CI/CD

Forgejo Actions workflows (.forgejo/workflows/):

  • all-stages.yml - Auto-discovers and builds all changed Labs/Checkers stages
  • showcase.yml - Tests and builds Showcase platform

Each workflow includes:

  • Python linting (ruff) and testing (pytest)
  • Frontend linting (ESLint) and building
  • Docker build verification
  • Automatic Docker image push to Forgejo Container Registry (on main branch)

Technology Stack

  • Backend: Python 3.13, FastAPI 0.121.1, uvicorn 0.38.0, WebSockets 15.0.1
  • Frontend: React 19.2.0, React Router 7.9.5, Vite 7.2.2
  • Testing: pytest 9.0.0, pytest-cov 7.0.0, ESLint 9.39.1
  • Linting: ruff 0.14.4, ESLint + React plugins
  • Containerization: Docker multi-stage builds, Docker Compose
  • Orchestration: Kubernetes (production)

Project Structure Details

  • Single Container per Stage: Each stage builds frontend during Docker image creation, backend serves both API and static files
  • Component Imports: Showcase uses Vite import.meta.glob() to import stage components from source
  • Zero Duplication: Stage code is reused directly, no copying or duplication
  • Development/Production Parity: Same Docker setup for local testing and production deployment
  • WebSocket Proxy: Showcase backend proxies WebSocket connections to internal stage services with automatic reconnection
  • Observer Pattern: Car simulation uses Observer pattern for real-time state updates to Dashboard

Future Ideas

Battle Royale / Multiplayer Mode would make a great standalone hobby project for learning distributed systems, real-time communication, and scaling. It's beyond the scope of this OOP course project but might appear as a separate repository under @vrozaksen in the future.

Note: Battle Royale was removed from this project as it doesn't belong in the OOP2 course scope. See PROJECT_IDEAS.md for technical details.