GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - 5araang/order-tracking-indianpost: Zero-config India Post consignment tracker NPM CLI & full-stack React portal. Live REST API, AES-256 encrypted payloads, and event timelines.

BranchesTags
Open more actions menu

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
api
api
 
 
public
public
 
 
src
src
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
extract-hashes.js
extract-hashes.js
 
 
index.html
index.html
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
postcss.config.js
postcss.config.js
 
 
tailwind.config.js
tailwind.config.js
 
 
tsconfig.json
tsconfig.json
 
 
vercel.json
vercel.json
 
 
vite.config.ts
vite.config.ts
 
 

Repository files navigation

๐Ÿ“ฆ India Post Enterprise Consignment Tracker & track-post NPM CLI

A blazing-fast, full-stack India Post tracking portal & zero-config NPM CLI built with React + Vite + Express + Node.js.
Live REST API ยท AES-256 Encrypted Payloads ยท Admin-Authenticated Portal ยท Rate-Limited Search

npm Open Source Built with Vite React TypeScript Deploy on Vercel


Made with โค๏ธ by Sarang
๐ŸŒ Portfolio / GitHub ยท ๐Ÿ“ธ Instagram @5araang ยท ๐Ÿ“ฆ NPM Package


๐Ÿง  What Is This?

This project consists of two core open-source components:

  1. track-post NPM Package & CLI: A zero-config CLI tool and Node.js library (npx track-post <id>). Zero API keys required. Auto-token generation & 6-day TTL caching.
  2. Web Portal SPA: A production-grade India Post tracking web application with live REST API, event timelines, and admin portal.
  • ๐Ÿ” Admin authentication via environment credentials (no database required)
  • ๐Ÿ”‘ Developer API key system with AES-256 encrypted or plain JSON response modes
  • ๐Ÿ“ฆ Live tracking of any 13-character India Post consignment ID (Speed Post, Parcel, etc.)
  • ๐Ÿ“Š Visual event timeline showing every checkpoint in a parcel's journey
  • ๐Ÿ“‹ Raw JSON inspector for developers integrating the API
  • ๐Ÿ“ Persistent search history stored locally in the browser
  • ๐Ÿšฆ Rate limiting โ€” configurable, defaults to 5 requests/minute

๐Ÿ“ฆ track-post NPM Package & CLI

You can run tracking directly from your terminal or install it as a library in any Node.js / TypeScript project:

1. Instant Terminal Run (Zero Install)

# Live tracking
npx track-post <tracking-id>

# Demo mode (sample parcel data)
npx track-post EH123456789IN --demo

2. Install as NPM Package

npm install track-post

CommonJS (src/services/trackingService.js)

const { track, init } = require('track-post');

/**
 * Track an India Post consignment ID
 * @param {string} consignmentId - 13-character ID or raw number
 */
async function getTrackingDetails(consignmentId) {
  try {
    const data = await track(consignmentId);
    return { success: true, data };
  } catch (error) {
    return { success: false, error: error.message };
  }
}

module.exports = { getTrackingDetails, init };

ES Module / TypeScript (src/services/trackingService.ts)

import { track, init, TrackResult } from 'track-post';

export interface TrackingResponse {
  success: boolean;
  data?: TrackResult;
  error?: string;
}

export async function getTrackingDetails(consignmentId: string): Promise<TrackingResponse> {
  try {
    const data: TrackResult = await track(consignmentId);
    return { success: true, data };
  } catch (error: any) {
    return { success: false, error: error?.message || 'Tracking failed' };
  }
}

โœจ Features

Feature Description
๐Ÿ”ด Flat 3-Color Design Minimalist Black ยท White ยท Red (#dc2626) theme
๐Ÿ” Env-Based Auth Admin portal login via .env email/password โ€” no DB needed
๐Ÿ”‘ API Key Management AES-256 encrypted payload support or plain JSON mode
๐Ÿ“ก REST API Endpoint GET /v1/api/track/:code โ€” publicly accessible tracking endpoint
๐Ÿ“œ Event Timeline Visual checkpoint timeline with timestamps and locations
๐Ÿ’พ Search History Browser-local history with quick re-track support
๐Ÿšฆ Rate Limiter 5 req/min limit with live badge indicator in the navbar
๐Ÿ“„ API Docs Page Built-in developer API documentation page at /docs
๐Ÿ—‚๏ธ Sidebar Drawer Slide-out control panel for session info, API keys, and history
โšก Vite + React 18 Ultra-fast HMR dev server with an optimized production build

๐Ÿ—๏ธ How It Works

User enters 13-character Consignment ID
         โ”‚
         โ–ผ
  React Frontend (Vite + TypeScript)
         โ”‚
         โ–ผ
  Express API Server  (api/ folder)
         โ”‚
         โ”œโ”€โ”€ 1. Fetches action token from India Post Next.js Server Action
         โ”‚
         โ”œโ”€โ”€ 2. Calls the India Post tracking endpoint with token + consignment ID
         โ”‚
         โ”œโ”€โ”€ 3. Parses and normalizes event data into a clean structure
         โ”‚
         โ””โ”€โ”€ 4. Returns JSON response (plain or AES-256 encrypted)
                      โ”‚
                      โ–ผ
         Frontend renders results:
           โ”œโ”€โ”€ Summary Cards  (status, weight, origin, destination)
           โ”œโ”€โ”€ Visual Activity Timeline  (checkpoint-by-checkpoint)
           โ””โ”€โ”€ Raw JSON Inspector  (for developers)

๐Ÿ” Authentication Flow

Browser visits any protected route
    โ”‚
    โ–ผ  Not authenticated?
    โ””โ”€โ”€โ–บ Redirect to /login
             โ”‚
             โ–ผ  Enter email + password (from .env)
         AuthService.login()
             โ”‚
             โ–ผ  Session saved in localStorage
         Routes unlocked:
           โ”œโ”€โ”€ /       โ†’ Consignment Tracker
           โ””โ”€โ”€ /docs   โ†’ API Documentation

๐Ÿ”‘ API Key & Encryption

Developer API keys are generated client-side using crypto-js.

Request Header Response Format
No API key AES-256 encrypted ciphertext payload
Valid X-API-Key header Structured plain JSON response

๐Ÿ“ Project Structure

indiapost-tracker-master/
โ”œโ”€โ”€ npm/                       # Standalone track-post NPM Package & CLI
โ”‚   โ”œโ”€โ”€ bin/
โ”‚   โ”‚   โ””โ”€โ”€ cli.js             # npx track-post CLI binary
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ index.js           # Public track() & init() exports
โ”‚   โ”‚   โ”œโ”€โ”€ extractor.js       # Auto Next.js action hash scraper
โ”‚   โ”‚   โ”œโ”€โ”€ config.js          # ~/.track-post/config.json 6-day TTL cache
โ”‚   โ”‚   โ””โ”€โ”€ tracker.js         # Core RSC requester & normalizer
โ”‚   โ”œโ”€โ”€ types/
โ”‚   โ”‚   โ””โ”€โ”€ index.d.ts         # TypeScript definitions
โ”‚   โ”œโ”€โ”€ package.json           # "name": "track-post"
โ”‚   โ””โ”€โ”€ README.md
โ”œโ”€โ”€ indiapost-vite/            # Full-stack React + Vite Web Portal
โ”‚   โ”œโ”€โ”€ api/                   # Express API server handlers
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/        # React UI components
โ”‚   โ”‚   โ”œโ”€โ”€ services/          # API & Auth services
โ”‚   โ”‚   โ””โ”€โ”€ types/             # TypeScript types
โ”‚   โ”œโ”€โ”€ .env.example           # Environment template
โ”‚   โ”œโ”€โ”€ vercel.json            # Vercel deployment routes
โ”‚   โ””โ”€โ”€ extract-hashes.js      # Next.js hash extractor
โ”œโ”€โ”€ README.md                  # Master GitHub documentation
โ””โ”€โ”€ package.json               # Root workspace manifest

โš™๏ธ Setup Guide (Web Portal)

Step 1 โ€” Clone the Repository

git clone https://github.com/5araang/indian-post-track-order-.git
cd indian-post-track-order-/indiapost-vite

Step 2 โ€” Install Dependencies

npm install

Step 3 โ€” Configure Environment Variables

Copy the example file:

cp .env.example .env

Then open .env and fill in your values:

# โ”€โ”€ India Post Developer API Credentials โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
VITE_INDIAPOST_API_KEY=your_api_key_here
VITE_INDIAPOST_API_SECRET=your_api_secret_here

# โ”€โ”€ Next.js Server Action Hashes (auto-extracted โ€” see Step 4) โ”€โ”€โ”€โ”€
VITE_NEXTJS_TOKEN_ACTION=
VITE_NEXTJS_TRACK_ACTION=

# โ”€โ”€ Rate Limiting (default: 5 searches per 60 seconds) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
VITE_RATE_LIMIT_MAX_SEARCHES=5
VITE_RATE_LIMIT_WINDOW_MS=60000

# โ”€โ”€ Admin Portal Login Credentials โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
VITE_ADMIN_EMAIL=[email protected]
VITE_ADMIN_PASSWORD=your_secure_password

Step 4 โ€” Extract Next.js Server Action Hashes

โš ๏ธ Required! This populates VITE_NEXTJS_TOKEN_ACTION and VITE_NEXTJS_TRACK_ACTION automatically.

npm run extract-hashes

Step 5 โ€” Run the Dev Server

npm run dev

Open http://localhost:5173 in your browser and log in with your .env admin credentials.


๐Ÿš€ Deployment on Vercel

This project is pre-configured for zero-config Vercel deployment.

Steps

  1. Push the repo to GitHub under your account
  2. Go to vercel.com โ†’ New Project โ†’ Import your GitHub repo
  3. Add all .env variables in Vercel Dashboard โ†’ Settings โ†’ Environment Variables
  4. Click Deploy โœ…

The vercel.json handles all API routing automatically:

GET /v1/api/track/:code   โ†’   /api/track?code=:code
GET /api/v1/track/:code   โ†’   /api/track?code=:code
GET /track/:code          โ†’   /api/track?code=:code

๐Ÿ”Œ REST API Reference

Track a Consignment

GET /v1/api/track/:code
Parameter Type Required Description
code string โœ… 13-character India Post consignment ID (e.g. <tracking-id>)

Plain JSON Response

curl https://your-deployment.vercel.app/v1/api/track/<tracking-id>
{
  "id": "YourTrackId",
  "status": "status",
  "origin": "mumbai",
  "destination": "new-delhi",
  "weight": "458 g",
  "tariff": "42",
  "delivered": true,
  "events": [
    {
      "date": "2024-01-01T12:30:45Z",
      "office": "mumbai",
      "description": "descriptionofscan",
      "status": "DELIVERED"
    }
  ]
}

๐Ÿ›ก๏ธ Security

Feature Implementation
Authentication Session-based via .env credentials. No external auth service.
API Keys Generated with crypto-js, stored only in localStorage
Encryption AES-256 encrypted response mode for API consumers
Rate Limiting Configurable per-window request cap to prevent abuse
No Database All state is .env or localStorage driven โ€” zero DB attack surface

๐Ÿ› ๏ธ Tech Stack

Layer Technology
Frontend Framework React 18 + TypeScript
Build Tool Vite 5
Styling Tailwind CSS
Icons Lucide React
API Server Express.js
Encryption CryptoJS (AES-256)
CLI & NPM Package Node.js Native HTTPS / FS (Zero Third-Party Deps)
Deployment Vercel (Serverless Functions)

๐Ÿ“œ License

This project is open source under the MIT License.

Fork it, modify it, deploy it. Attribution is appreciated but not required. ๐Ÿ™


๐Ÿ‘ค About the Author

Sarang

Full-Stack Developer ยท Open Source Builder ยท India ๐Ÿ‡ฎ๐Ÿ‡ณ

I build fast, functional, and beautifully designed web tools.
This tracker was born from a real frustration with India Post's clunky official interface.

๐ŸŒ Portfolio / GitHub github.com/5araang
๐Ÿ“ธ Instagram @5araang
๐Ÿ’ป GitHub Profile @5araang
๐Ÿ“ฆ NPM Package track-post
๐Ÿ“ This Repository indian-post-track-order-

"Ship fast. Break nothing. Track everything."
โ€” Sarang


โญ Star this repo if it helped you! โญ

Made with โค๏ธ in India by Sarang ยท GitHub: @5araang ยท Instagram: @5araang

About

Zero-config India Post consignment tracker NPM CLI & full-stack React portal. Live REST API, AES-256 encrypted payloads, and event timelines.

www.npmjs.com/package/track-post

Topics

clicli-appcli-toolclientindia-postindia-post-apinpm-packageopen-sourceopen-source-indianpostopen-source-projectopen-source-trackingparcel-trackerrest-apispeed-postspeed-post-chargestrackingtypescripttypescript-react

Resources

Readme
License
Activity

Stars

1 star

Watchers

0 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.