Skip to content

About

End-to-end IoT smart parking system with ESP32, MQTT, Go backend, and React dashboard for real-time parking management.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

84 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Smart Parking System

A comprehensive IoT-based smart parking solution that enables real-time parking spot management, vehicle tracking, and entrance/exit monitoring. The system integrates hardware sensors, cloud backend services, and a modern web interface to optimize parking operations.


๐Ÿ“‹ Table of Contents


๐ŸŽฏ Project Overview

Smart Parking System is a full-stack IoT application designed to streamline parking management. It features:

  • Real-time parking spot occupancy tracking using IoT sensors
  • User authentication and authorization with JWT tokens
  • MQTT-based communication between hardware devices and backend
  • RESTful API for vehicle and parking management
  • Interactive web dashboard for users and administrators
  • RFID integration for vehicle identification

The system consists of three main components: Backend API (Go), Frontend (React + TypeScript), and Hardware (ESP32).


โœจ Features

Backend Features

  • โœ… User authentication and registration with secure password hashing
  • โœ… Real-time parking spot status monitoring
  • โœ… Vehicle management and tracking
  • โœ… Entrance/Exit logging and auditing
  • โœ… User ban/unban functionality with IP logging
  • โœ… JWT-based authorization

Hardware Features

  • ๐Ÿ“ก MQTT connectivity for IoT devices
  • ๐Ÿ” RFID reader integration for vehicle identification
  • ๐ŸŽฎ Servo motor control for barrier management
  • ๐Ÿ’ก LED indicators for status visualization
  • ๐Ÿ“ Ultrasonic sensors for occupancy detection
  • ๐Ÿ“บ LCD display for user feedback

Frontend Features

  • ๐ŸŽจ Modern, responsive UI with Tailwind CSS
  • ๐Ÿ” Secure login and signup pages
  • ๐Ÿ“Š Parking spot schematic visualization
  • ๐Ÿš— Vehicle search and management
  • ๐Ÿ“ Entrance/exit logging dashboard
  • ๐ŸŽฎ Interactive mini-games for user engagement
  • ๐ŸŽฌ Smooth animations with Framer Motion

๐Ÿ›  Tech Stack

Backend

  • Language: Go 1.24.4
  • Framework: Gin Web Framework
  • Database: PostgreSQL
  • Cache: Redis
  • Message Broker: EMQX (MQTT)
  • Authentication: JWT (golang-jwt/jwt)
  • Encryption: golang.org/x/crypto
  • ORM: GORM
  • Dependency Injection: Google Wire

Frontend

  • Framework: React 19
  • Language: TypeScript 5.8
  • Build Tool: Vite 7
  • Styling: Tailwind CSS 4
  • HTTP Client: Axios
  • Animation: Framer Motion
  • Icons: Lucide React
  • Notifications: React Toastify
  • Linting: ESLint

Hardware

  • Platform: ESP32 / ESP32-S3
  • Framework: Arduino
  • Development: PlatformIO
  • Libraries: Arduino JSON, MQTT 2.5.2

Infrastructure

  • Containerization: Docker & Docker Compose
  • Web Server: Caddy
  • Package Registry: GitHub Container Registry (ghcr.io)

๐Ÿš€ How to Run

Option 1: Docker Compose (Recommended)

cd API
docker-compose up -d

This will start:

  • Backend API on http://localhost:8080
  • EMQX Broker on mqtt://localhost:1883
  • EMQX Dashboard on http://localhost:18083
  • PostgreSQL on localhost:5432
  • Redis on localhost:6379
cd Frontend
docker-compose up -d

This will start:

  • Frontend Web Server on http://localhost:3000

Option 2: Manual Setup

Backend

cd API/BackEnd
go run cmd/server/main.go

Frontend

cd FrontEnd
npm run dev

Frontend will be available at http://localhost:5173

Build for Production

Backend:

cd API/BackEnd
go build -o smartparking cmd/server/main.go
./smartparking

Frontend:

cd FrontEnd
npm run build
npm run preview

Option 3: Docker (Individual Services)

Backend Only:

cd API/BackEnd
docker build -t smartparking:latest .
docker run -p 8080:8080 smartparking:latest

Frontend Only:

cd FrontEnd
docker build -t smartparking-frontend:latest .
docker run -p 3000:3000 smartparking-frontend:latest

๐Ÿ“ Folder Structure

smart-parking/
โ”œโ”€โ”€ README.md                          # Project documentation
โ”œโ”€โ”€ API/                              # Backend & Infrastructure
โ”‚   โ”œโ”€โ”€ docker-compose.yml            # Docker services configuration
โ”‚   โ”œโ”€โ”€ BackEnd/                      # Go backend application
โ”‚   โ”‚   โ”œโ”€โ”€ dockerfile                # Backend container image
โ”‚   โ”‚   โ”œโ”€โ”€ go.mod                    # Go module definitions
โ”‚   โ”‚   โ”œโ”€โ”€ cmd/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ server/
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ main.go           # Application entry point
โ”‚   โ”‚   โ””โ”€โ”€ internal/
โ”‚   โ”‚       โ”œโ”€โ”€ config/               # Configuration management
โ”‚   โ”‚       โ”œโ”€โ”€ db/                   # Database connection & migrations
โ”‚   โ”‚       โ”‚   โ””โ”€โ”€ migration/
โ”‚   โ”‚       โ”‚       โ””โ”€โ”€ init.sql      # Database schema
โ”‚   โ”‚       โ”œโ”€โ”€ delivery/
โ”‚   โ”‚       โ”‚   โ”œโ”€โ”€ http/             # HTTP handlers & routes
โ”‚   โ”‚       โ”‚   โ””โ”€โ”€ mqtt/             # MQTT client & handlers
โ”‚   โ”‚       โ”œโ”€โ”€ di/                   # Dependency injection setup
โ”‚   โ”‚       โ”œโ”€โ”€ domain/               # Business domain models
โ”‚   โ”‚       โ”œโ”€โ”€ dto/                  # Data transfer objects
โ”‚   โ”‚       โ”œโ”€โ”€ jwt/                  # JWT utilities
โ”‚   โ”‚       โ”œโ”€โ”€ middleware/           # HTTP middleware
โ”‚   โ”‚       โ”œโ”€โ”€ repository/           # Data access layer
โ”‚   โ”‚       โ”‚   โ”œโ”€โ”€ postgres/         # PostgreSQL repositories
โ”‚   โ”‚       โ”‚   โ””โ”€โ”€ redis/            # Redis repositories
โ”‚   โ”‚       โ””โ”€โ”€ usecase/              # Business logic layer
โ”‚   โ”‚
โ”œโ”€โ”€ FrontEnd/                         # React frontend application
โ”‚   โ”œโ”€โ”€ dockerfile                    # Frontend container image
โ”‚   โ”œโ”€โ”€ docker-compose.yml            # Frontend services
โ”‚   โ”œโ”€โ”€ nginx.conf                    # Nginx configuration
โ”‚   โ”œโ”€โ”€ package.json                  # NPM dependencies
โ”‚   โ”œโ”€โ”€ vite.config.ts                # Vite build configuration
โ”‚   โ”œโ”€โ”€ tsconfig.json                 # TypeScript configuration
โ”‚   โ”œโ”€โ”€ index.html                    # HTML entry point
โ”‚   โ”œโ”€โ”€ public/                       # Static assets
โ”‚   โ”‚   โ”œโ”€โ”€ Chopping/                 # Chopping mini-game
โ”‚   โ”‚   โ””โ”€โ”€ RepairKit/                # RepairKit mini-game
โ”‚   โ””โ”€โ”€ src/
โ”‚       โ”œโ”€โ”€ main.tsx                  # React app entry point
โ”‚       โ”œโ”€โ”€ App.tsx                   # Root component
โ”‚       โ”œโ”€โ”€ api.ts                    # API client setup
โ”‚       โ”œโ”€โ”€ index.css                 # Global styles
โ”‚       โ””โ”€โ”€ components/
โ”‚           โ”œโ”€โ”€ Auth/                 # Login/Signup components
โ”‚           โ”œโ”€โ”€ CRUD/                 # CRUD operation components
โ”‚           โ”œโ”€โ”€ EntranceExit/         # Entry/exit logging components
โ”‚           โ”œโ”€โ”€ VehicleSearch/        # Vehicle search components
โ”‚           โ”œโ”€โ”€ minigame/             # Mini-game components
โ”‚           โ”œโ”€โ”€ Navbar.tsx            # Navigation bar
โ”‚           โ”œโ”€โ”€ Footer.tsx            # Footer component
โ”‚           โ”œโ”€โ”€ Schematic.tsx         # Parking spot visualization
โ”‚           โ””โ”€โ”€ AccessDenied.tsx      # Access denied page
โ”‚
โ”œโ”€โ”€ Hardware/                         # ESP32 firmware
โ”‚   โ”œโ”€โ”€ platformio.ini                # PlatformIO configuration
โ”‚   โ”œโ”€โ”€ include/                      # Header files
โ”‚   โ”‚   โ”œโ”€โ”€ config.h                  # Configuration settings
โ”‚   โ”‚   โ”œโ”€โ”€ esp32.h / esp32_s3.h      # Platform definitions
โ”‚   โ”‚   โ”œโ”€โ”€ Led/                      # LED control headers
โ”‚   โ”‚   โ”œโ”€โ”€ motors/                   # Motor control headers
โ”‚   โ”‚   โ”œโ”€โ”€ MQTT/                     # MQTT client headers
โ”‚   โ”‚   โ”œโ”€โ”€ RFID/                     # RFID reader headers
โ”‚   โ”‚   โ””โ”€โ”€ sensors/                  # Sensor headers
โ”‚   โ”œโ”€โ”€ src/                          # Source code
โ”‚   โ”‚   โ”œโ”€โ”€ main.cpp                  # Firmware entry point
โ”‚   โ”‚   โ”œโ”€โ”€ esp32.cpp / esp32_s3.cpp  # Platform initialization
โ”‚   โ”‚   โ”œโ”€โ”€ Lcd/                      # LCD display implementation
โ”‚   โ”‚   โ”œโ”€โ”€ Led/                      # LED control implementation
โ”‚   โ”‚   โ”œโ”€โ”€ motors/                   # Motor control implementation
โ”‚   โ”‚   โ”œโ”€โ”€ MQTT/                     # MQTT implementation
โ”‚   โ”‚   โ”œโ”€โ”€ RFID/                     # RFID reader implementation
โ”‚   โ”‚   โ””โ”€โ”€ sensors/                  # Sensor implementations
โ”‚   โ””โ”€โ”€ test/                         # Test files

๐Ÿ“ก API Documentation

Authentication

  • POST /v1/signup - Register a new user
  • POST /v1/login - User login

Parking Spots

  • GET /v1/ps - Get all parking spots

Vehicles

  • GET /v1/vehicles - Get users vehicles
  • GET /v1/vehicles/:id - Get vehicle info
  • POST /v1/vehicles - Register a new vehicle
  • PUT /v1/vehicles/:id - Update a vehicle info
  • DELETE /v1/vehicles/:id - Delete vehicle

Entrance/Exit

  • GET /v1/ee - Get entry/exit logs
  • GET /v1/ee/:id - Get entry/exit log info
  • GET /v1/ee/vehicle/:id - Get vehicle entrance/exit log

Gate Control

  • POST /v1/gate/control - control entrance/exit gate

๐Ÿค Contributing

  1. Create a feature branch (git checkout -b feature/AmazingFeature)
  2. Commit your changes (git commit -m 'Add AmazingFeature')
  3. Push to the branch (git push origin feature/AmazingFeature)
  4. Open a Pull Request

๐Ÿง‘โ€๐Ÿ’ป Contributors


๐Ÿ“„ License

This project is licensed under the MIT License.

Copyright (c) 2026 NiflheimDevs

See LICENSE for details.


๐Ÿ‘ฅ Support

For issues, questions, or suggestions, please create an issue in the repository or contact the development team.

About

End-to-end IoT smart parking system with ESP32, MQTT, Go backend, and React dashboard for real-time parking management.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

Contributors

Languages