Skip to main content

Building RajnitiReport – A Political Intelligence Platform for Nepal

· 20 min read
samundrak
JavaScript Dev

“Democracy thrives on information. RajnitiReport makes political history, performance, and accountability visible to all.”

1. Project Overview

RajnitiReport (publicly known as NepalTracks.com) is a comprehensive political analytics and civic transparency platform designed to empower citizens, journalists, and policy analysts in Nepal. In a landscape often characterized by opaque political processes, the platform aims to be a definitive source of truth, providing data-driven insights into the activities of elected officials, governments, and political parties.

Value Proposition:

  • For Citizens: Offers an accessible way to track the performance of their representatives, understand government actions, and participate in public discourse through features like polls and ratings.
  • For Journalists & Analysts: Provides a rich, queryable database of political information, from historical election data to real-time cabinet reshuffles, facilitating in-depth research and reporting.
  • For Policy-Tech Enthusiasts: Serves as a case study in building a complex, data-centric application with a modern technology stack.

The platform's core mission is to foster accountability and transparency in Nepali politics by making political data easily accessible and understandable.

Automating Social Media: A Deep Dive into the socialcontentmanager Module

· 11 min read
samundrak
JavaScript Dev

In today's digital landscape, maintaining a consistent and engaging social media presence is crucial for any organization. For projects dealing with dynamic data, manual posting can quickly become overwhelming. This is where automated social media management systems shine. This article explores the architecture and implementation of a socialcontentmanager module, a robust system designed to automate content generation and posting across various social media platforms, with a focus on Facebook and X (formerly Twitter).

The Core Concept: Modular Content Generation

At the heart of our socialcontentmanager module is a highly modular approach to content generation. Instead of hardcoding specific post types, we leverage an interface-driven design. This allows us to define a contract for what a "social media content" should be, and then implement various content types as separate, independent classes. This approach promotes reusability, scalability, and maintainability.

The ISocialMediaContent Interface

The ISocialMediaContent interface defines the fundamental structure and behavior expected from any content type within our system. It ensures that each content class can provide the necessary information (text, image, comments) for a social media post.

Handling Affiliate Cookies and Internationalized Routing in Next.js Middleware

· 3 min read
samundrak
JavaScript Dev

When building complex Next.js applications, middleware becomes an essential place to handle cross-cutting concerns such as authentication, localization, and tracking. One common challenge is setting cookies conditionally while ensuring that the middleware returns the correct routing response—especially when dealing with internationalized routing (i18n).

In this article, I’ll walk you through a practical example where we:

  • Set an affiliate tracking cookie based on the request referer
  • Use next-i18n-router middleware to route users based on locale
  • Avoid common pitfalls that cause 404s or missing cookies

Designing the Leader Index: Election History, Party Switching & Biographical Insights

· 2 min read
JavaScript Dev

Overview

Political leaders carry the identity of electoral shifts. I designed the Leader Index Page to give a comprehensive view of every major leader’s journey—through elections, parties, positions, and scandals.

This article explains how I structured leader data, visualized career movements, and surfaced meaningful insights.


Leader Profile Fields

Each leader includes:

  • Name + Local name
  • Birthdate, gender, bio, education
  • Party affiliation history
  • Election records (vote counts, wins/losses)
  • Cabinet roles and government positions
  • Associated scandals and ratings

Election History Tracking

Each leader has a timeline of contests:

{
year: 2074,
district: 'Kathmandu-4',
party: 'NC',
votes: 36500,
rank: 1
}

Visualized using a line + bar chart hybrid with annotations for debut, loss, comeback, etc.


Party Switch Insight

Switches are detected by comparing partyId across elections and government roles. I annotate leader cards with indicators like:

  • Switched from UML to RSP in 2079
  • Left party after scandal

Biography Display

Bios are shown with support for multiple languages, tags (e.g. “Lawyer”, “Journalist”), and dynamic quote sections. Photos are embedded if available.


Each leader’s page links to:

  • Elections contested
  • Governments served
  • Ratings and polls
  • Scandal timelines (if any)

This creates a centralized profile that’s context-aware.


Summary

The Leader Index is not just a list—it’s a political memory map. With structured biographical fields, electoral history, and dynamic insights, it forms a powerful resource for researchers, voters, and students.

Next: I’ll cover how I handled constituency-level election results and map overlays to show spatial trends.

Building the Party Index with Ideologies, Manifestos, and Trendlines

· 2 min read
JavaScript Dev

Overview

Political parties form the backbone of democratic engagement. I designed the Party Index Page to give users a clear view of every major party—its history, manifesto, ideology, and performance.

This article outlines how I structured, visualized, and enriched the party page using multilingual data and analytical trends.

Structuring Government Timeline and Prime Ministerial History

· 2 min read
JavaScript Dev

Overview

Nepal’s modern political history has seen rapid changes in governments, coalitions, and Prime Ministers. I created a structured timeline that chronicles each government—with clarity on its head, party breakdown, duration, and legacy.

This article outlines the structure and visualization of the government timeline system.

Implementing Full-Text Search for Bilingual Political Data

· 2 min read
JavaScript Dev

Overview

Search is a critical part of political platforms—especially when users are trying to find leaders, elections, or scandals across decades of data. I implemented a full-text search engine that:

  • Supports both English and Nepali
  • Works across multiple models
  • Handles fuzzy and partial input

This article details how I designed and deployed this system using PostgreSQL, Prisma, and language-aware search logic.

Building a Tag-Driven Metadata System for Political Domain Classification

· 2 min read
JavaScript Dev

Overview

As my civic-tech platform evolved, the complexity of classification increased: I needed to track ministry types, cabinet roles, party types (left, regional, royalist), election kinds, and more. Rather than hardcoding categories, I built a tag-driven metadata system.

This post explains the design and use cases for tag-based classification across multiple resources.


Optimizing Platform Performance with Redis & TTL-Based Caching

· 2 min read
JavaScript Dev

Overview

As election and political data expanded, performance bottlenecks became visible—especially on pages rendering historical trends and analytics. I adopted Redis-based caching with time-based expiry to ensure:

  • Faster load times
  • Reduced DB load
  • Controlled freshness of data

This post details my approach using NestJS, Redis, and TTL strategies.


Attaching Polls to Any Resource: A Flexible, Polymorphic System

· 2 min read
JavaScript Dev

Overview

Civic platforms are incomplete without community voice. I designed a system to attach polls to any resource—leaders, parties, elections, or governments—and record structured public responses.

This post covers how I built a polymorphic poll engine that is:

  • Type-safe
  • Localized
  • Flexible in format (radio/checkbox)
  • Easily integrated across the frontend

Schema Structure