This is a Node.js backend API for user registration, authentication, and civic engagement tracking. It uses Express.js, MongoDB, and Mongoose to manage user data, including personal information, interests, and verification details.
- User registration
- Email-based user lookup
- Updating civic interests
- Aadhar verification
- MongoDB as the database
- CORS and body-parser middleware
- Node.js
- Express.js
- MongoDB with Mongoose
- dotenv for environment variables
- cors for cross-origin requests
- body-parser for parsing JSON requests
Ensure you have the following installed:
- Clone the repository:
git clone <repository-url> cd <repository-folder>
- Install dependencies:
npm install
- Create a
.env
file in the project root and add the following:PORT=5000 MONGO_URI=your_mongodb_connection_string
- Start the server:
The server will run on
node server.js
http://localhost:5000
.
You can also run the website locally on your computer by downloading the files and following these steps:
- Download or clone the repository to your local machine.
- Install all dependencies using:
npm install
- Create a
.env
file in the project root directory if it does not exist. - Open the
.env
file and add your MongoDB connection string:ReplaceMONGO_URI=your_mongodb_connection_string
your_mongodb_connection_string
with your actual MongoDB connection URL. - Ensure MongoDB is running locally or connected to a remote database.
- Start the server using:
node server.js
- Open your browser and navigate to
http://localhost:5000
to access the API.
- POST
/api/users
- Description: Registers a new user.
- Request Body:
{ "firstName": "John", "lastName": "Doe", "email": "johndoe@example.com", "password": "password123", "city": "New York", "state": "NY", "interests": ["Community Service", "Environment"] }
- Response:
{ "message": "User registered successfully" }
- GET
/api/users/:email
- Description: Fetch user details by email.
- Response:
{ "firstName": "John", "lastName": "Doe", "email": "johndoe@example.com", "city": "New York", "state": "NY", "interests": ["Community Service", "Environment"] }
- PUT
/api/users/:email/civic-interests
- Description: Updates user's civic engagement information.
- Request Body:
{ "interests": ["Community Service", "Environment"], "participationLevel": "High", "communicationPreferences": ["Email", "Phone"], "cityCouncilDistrict": "District 5", "neighborhood": "Downtown", "skills": ["Organizing", "Public Speaking"] }
- Response: Updated user object.
- POST
/api/users/:email/verify
- Description: Verifies the user's identity using Aadhar.
- Request Body:
{ "aadhar": "123456789012", "phone": "9876543210" }
- Response:
{ "message": "Verification successful" }
For automatic server restarts during development, install nodemon
:
npm install -g nodemon
nodemon server.js
The CivicConnect frontend is designed to be user-friendly and intuitive, allowing users to easily navigate through the platform and engage with community-driven initiatives. The website starts from the home page (1.html
), and subsequent pages (2.html
, 3.html
, 4.html
) are dedicated to collecting user details and storing them in the database. After completing the initial setup, users can seamlessly explore the platform, interact with the assistant bot, and participate in community activities.
-
Home Page (
1.html
)- The landing page introduces users to CivicConnect and its features.
- Provides quick access to registration, login, and community exploration.
-
User Details Pages (
2.html
,3.html
,4.html
)- These pages collect user information such as personal details, location, and civic interests.
- Data is securely stored in the database for future use.
-
Community Page
- A hub for users to explore local projects, initiatives, and governance activities.
- To provide a rich and interactive experience, the Community Page is powered by an AI-driven bot that responds with different perspectives on civic issues, fostering meaningful discussions and collaboration.
-
Issues Page
- A dedicated page where users can view and engage with community issues.
- Government authorities can update issues with proofs (e.g., links to documents, images, or videos) displayed on cards for transparency.
-
Assistant Bot
- An AI-powered bot that guides users through the platform.
- Provides real-time assistance, recommendations, and answers to user queries.
CivicConnect is an innovative web platform designed to bridge the gap between citizens and their communities by fostering engagement in civic activities. The platform empowers users to register, explore, and participate in community-driven initiatives, local governance, and social causes that align with their interests and skills.
- Enable users to easily register and manage their civic participation.
- Provide a user-friendly interface for exploring community projects.
- Encourage collaboration and knowledge-sharing among citizens.
- Assist users in finding opportunities to contribute to society based on their skills and location.
- Ensure secure user verification through Aadhar authentication.
- Offer an interactive assistant bot for guidance and seamless navigation.
- Allow government authorities to update community issues with proofs for transparency.
- Users sign up by providing their personal details, location, and interests.
- A secure database stores user information with hashed credentials for safety.
- Users can update their profiles with their civic interests, participation level, and skills.
- The platform suggests relevant community activities based on user preferences.
- Users can explore local projects, community initiatives, and governance activities.
- The Community Page is powered by an AI-driven bot that provides diverse perspectives on civic issues, encouraging thoughtful discussions and collaboration.
- Government authorities can post and update community issues with proofs (e.g., links to documents, images, or videos).
- Each issue is displayed on a card with details, status, and attached proofs for transparency.
- Users can view, comment, and engage with the issues.
- Aadhar-based identity verification ensures trusted and genuine participation.
- Users can securely store and update their contact details.
- A built-in assistant guides users in navigating the platform.
- Users can ask questions, seek recommendations, and get help in real-time.
- The website is designed to be intuitive and easy to navigate.
- Users can start by registering on the home page (
1.html
) and proceed to fill in their details on subsequent pages (2.html
,3.html
,4.html
). - Once registered, users can explore the community page, interact with the assistant bot, and participate in civic activities.
- The Community Page is designed to provide a rich and interactive experience.
- Instead of static content, the page is powered by an AI-driven bot that responds with different perspectives on civic issues.
- Users can ask questions, share their views, and receive well-rounded insights from the bot, fostering meaningful discussions and collaboration.
- This dynamic approach ensures that users are exposed to diverse viewpoints, encouraging critical thinking and informed decision-making.
- The Issues Page allows government authorities to post and update community issues.
- Each issue is displayed on a card with details such as:
- Title and description of the issue.
- Current status (e.g., "In Progress," "Resolved").
- Proofs (e.g., links to documents, images, or videos) for transparency.
- Users can view the issues, check the attached proofs, and engage by commenting or providing feedback.
- The assistant bot is available throughout the platform to provide guidance and support.
- Users can ask questions, seek recommendations, and get help in real-time.
- HTML, CSS, JavaScript: For building the frontend interface.
- Bootstrap: For responsive and modern UI design.
- AJAX/Fetch API: For seamless communication with the backend.
- AI-powered Assistant Bot: For real-time user guidance and support.
- Download or clone the repository to your local machine.
- Open the
1.html
file in your browser to access the home page. - Navigate through the website using the links provided on each page.
- Use the assistant bot for guidance and explore the community page for civic engagement opportunities.
- Visit the Issues Page to view and engage with community issues posted by government authorities.
This project is licensed under the MIT License.
CivicConnect is a step towards a more connected, active, and responsible society. By making civic participation more accessible and engaging, the platform fosters a culture of collective responsibility and positive change. The Community Page, powered by an AI-driven bot, ensures users receive diverse perspectives on civic issues, while the Issues Page promotes transparency and accountability by allowing government authorities to update issues with proofs. Together, these features create a dynamic and inclusive platform for civic engagement.