Skip to content

deepkc/QrCodeGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QR Code Generator

A modern QR Code Generator web application built with ASP.NET Core 9 MVC.

The application allows users to generate QR codes from website URLs, preview them instantly, download them as PNG images, and copy the original URL with a single click.


Features

  • Generate QR Codes from any website URL
  • Download QR Code as PNG
  • Copy URL to Clipboard
  • Generate Another option
  • URL Validation
  • Clean and Responsive UI
  • Logging with ILogger
  • Exception Handling
  • Service Layer Architecture
  • Dependency Injection
  • Unit Testing using xUnit

Technologies Used

  • ASP.NET Core 9 MVC
  • C#
  • Razor Views
  • Bootstrap 5
  • Bootstrap Icons
  • QRCoder
  • JavaScript
  • Dependency Injection
  • ILogger
  • xUnit

Project Architecture

QrCodeGenerator
│
├── Controllers
│   └── HomeController.cs
│
├── Services
│   ├── Interfaces
│   │   └── IQrCodeService.cs
│   │
│   └── Implementations
│       └── QrCodeService.cs
│
├── ViewModels
│   └── QrCodeViewModel.cs
│
├── Views
│   ├── Home
│   │   ├── Index.cshtml
│   │   └── About.cshtml
│   │
│   └── Shared
│       └── _Layout.cshtml
│
├── wwwroot
│
├── Program.cs
│
└── appsettings.json

Application Features

Home Page

  • Enter a website URL
  • Generate QR Code
  • Display generated QR Code
  • Download as PNG
  • Copy URL
  • Generate another QR Code

About Page

Displays information about

  • Project
  • Technologies Used
  • Features
  • Developer Information

How It Works

  1. User enters a website URL.
  2. The request is sent to the HomeController.
  3. The controller validates the URL.
  4. The controller calls the QR Code Service.
  5. The service generates the QR Code using the QRCoder library.
  6. The generated image is converted to Base64.
  7. The image is displayed in the browser.
  8. Users can download the QR Code or copy the original URL.

Design Patterns Used

  • MVC (Model-View-Controller)
  • Service Layer Pattern
  • Dependency Injection

Logging

The application uses ILogger to log:

  • Successful QR generation
  • Invalid URL submissions
  • Exceptions during QR generation

Exception Handling

The application gracefully handles unexpected errors and displays a user-friendly message instead of crashing.


Validation

  • Required URL
  • Invalid URL detection
  • Prevents generating QR code for an empty value

Unit Testing

The project includes xUnit tests for the QR Code generation service.


Future Improvements

  • Custom QR Colors
  • QR Size Selection
  • SVG Download
  • PDF Download
  • QR History
  • Dark Mode
  • QR Logo Upload
  • API Version

Run the Project

Clone the repository

git clone https://github.com/YOUR_GITHUB_USERNAME/QrCodeGenerator.git

Go to the project folder

cd QrCodeGenerator

Restore packages

dotnet restore

Run the project

dotnet run

Open your browser

https://localhost:7189

Screenshots

Home Page

(Add screenshot here)

Generated QR Code

(Add screenshot here)

About Page

(Add screenshot here)


Developer

Deep KC


License

This project is created for learning and portfolio purposes.

About

A modern QR Code Generator built with ASP.NET Core 9 MVC.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors