Skip to content

ChocoJaYY/Ceylon-NIC-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ†”βœ¨ Ceylon NIC Engine πŸ‡±πŸ‡°

Ceylon NIC Engine Banner

πŸ§ͺ A playful, AI-infused, barcode-generating, identity-fabricating engine made for Sri Lankan devs, designers & testers πŸ‡±πŸ‡°!


πŸš€ What is this?

Ceylon NIC Engine is a web app that lets you generate fake but realistic Sri Lankan National ID Card data (NICs) for fun, learning, and testing.

It combines:

  • 🎲 Random Sinhala names
  • πŸ“ Smart addresses
  • 🧠 Gemini AI-powered portraits
  • πŸ“‡ PDF417 barcodes

With a modern UI and super chill vibes 🌈


🧰 Features

  • πŸ†” Generates NICs that look real (but aren't!)
  • πŸ‘¦ Sinhala name/person generation (Tamil & Muslim coming soon)
  • 🏑 Address & location data included
  • πŸ“Έ Portraits made by Gemini AI
  • πŸ“‡ PDF417 barcode matches the NIC data
  • πŸŒ— Beautiful dark-orange UI (TailwindCSS)
  • βš™οΈ Built with Flask (soon Gunicorn)

πŸ“Έ Demo Preview

NIC Demo preview


🧠 AI + Barcode Sync

πŸ“‡ Barcode = Truth.
The PDF417 barcode is encoded with the same exact data as shown on the NIC:

  • Full Name (Sinhala/Tamil/English)
  • DOB
  • Gender
  • Province
  • NIC Number

Barcode Demo preview

πŸ“Œ The PDF417 barcode is 100% encoded with the exact generated data for the fake identity.
If someone scans the barcode, the data on the front side of the ID card will match the decoded barcode content exactly.


πŸ“ Project Structure

Ceylon-NIC-Engine/
β”œβ”€β”€ run.py                      # Main Flask app entry point
β”œβ”€β”€ requirements.txt            # Python dependencies
β”œβ”€β”€ .env                        # Gemini API key (NOT version-controlled)
β”œβ”€β”€ LICENSE                     # MIT License
β”œβ”€β”€ templates/
β”‚   └── index.html              # Main HTML template
β”œβ”€β”€ static/
β”‚   └── portrait/
β”‚       └── temp.jpg            # Cached portrait image
β”œβ”€β”€ gendata/                    # Go microservice source (NIC generator)
β”‚   β”œβ”€β”€ build_all.ps1           # Build script for Windows
β”‚   β”œβ”€β”€ build_all.sh            # Build script for Linux/macOS
β”‚   β”œβ”€β”€ go.mod                  # Go module definition
β”‚   β”œβ”€β”€ go.sum                  # Go module checksums
β”‚   └── nic_generator.go        # Go source for NIC data logic
β”œβ”€β”€ bin/                        # Precompiled Go binaries
β”‚   β”œβ”€β”€ amd64_linux_NICServer
β”‚   β”œβ”€β”€ amd64_windows_NICServer.exe
β”‚   β”œβ”€β”€ amd64_darwin_NICServer
β”‚   β”œβ”€β”€ arm64_linux_NICServer
β”‚   └── arm64_darwin_NICServer
β”œβ”€β”€ generated/                  # Saved fake NIC generations
β”‚   └── 200151092876/
β”‚       β”œβ”€β”€ barcode.png
β”‚       β”œβ”€β”€ portrait.jpg
β”‚       └── data.txt
β”œβ”€β”€ downloads/                  # Exported NIC zip archives
β”‚   └── 200151092876-234045-2662025.zip
β”œβ”€β”€ logs/                       # Logs for debugging AI responses
β”‚   β”œβ”€β”€ last_name_response.json
β”‚   └── last_address_response.json
β”œβ”€β”€ img/                        # Assets for README/demo purposes
β”‚   β”œβ”€β”€ demoscreenshot.png
β”‚   └── Untitled-ASDs2.png


πŸš€ Getting Started

πŸ”§ Requirements

  • Python 3.8+
  • Go (for the NIC generator microservice) Download GoLang from here
  • Gemini API Key from Google AI Studio

πŸ”‘ Get Your Gemini API Key

  1. Go to https://aistudio.google.com/
  2. Sign in with your Google account.
  3. Click your profile pic (top right) β†’ API Keys
  4. Click Create API Key and copy it.

Create or update .env file in the root folder and paste/change this:

GEMINI_API_KEY=your_google_gemini_api_key

Replace "your_google_gemini_api_key" with your actual API Key. And KEEP YOUR KEY SAFE.


πŸ’» Installation

git clone https://github.com/ChocoJaYY/Ceylon-NIC-Engine.git
cd Ceylon-NIC-Engine
python3 -m venv venv
source venv/bin/activate   # On Windows: venv\Scripts\activate
pip install -r requirements.txt

βš™οΈ Build Go Backend (Optional)

Make sure you have Go installed and in your PATH.

For Linux/macOS:

cd gendata
bash build_all.sh

For Windows:

cd gendata
.build_all.ps1

πŸ§ͺ Run the App

source venv/bin/activate
python run.py

Then visit πŸ‘‰ http://localhost:5000


πŸ“Έ Example Output

Below are examples of the kind of data generated by this engine:

πŸ†” Sample NIC Output with Portrait and Barcode

generated sample portrait

NIC barcode preview

πŸ“Œ The PDF417 barcode is 100% encoded with the exact generated data for the fake identity.
If someone scans the barcode, the data on the front side of the ID card will match the decoded barcode content exactly.


πŸ“¦ Tech Stack

Part Tech
🎨 Frontend HTML + TailwindCSS
🧠 AI Power Gemini (Google AI)
🐍 Backend Flask (Python)
βš™οΈ Microservice Go + Gin
πŸ–ΌοΈ Portraits PIL + Gemini
πŸ“‡ Barcode pdf417 (Python library)

πŸ“ TODO List

🚧 Future Features & Fixes in the Works:

  • πŸ”₯ Switch to Gunicorn instead of Flask dev server
  • ♻️ Add a way to restore previous generations. (Maybe a admin panel or IDK)
  • πŸ›‘οΈ Fix directory traversal security issue (PLEASE NEVER DEPLOY THIS PUBLICLY. If you did so good luck)
  • 🌍 Migrating all Gemini requests to requests instead of curl
  • 🌐 Add Tamil & Muslim person generation (random or selectable)
  • πŸ•’ NIC History View – track previously generated NICs
  • ❌ Retry & better error handling for Gemini/API failures
  • βœ… Input validation to harden the app
  • πŸŽ›οΈ Add Advanced Generation Mode (e.g. user defines skin tone, hair, background)
  • 🚷 Prevent external API abuse (rate limits, tokens, CAPTCHA)
  • πŸ“ Organize & sandbox file handling
  • πŸ‘€ Add Local Mode and Public Mode. (Public mode If youre exposing this to public internet. More on later.)

🌟 Show Some Love

If you enjoy this project:

  • ⭐ Star it
  • πŸ› Report bugs
  • 🧠 Suggest ideas
  • πŸ”₯ Fork it and go wild to makes me motivate to maintain, make new projects like these. 🧑

Made with 🧑 for Sri Lankans πŸ‡±πŸ‡°
by @ChocoJaYY


πŸ“„ License

MIT License

About

A Powerful, AI Powered NIC Generation Tool for next-gen Sri Lankan ID Generation.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published