Skip to content

Repository files navigation

CivicTrust

CivicTrust is a privacy-first civic engagement platform for smart cities in India. It combines blockchain technology with social features to empower communities to participate in local governance while maintaining privacy through Anon Aadhaar and zero-knowledge proofs.

✨ Features

  • Privacy-First: Anonymous civic engagement with Anon Aadhaar and zero-knowledge proofs
  • Blockchain-Powered: Transparent governance with DAOs on Polygon network
  • Community-Driven: Local issue reporting, event management, and project tracking
  • AI-Enhanced: Smart recommendations and insights through Google Gemini
  • Web3 Ready: MetaMask integration for secure blockchain transactions
  • Modern UI: Clean, responsive design optimized for end users

🚀 Quick Start

Prerequisites

  • Node.js 18+ and npm
  • MetaMask extension (for blockchain features)
  • Google Cloud Console project (for Google Auth)
  • MongoDB database (optional for full features)

Installation

  1. Clone and install dependencies

    git clone <repository-url>
    cd CivicTrust
    npm install
  2. Set up environment variables

    cp .env.local.example .env.local

    Add your configuration:

    # Authentication
    NEXTAUTH_SECRET=your_jwt_secret_here
    NEXT_PUBLIC_GOOGLE_CLIENT_ID=your_google_client_id
    
    # Blockchain (Hardhat Local)
    NEXT_PUBLIC_FACTORY_CONTRACT_ADDRESS=your_deployed_contract_address
    NEXT_PUBLIC_NETWORK_ID=1337
    
    # Optional APIs
    GEMINI_API_KEY=your_gemini_api_key
    NEXT_PUBLIC_OPENWEATHER_API_KEY=your_openweather_api_key
    MONGODB_URI=your_mongodb_connection_string
  3. Deploy smart contracts locally

    # Start Hardhat node
    npm run node
    
    # In another terminal, deploy contracts
    npm run deploy
  4. Start the development server

    npm run dev
  5. Access the application Open http://localhost:3000

API Endpoints

Authentication

  • POST /api/auth/register - Register a new user

    • Body: { "name": "User Name", "email": "user@example.com", "password": "password" }
    • Response: User data and JWT token
  • POST /api/auth/login - Log in existing user

    • Body: { "email": "user@example.com", "password": "password" }
    • Response: User data and JWT token
  • GET /api/user/profile - Get current user profile (protected)

    • Headers: Authorization: Bearer <token>
    • Response: User profile data
  • PATCH /api/user/profile - Update user profile (protected)

    • Headers: Authorization: Bearer <token>
    • Body: Updated profile fields
    • Response: Success message and updated data

Projects

  • GET /api/projects - Get all projects

    • Response: Array of projects
  • POST /api/projects - Create a new project (protected)

    • Headers: Authorization: Bearer <token>
    • Body: Project data
    • Response: Created project ID
  • GET /api/projects/:id - Get a specific project

    • Response: Project data
  • PATCH /api/projects/:id - Update a project (protected)

    • Headers: Authorization: Bearer <token>
    • Body: Updated project fields
    • Response: Success message
  • DELETE /api/projects/:id - Delete a project (protected, admin only)

    • Headers: Authorization: Bearer <token>
    • Response: Success message

Issues

  • GET /api/issues - Get all issues

    • Response: Array of issues
  • POST /api/issues - Create a new issue (protected)

    • Headers: Authorization: Bearer <token>
    • Body: Issue data
    • Response: Created issue ID
  • GET /api/issues/:id - Get a specific issue

    • Response: Issue data
  • PATCH /api/issues/:id - Update an issue (protected)

    • Headers: Authorization: Bearer <token>
    • Body: Updated issue fields
    • Response: Success message
  • DELETE /api/issues/:id - Delete an issue (protected, admin only)

    • Headers: Authorization: Bearer <token>
    • Response: Success message

AI Integration

  • POST /api/gemini - Generate AI responses using Gemini
    • Body: { "prompt": "Your prompt here" }
    • Response: Generated text from Gemini

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages