DEV Community

NIRANJAN LAMICHHANE
NIRANJAN LAMICHHANE Subscriber

Posted on

नियम नियति (Niyam Niyati) - Youth Bill Engagement Platform

📋 Project Overview

Niyam Niyati (meaning "Laws & Destiny" in Nepali) is an AI-powered civic engagement platform that helps Nepali youth (ages 16-25) understand complex legislative bills through empathy-driven persona exploration. The application transforms abstract legal documents into relatable human stories, enabling young citizens to understand legislation through the eyes of those it affects most.

The Problem We're Solving

Young people often feel disconnected from legislative processes because:

  • Legal language is intimidating and inaccessible
  • Bills seem abstract with no clear personal relevance
  • There's no easy way to understand how laws affect different people
  • Traditional civic education fails to engage digital-native youth

Our Solution

We built a Frankenstein monster of technologies - stitching together AI persona generation, empathy-building mechanics, and civic engagement into something unexpectedly powerful. The platform:

  1. Presents real Nepali legislative bills in a digestible format
  2. Generates AI-powered personas representing diverse demographics affected by each bill
  3. Shows concrete scenarios demonstrating bill impacts (action → consequence)
  4. Enables perspective-based voting from each persona's viewpoint
  5. Provides AI-generated insights and recommendations for both youth and lawmakers

🔧 Technologies Stitched Together (The Frankenstein Factor)

Our app is a true chimera, combining seemingly incompatible elements:

Technology Purpose The "Unexpected" Element
Perplexity AI (Sonar) Persona & insight generation Using search-grounded AI for legislative context
React 18 + Vite Frontend framework Spec-driven development with Kiro
Tailwind CSS Styling Fully responsive civic engagement UI
LocalStorage Data persistence Client-side vote aggregation
React Router v6 Navigation Multi-perspective user journey

The Chimera Effect

We stitched together:

  • AI + Civic Education: Using LLMs to make legislation accessible
  • Empathy Mechanics + Voting: Understanding others' perspectives before casting votes
  • Youth Culture + Formal Legislation: Making legal documents relatable to Gen-Z
  • Nepali Context + Global Tech: Localizing AI for a specific cultural context

🛠️ How Kiro Was Used

Spec-Driven Development

We leveraged Kiro's spec-driven approach extensively. Our .kiro/specs/youth-bill-engagement/ directory contains:

requirements.md - Detailed User Stories & Acceptance Criteria

### Requirement 1
**User Story:** As a user, I want to view and select from available bills, 
so that I can explore legislation that interests me.

#### Acceptance Criteria
1. WHEN the System starts THEN the System SHALL display four bill cards...
2. WHEN a user hovers over a bill card THEN the System SHALL apply animation...
Enter fullscreen mode Exit fullscreen mode

This structured approach ensured every feature was traceable to a user need.

design.md - Architecture & Correctness Properties

We defined 21 correctness properties that served as formal specifications:

### Property 4: API response validation
*For any* API response, the validation function should verify that the JSON 
structure contains persona_name, persona_profile, what_stays_same (4 items), 
what_becomes_riskier (5 items), and scenarios (4 items with action and 
consequence fields).
Enter fullscreen mode Exit fullscreen mode

tasks.md - Implementation Plan

Kiro helped break down the project into actionable tasks with clear dependencies and requirement mappings.

Steering Documents

Our .kiro/steering/ directory contains:

  1. product.md - Product vision and core features
  2. tech.md - Technology stack and commands
  3. structure.md - Project architecture and naming conventions

How Kiro Improved Development

  1. Structured Conversations: We used Kiro to discuss requirements before coding, resulting in clearer implementations

  2. Spec-to-Code Traceability: Every component includes requirement references:

   /**
    * Persona Screen Component
    * Requirements: 3.1, 3.2, 3.3, 3.4, 3.5, 4.1, 4.2, 4.3, 4.4, 6.4
    */
Enter fullscreen mode Exit fullscreen mode
  1. Property-Based Testing Strategy: Kiro helped define properties for testing:
   // Feature: youth-bill-engagement, Property 5: Persona data storage round-trip
Enter fullscreen mode Exit fullscreen mode
  1. Consistent Architecture: Steering docs ensured consistent patterns across the codebase

Most Impressive Code Generation

Kiro helped generate our Perplexity API service with sophisticated prompt engineering:

const prompt = `You are helping Nepali youth (ages 16-25) understand legislation. 
Generate 4 diverse personas affected by this bill.

Requirements:
- Use neutral, unbiased tone
- Use youth-friendly language appropriate for ages 16-25
- Provide relatable context for Nepali youth
- Each persona should represent a different demographic

Return ONLY valid JSON in this exact structure:
[{
  "persona_name": "Name (Age, Occupation/Role)",
  "persona_profile": "2-3 sentence description...",
  "what_stays_same": ["bullet 1", "bullet 2", ...],
  "what_becomes_riskier": ["bullet 1", "bullet 2", ...],
  "scenarios": [{ "action": "...", "consequence": "..." }]
}]`;
Enter fullscreen mode Exit fullscreen mode

The spec-driven approach ensured the AI output matched our exact requirements.


🎯 Key Features

1. Bill Selection Screen

  • Displays 4 real Nepali legislative bills with emojis and summaries
  • Hover animations for engaging UX
  • Loading states during AI persona generation

2. Persona Exploration

Each bill generates 4 AI personas with:

  • Persona Profile: Who they are and their situation
  • What Stays the Same: 4 aspects unchanged by the bill
  • What Becomes Riskier: 5 potential risks from the bill
  • Scenarios: 4 action-consequence pairs

3. Perspective-Based Voting

  • Vote from each persona's perspective (Support/Oppose/Unsure)
  • Optional message to lawmakers
  • Votes stored locally for aggregation

4. Community Insights

  • Aggregated voting statistics per persona
  • AI-generated summary and key insights
  • Recommendations for both youth and lawmakers

📱 Bills Included

Bill Description
📱 Social Media Act (Bill), 2081 Regulates social media platforms and users
🔒 IT and Cyber Security Bill, 2082 Defines cybercrime offenses and penalties
🎓 School Education Bill, 2080 Restructures school levels and standards
🔐 Privacy Act, 2075 Governs personal data protection

🚀 Running the Application

Prerequisites

  • Node.js v16+
  • Perplexity API key

Installation

npm install
Enter fullscreen mode Exit fullscreen mode

Configuration

Create .env.local:

VITE_PERPLEXITY_API_KEY=your_api_key_here
Enter fullscreen mode Exit fullscreen mode

Development

npm run dev
Enter fullscreen mode Exit fullscreen mode

Testing

npm run test
Enter fullscreen mode Exit fullscreen mode

🧪 Testing Coverage

  • ✅ 34 automated tests passing
  • ✅ Storage service tests (17 tests)
  • ✅ Persona screen tests (7 tests)
  • ✅ Application structure tests (10 tests)

🎨 Design Philosophy

Neutral Presentation

The platform maintains strict neutrality - presenting facts without editorial bias, allowing users to form their own opinions.

Empathy-First Approach

By experiencing legislation through diverse personas, users develop empathy for how laws affect different people.

Youth-Friendly Language

All AI-generated content is tailored for ages 16-25 with relatable context and accessible language.

Responsive Design

  • Desktop (≥1024px): Two-column layouts
  • Mobile (<1024px): Single-column optimized views

🏆 Why This Fits "Frankenstein"

Like Dr. Frankenstein's creation, we've stitched together parts that shouldn't work together:

  1. The Brain (AI): Perplexity's Sonar model provides intelligent persona generation
  2. The Heart (Empathy): Perspective-taking mechanics create emotional connection
  3. The Body (Tech Stack): Modern web technologies give it form
  4. The Soul (Purpose): Civic engagement gives it meaning
  5. The Spark (Kiro): Spec-driven development brought it to life

The result is something greater than the sum of its parts - a platform that makes democracy accessible to the next generation.


📜 License

Open Source under MIT License


🔗 Links


👥 Team

Built with ❤️ for Nepali youth and democracy


"It's alive!" - Dr. Frankenstein (and us, when the specs finally compiled)

Top comments (0)