Skip to content

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ…ΏοΈ Parking Flow

Real-time smart parking simulation dashboard built with ASP.NET Core, SignalR and React.

Parking Flow dark mode dashboard Parking Flow dark mode dashboard


πŸ“š Table of Contents


πŸ“Œ Overview

Parking Flow is a real-time smart parking simulator created as a university project for ASP.NET application programming.

The application simulates cars entering, waiting, parking and leaving a parking lot.
The backend is built with ASP.NET Core Web API and contains the main simulation logic, including thread synchronization and background task processing.

The frontend is built with React and works as a live dashboard. It displays the current parking state, queue, activity log, statistics, occupancy trend and detailed information about each parking spot.

The main goal of the project was to demonstrate practical use of:

  • thread synchronization,
  • semaphores,
  • thread pool tasks,
  • AJAX communication,
  • WebSocket live updates.

✨ Features

πŸ…ΏοΈ Parking Simulation

  • 20 parking spots
  • live parking spot status
  • cars entering and leaving the parking lot
  • waiting queue for cars
  • automatic and manual simulation mode
  • manual spot release
  • parking reset option

πŸš— Car Types

The simulation supports different car types:

  • normal car
  • electric car
  • VIP car

Cars can be assigned to preferred parking spots depending on their type.

πŸ…ΏοΈ Parking Spot Types

The parking grid includes several types of parking spots:

  • Standard
  • VIP
  • Electric
  • Disabled
  • Reserved

Each type is visually marked in the frontend.

πŸ“Š Dashboard Analytics

The dashboard displays:

  • free spots
  • occupied spots
  • cars in queue
  • served cars
  • current occupancy
  • peak occupancy
  • average wait time
  • average parking time
  • next spot release
  • occupancy trend chart

🧾 Activity Log

The application includes a live activity log with event types:

  • entered
  • left
  • waiting
  • full
  • system

Each event is updated in real time and displayed with a timestamp.

πŸŒ— UI Modes

The frontend supports:

  • dark mode
  • light mode
  • dynamic logo depending on selected theme
  • premium graphite glassmorphism style
  • responsive dashboard layout

🧡 Concurrency Requirements

The project uses several mechanisms required by the laboratory assignment.

Requirement Implementation
Lock / Mutex lock protects parking spots, queue, activity log and simulation state
Semaphore SemaphoreSlim controls the number of available parking spaces
Thread Pool each car is processed as a separate Task.Run() background task
AJAX frontend actions use fetch() to call ASP.NET Core API endpoints
WebSocket SignalR sends live parking updates from backend to frontend

Lock

The backend uses lock to protect shared application state, including:

  • parking spot list,
  • waiting queue,
  • activity log,
  • simulation status.

SemaphoreSlim

The parking lot has a limited number of spaces.
SemaphoreSlim controls whether a car can enter the parking lot or must wait in the queue.

Task.Run

Each car is handled as a separate background task.
A car can wait for a place, enter the parking lot, stay for a randomly selected parking time and then leave.

AJAX / fetch

The React frontend communicates with ASP.NET Core API endpoints using fetch().

Main actions:

  • add car,
  • add five cars,
  • start simulation,
  • stop simulation,
  • start auto mode,
  • stop auto mode,
  • release parking spot,
  • reset parking.

SignalR / WebSocket

SignalR is used to update the frontend live after every change in the parking state.

The frontend receives:

  • parking spot updates,
  • queue updates,
  • statistics updates,
  • activity log updates.

πŸ“Έ Screenshots

Dashboard

Dark Mode Light Mode
Dark mode dashboard Light mode dashboard

Parking View

Parking Grid Spot Details
Parking dashboard overview Parking spot details modal

Queue

Waiting Queue
Waiting queue panel

πŸ› οΈ Tech Stack

Area Technology
Backend ASP.NET Core Web API
Backend language C#
Real-time communication SignalR / WebSocket
Synchronization lock, SemaphoreSlim
Background processing Task.Run, ThreadPool
Frontend React
Frontend build tool Vite
API communication fetch / AJAX
Icons Lucide React
Animations Framer Motion
Styling CSS, glassmorphism, responsive layout

βš™οΈ Requirements

To run the project locally, you need:

  • .NET 8 or newer
  • Node.js 18 or newer
  • npm
  • Visual Studio 2022 or Visual Studio Code
  • modern web browser

πŸš€ Getting Started

1. Clone the repository

git clone https://github.com/your-username/ParkingFlow.git
cd ParkingFlow

2. Run the backend

cd backend/ParkingFlow.Api
dotnet run

The backend should start on addresses similar to:

https://localhost:7246
http://localhost:5288

Swagger is available at:

https://localhost:7246/swagger

Main API endpoint:

GET http://localhost:5288/api/parking/state

SignalR hub:

http://localhost:5288/parkingHub

3. Run the frontend

Open a second terminal:

cd frontend
npm install
npm run dev

The frontend should be available at:

http://localhost:5173

πŸ“ Project Structure

ParkingFlow/
β”œβ”€β”€ backend/
β”‚   └── ParkingFlow.Api/
β”‚       β”œβ”€β”€ Controllers/
β”‚       β”‚   └── ParkingController.cs
β”‚       β”œβ”€β”€ Hubs/
β”‚       β”‚   └── ParkingHub.cs
β”‚       β”œβ”€β”€ Models/
β”‚       β”‚   β”œβ”€β”€ ParkingCar.cs
β”‚       β”‚   β”œβ”€β”€ ParkingEvent.cs
β”‚       β”‚   β”œβ”€β”€ ParkingSpot.cs
β”‚       β”‚   β”œβ”€β”€ ParkingState.cs
β”‚       β”‚   └── ParkingStats.cs
β”‚       β”œβ”€β”€ Services/
β”‚       β”‚   └── ParkingService.cs
β”‚       β”œβ”€β”€ appsettings.json
β”‚       └── Program.cs
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   β”œβ”€β”€ favicon.svg
β”‚   β”‚   β”œβ”€β”€ spaces-darkmode.png
β”‚   β”‚   └── spaces-lightmode.png
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ ActivityLog.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AnalyticsPanel.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Header.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ParkingGrid.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ParkingSpot.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ SpotDetailsModal.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ StatCard.jsx
β”‚   β”‚   β”‚   └── WaitingQueue.jsx
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   └── parkingApi.js
β”‚   β”‚   β”œβ”€β”€ App.css
β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   β”œβ”€β”€ index.css
β”‚   β”‚   └── main.jsx
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”‚
β”œβ”€β”€ screenshots/
β”‚   β”œβ”€β”€ darkmode.png
β”‚   β”œβ”€β”€ lightmode.png
β”‚   β”œβ”€β”€ place.png
β”‚   β”œβ”€β”€ ss1.png
β”‚   └── waitingqueue.png
β”‚
β”œβ”€β”€ .gitignore
β”œβ”€β”€ LICENSE
└── README.md

🚧 Future Improvements

  • add user accounts
  • add parking payment simulation
  • add database support for historical results
  • add charts for long-term occupancy statistics
  • add more detailed car priority rules
  • add admin panel for parking spot configuration
  • add deployment configuration
  • add automated backend tests
  • add Docker support

πŸ‘©β€πŸ’» Author

Created by Katarzyna StaΕ„czyk.

About

Real-time smart parking simulation dashboard built with ASP.NET Core, SignalR and React.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages