Nepal License Checker Case Study
Real-time tool and zero-dependency npm SDK to check Nepal smart-card driving license print status. Scrapes DOTM PDFs on a cron, served via an edge SQLite database.
Situation & Problem Statement
In Nepal, the Department of Transport Management (DOTM) processes smart-card driving licenses for thousands of applicants every week. However, applicants regularly wait months to discover whether their physical license card has been printed and is ready for collection at their zonal transport office.
The official government portal suffers from chronic server instability:
- Frequent server timeouts, 502 bad gateway errors, and database connection limits during peak work hours.
- Status data was historically distributed by publishing massive, unindexed PDF files containing tens of thousands of printed license registration numbers.
- Applicants were forced to download 30MB+ PDF files on slow mobile connections and search manually through thousands of pages of tabular records.
Project Goals & Technical Scope
I engineered Nepal License Checker as an edge-native, automated status verification utility designed to solve this data accessibility gap:
- Automated Ingestion: Ingest newly published DOTM print records automatically without manual intervention.
- Sub-100ms Latency: Deliver instantaneous query response times across Nepal and mobile networks.
- High Availability: Provide 100% uptime regardless of whether official DOTM government servers are online or offline.
- Zero Hassle UI: Deliver a clean, accessible lookup interface where users enter only their applicant or license number.
System Architecture
[Official DOTM Portal]
│
▼ (Automated Cron Worker)
[PDF Ingestion & Text Extraction]
│
▼ (Structured libSQL Batches)
[Turso Edge SQLite Database] ◄─── (Edge Replicated in South Asia)
│
▼ (Sub-85ms Edge API Route)
[Next.js PWA Client] ───> [Real-time Status Display]
1. Automated Scraping & PDF Extraction Pipeline
A serverless cron worker executes scheduled background checks against the transport department portal:
- Streams newly uploaded PDF publications directly into memory.
- Uses a custom PDF text parser that extracts tabular columns: Applicant ID, Full Name, Category, License Number, and Print Date.
- Normalizes variations in Nepali dates (Bikram Sambat - BS) and Gregorian dates (AD) to ensure consistent indexing.
2. Edge Data Replication with Turso (libSQL)
Rather than hosting a centralized SQL server in North America or Europe, I selected Turso (libSQL/SQLite):
- Replicated databases geographically close to end-users in South Asia (India/Singapore edge nodes), reducing network round-trip time (RTT).
- Implemented composite indexes covering lookup identifiers:
CREATE INDEX idx_licenses_applicant_lookup
ON printed_licenses (applicant_id, license_number);
- Each query executes in 12–18ms on the database engine, yielding total end-to-end HTTP response times under 85ms.
3. Client UI & Caching Layer
Built with Next.js App Router and Tailwind CSS:
- Server-rendered input form with instant client-side input validation and error feedback.
- Local browser caching prevents redundant requests when users verify status multiple times on the same day.
Interactive Lookup Simulator
Below is an interactive playground demonstrating the status lookup verification logic:
Official npm Package & SDK (nepal-license-checker)
To enable developers to integrate Nepal driving license verification into third-party apps, chatbots, and automation workflows, I packaged and published the official nepal-license-checker SDK on npm:
- Zero Dependencies: Lightweight, native
fetch-based architecture compatible with Node.js 18+, Bun, Deno, Next.js, Vite, React Native, and browser environments. - Devanagari & ASCII Numeral Support: Transparently parses and normalizes both Western digits (
0-9) and Nepali numerals (०-९). - Offline Format Validation & Masking: Includes
validateLicenseNumberandformatLicenseNumberfor immediate client-side input verification without server round-trips. - Dual ESM & CommonJS: Full TypeScript type definitions (
.d.ts) included out of the box.
npm install nepal-license-checker
import { checkLicense, validateLicenseNumber } from "nepal-license-checker";
// Offline format validation (supports Devanagari numerals)
if (validateLicenseNumber("01-01-12345678")) {
// Query status against mirrored edge API
const result = await checkLicense("01-01-12345678");
if (result.status === "success" && result.isReady && result.data) {
console.log(`License printed! Pickup at: ${result.data.office}`);
}
}
Measurable Results & Impact
- Search Query Latency: Dropped from 5,000ms+ (or total timeout on DOTM) to an average of 85ms.
- Community Adoption: Processed over 10,000+ status lookups in the first month without a single downtime incident.
- npm Package Distribution: Published
nepal-license-checkerSDK on npm, offering a zero-dependency TypeScript library for the Nepali developer ecosystem. - Data Footprint: Compressed raw 100MB+ PDF documents into structured, queryable edge SQLite tables occupying less than 12MB.
- Production Deployment: Live application accessible at license-checker.acharyanischal.com.np, npm package at npmjs.com/package/nepal-license-checker, with open-source code on GitHub.
Frequently Asked Questions
How frequently does Nepal License Checker update its data?
The serverless cron worker checks the Department of Transport Management portal twice daily. When new print batches are released, records are parsed, verified, and committed to the edge database within minutes.
Does the system store personal applicant information?
No personal contact information or private identification details are stored or logged. The utility only stores public print status registration numbers required to verify collection readiness.
Why was Turso edge SQLite chosen over PostgreSQL?
Because this workload is read-heavy with simple point lookups, edge-replicated SQLite provides single-digit millisecond read latencies without connection pooling overhead or cold-start penalties typical of serverless relational databases.