Prerequisites:

  • Node.js (version 14 or higher)
  • A code editor of your choice
  • API key for the CPGRAMS Simulation API

Setting Up Your Development Environment

Follow these steps to set up your development environment for working with the CPGRAMS Simulation API:

1. Clone the Example Repository

We provide a starter repository with example code to help you get started quickly:

git clone https://github.com/opennyai/cpgrams-simulation-examples.git
cd cpgrams-simulation-examples

2. Install Dependencies

npm install

3. Configure Your API Key

Create a .env file in the root directory of the project and add your API key:

CPGRAMS_API_KEY=your_api_key_here
CPGRAMS_API_URL=https://api.cpgrams-simulation.opennyai.org

API Endpoints

The CPGRAMS Simulation API provides the following key endpoints:

User Management

# Create a new user
POST /users

# Get all users
GET /users

# Get a specific user
GET /users/{userId}

# Update a user
PUT /users/{userId}

# Delete a user
DELETE /users/{userId}

Grievance Management

# Submit a new grievance
POST /grievances

# Get all grievances
GET /grievances

# Get a specific grievance
GET /grievances/{grievanceId}

# Update a grievance
PUT /grievances/{grievanceId}

# Assign a grievance to an officer
POST /grievances/{grievanceId}/assign

# Update grievance status
POST /grievances/{grievanceId}/status

Webhook Notifications

# Register a webhook URL
POST /webhooks

# Get registered webhooks
GET /webhooks

# Delete a webhook
DELETE /webhooks/{webhookId}

Running the Example Applications

The example repository includes several sample applications demonstrating different use cases:

# Run the citizen portal example
npm run citizen-portal

# Run the officer dashboard example
npm run officer-dashboard

# Run the analytics dashboard example
npm run analytics-dashboard

Each application will be available at http://localhost:3000 by default.

Building Your Own Applications

You can use the CPGRAMS Simulation API to build your own applications for the Maker Residency 2025 program. Here are some recommended frameworks and libraries:

Frontend Frameworks

  • React: A JavaScript library for building user interfaces
  • Vue.js: A progressive framework for building user interfaces
  • Angular: A platform for building mobile and desktop web applications

Backend Frameworks

  • Express.js: A minimal and flexible Node.js web application framework
  • FastAPI: A modern, fast web framework for building APIs with Python
  • Django: A high-level Python web framework

Mobile Development

  • React Native: A framework for building native mobile applications
  • Flutter: Google’s UI toolkit for building natively compiled applications

Best Practices

Troubleshooting

Getting Help

If you encounter any issues or have questions about the CPGRAMS Simulation API, you can: