Skip to content

Learnathon-By-Geeky-Solutions/netninjas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš‡ QR Code Based Metro Ticketing System

.NET Version ASP.NET Core EF Core SQL Server Redis JWT QRCoder

Fast . Convenient . Cashless


Alt text


πŸ‘₯ Team Information: NetNinjas

Role Name GitHub
Mentor Jaber Kibria GitHub
Team Member Md Nazmul Hossain GitHub
Sujan Roy GitHub
Rabbani Islam Refat GitHub

πŸ“„ Project Description

πŸ“Œ Introduction

The QR Code-Based Metro Ticketing System is your smart companion for hassle-free metro travel. Say goodbye to long queues and paper tickets β€” with just a few taps, generate a secure QR code, scan it at the station gates, and you’re on your way.

πŸš€ Key Features

  • QR Code Ticketing: Instantly generate secure QR codes for your journey β€” no need for paper tickets.
  • Automatic Fare Deduction: Automatically records entry and exit stations to calculate and deduct the exact fare.
  • Seamless Digital Payments: Add balance using mobile banking, credit/debit cards, or digital wallets.
  • Travel & Transaction History: View detailed logs of your trips, fare deductions, and top-ups.
  • Multi-Ticket Support: Manage multiple tickets for group or family travel under a single account.
  • Offline QR Support: Generate QR codes in advance and use them even when offline.
  • Admin Controls: Admin dashboard to manage stations, configure system settings, and monitor overall system activity.

🌐 Live Demo

Experience the QR Code-Based Metro Ticketing System in action by visiting our live demo:

Live Demo

πŸ“˜ User Guide

πŸ“ Code Structure

This project follows Clean Architecture principles and incorporates industry best practices to ensure modularity, testability, and maintainability.

πŸ”§ Clean Architecture

Clean Architecture
Clean Architecture

  • Presentation Layer (.Web): Handles UI rendering and HTTP requests using ASP.NET Core MVC, Razor Views, and APIs.
  • Application Layer: Contains use-case-specific business logic, service interfaces, and DTOs.
  • Domain Layer: Encapsulates core entities, value objects, and domain rules β€” independent of frameworks or infrastructure concerns.
  • Infrastructure Layer: Provides implementations for data access, external integrations, and repository logic.

πŸ›  Design Patterns & Practices

This project follows well-established industry best practices, including:

  • Dependency Injection: Enables loose coupling and improves flexibility and testability.
  • Repository Pattern: Abstracts data access logic, making the codebase more maintainable and testable.
  • Service Layer Abstraction: Encapsulates business logic and ensures a clear separation of concerns.
  • Unit of Work: Maintains database consistency by coordinating transactions across multiple repositories.

🧩 Use Case Diagram

Illustrates the main interactions between users and the system. Alt text

πŸ—ƒοΈ Entity Relationship (ER) Diagram

Describes the system's data model and relationships among entities.

erDiagram
    Admin ||--o{ Station : manages
    Station ||--o{ StationDistance : relates
    Station ||--o{ Trip : entry_exit
    User ||--|| Wallet : owns
    User ||--o{ Ticket : has
    Ticket ||--|| Trip : linked
    Wallet ||--o{ Transaction : records
    User ||--o{ Trip : makes
    Ticket ||--o{ Transaction : pays
    User ||--o{ UserToken : authenticates

    Admin {
        int Id PK
        string Email
        string PasswordHash
        datetime CreatedAt
        datetime LastLoginAt
    }
    Station {
        int Id PK
        string Name
        string Address
        decimal Latitude
        decimal Longitude
        int Order
        string Status
        datetime CreatedAt
        datetime UpdatedAt
    }
    StationDistance {
        int Id PK
        int Station1Id FK
        int Station2Id FK
        decimal Distance
        datetime CreatedAt
        datetime UpdatedAt
    }
    SystemSettings {
        int Id PK
        decimal MinFare
        decimal FarePerKm
        int RapidPassQrCodeValidityMinutes
        int QrTicketValidityMinutes
        int MaxTripDurationMinutes
        decimal TimeLimitPenaltyFee
        datetime CreatedAt
        datetime UpdatedAt
    }
    Ticket {
        int Id PK
        int UserId FK
        enum TicketType
        int OriginStationId FK
        int DestinationStationId FK
        decimal FareAmount
        string QRCodeData
        datetime CreatedAt
        datetime ExpiryTime
        enum TicketStatus
        string TransactionReference
    }
    Trip {
        int Id PK
        int UserId FK
        int TicketId FK
        int EntryStationId FK
        int ExitStationId FK
        datetime EntryTime
        datetime ExitTime
        decimal FareAmount
        enum TripStatus
        string TransactionReference
    }
    Transaction {
        int Id PK
        int WalletId FK
        decimal Amount
        enum TransactionType
        enum PaymentMethod
        enum PaymentItem
        enum TransactionStatus
        string TransactionReference
        string Description
        datetime CreatedAt
        datetime UpdatedAt
    }
    Wallet {
        int Id PK
        int UserId FK
        decimal Balance
        datetime CreatedAt
        datetime UpdatedAt
    }
    User {
        int Id PK
        string FullName
        string Email
        string PhoneNumber
        string NID
        string PasswordHash
        bool IsEmailVerified
        datetime CreatedAt
        datetime UpdatedAt
    }
    UserToken {
        int Id PK
        string Email
        string Token
        enum TokenType
        datetime ExpiryDate
        bool IsUsed
    }

Loading

πŸ“Έ Project Screenshots

Image 1 Image 2 Image 3
Image 4 Image 5 Image 6
Image 7 Image 8 Image 9
Image 11 Image 12 Image 13

🏁 Getting Started

Prerequisites

The deployment environment must satisfy the following prerequisites:

  • .NET 8.0 SDK or later
  • SQL Server
  • Redis
  • Visual Studio / Visual Studio Code

Setup Instructions

  1. Clone the repository:

    git clone https://github.com/Learnathon-By-Geeky-Solutions/netninjas
    cd netninjas
  2. Configuration Settings

    Edit the appsettings.json file located at:
    QRCodeBasedMetroTicketingSystem/QRCodeBasedMetroTicketingSystem.Web/appsettings.json
    with the following settings:

    {
      "ConnectionStrings": {
        "DefaultConnection": "your_sql_server_connection_string",
        "RedisConnectionString": "your_redis_connection_string"
      },
      "AdminSettings": {
        "DefaultEmail": "admin@gmail.com",
        "DefaultPassword": "admin123"
      },
      "EmailSettings": {
        "SmtpServer": "your_smtp_server",
        "SmtpPort": your_smtp_port,
        "SmtpUsername": "your_smtp_username",
        "SmtpPassword": "your_smtp_password"
      },
      "JwtSettings": {
        "SecretKey": "your_jwt_secret_key"
      },
      "QRCodeSecretKey": "your_qr_code_secret_key"
    }
  3. Database Setup:

    Run the Entity Framework Core migration to create the database schema.

    • Using Command Prompt / Terminal:

      dotnet ef database update
    • Or, using Visual Studio (Package Manager Console):

      Update-Database

      πŸ’‘ Ensure that the Default Project in the Package Manager Console is set to QRCodeBasedMetroTicketingSystem.Infrastructure

  4. Build and Run the Application

    Now you are ready to build and run the project:

    • Using Command Prompt / Terminal:

      dotnet build
      dotnet run
    • Or, using Visual Studio:

      • Press Ctrl + F5 to build and run without debugging
      • Or press F5 to run with debugging

    Once the application is running, open your browser and navigate to:

    https://localhost:7157

    πŸ”— Update the URL above if your application is configured to run on a different port.

πŸš€ Usage

Once the application is running, you can access the following interfaces:

πŸ’‘ Replace localhost:7157 with your actual domain or deployed URL when in a non-local environment.


About

Repository for team NetNinjas

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •