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.
- 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
- Node.js 18+ and npm
- MetaMask extension (for blockchain features)
- Google Cloud Console project (for Google Auth)
- MongoDB database (optional for full features)
-
Clone and install dependencies
git clone <repository-url> cd CivicTrust npm install
-
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
-
Deploy smart contracts locally
# Start Hardhat node npm run node # In another terminal, deploy contracts npm run deploy
-
Start the development server
npm run dev
-
Access the application Open http://localhost:3000
-
POST /api/auth/register - Register a new user
- Body:
{ "name": "User Name", "email": "user@example.com", "password": "password" } - Response: User data and JWT token
- Body:
-
POST /api/auth/login - Log in existing user
- Body:
{ "email": "user@example.com", "password": "password" } - Response: User data and JWT token
- Body:
-
GET /api/user/profile - Get current user profile (protected)
- Headers:
Authorization: Bearer <token> - Response: User profile data
- Headers:
-
PATCH /api/user/profile - Update user profile (protected)
- Headers:
Authorization: Bearer <token> - Body: Updated profile fields
- Response: Success message and updated data
- Headers:
-
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
- Headers:
-
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
- Headers:
-
DELETE /api/projects/:id - Delete a project (protected, admin only)
- Headers:
Authorization: Bearer <token> - Response: Success message
- Headers:
-
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
- Headers:
-
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
- Headers:
-
DELETE /api/issues/:id - Delete an issue (protected, admin only)
- Headers:
Authorization: Bearer <token> - Response: Success message
- Headers:
- POST /api/gemini - Generate AI responses using Gemini
- Body:
{ "prompt": "Your prompt here" } - Response: Generated text from Gemini
- Body:
This project is licensed under the MIT License - see the LICENSE file for details.