In the United States, the voting-age population turnout has been historically lower and lags behind many other peer countries. We believe our project can help increase civic engagement by educating users. Our application aims to encourage users to participate in democracy by making it easier to access election information.
When a user inputs their residential address, we query the Google Civics API and present comprehensive information about on any upcoming U.S. elections. We also offer the user the ability to see information about representatives across all levels of government based on the users input.
Check out our Devpost here! Devpost Civic Central
- Derek Chen - @drkchn – derche [at] seas[dot]upenn[dot]edu – GitHub
- Connor Fech - @cfech – cfech [at] seas[dot]upenn[dot]edu – GitHub
- Gunjan Jhaveri - @gjhaveri98 – gjhaveri [at] seas[dot]upenn[dot]edu – GitHub
- Prinsa Patel - @prinsaa – prinsa [at] seas[dot]upenn[dot]edu – GitHub
- Node Version Manager Install to manage multiple Node.js versions (Optional)
- Node.js (version 18.16.0)
- Google Cloud Account
- Google Civic Information API key
- Clone the repository to your intended directory
git clone https://github.com/drkchn/mosa-upenn-SoC-2023.git
-
Run the command
npm install
to install all dependencies -
create a file in the root directory called
.env
- Add the following environment variable:
VITE_CIVICS_API_KEY=[Your Key Here]
- Add the following environment variable:
-
Run the command
npm run start
to locally launch the project -
Check out our codebase!
- Navigate to Google Cloud console
- Go to Navigation menu --> APIs & Services --> Credentials
- Click Create Credentials --> API Key
- Go to Navigation menu --> APIs & Services --> Enabled APIs & Services --> Click on Enable APIs and Services button
- Search for Civic Information API and click Enable
- Go to APIs & Services --> Credentials
- Under API restrictions, click on Restrict key
- Search for Google Civic Information API and check the box
- Click Save button
- create a
.env
file in the root directory - Add the following line
VITE_CIVICS_API_KEY=[Your API key goes here]
-
Never expose or
git push
your API key!- Environment variables must be prepended with VITE, or it will not be picked up during the application build.
-
Use it in the application
- Navigate to the search bar on the homepage.
- Enter a U.S. residential address, then click on the
FIND MY ELECTIONS INFO!
button. - You will be redirected to a new page.
- Check out any upcoming elections in your area, or view your representatives in government!
- You can click on the Election name button or Officials' name button for more information.
- Navigate to the Why Vote? page.
- Each of the buttons is hyperlinked to reputable sources where you can learn more about the importance of voting.
- You can see historical voting data from 1990-2022, based on sex and race at the bottom of the page.
- Click on the icon with the symbol of a sun.
- You can toggle between a light theme and a dark theme.
- The purple light theme represents the shared bipartisan goal of educating voters and encouraging voters to participate in democracy!
- Click on the icon with the symbol of a magnifying glass and upwards line graph.
- You can review all prior API requests and see if an API call was successful (200 OK) or unsuccessful (400 Bad Request).
- You can click on
CLEAR
button to clear your request history.
- Click on the About page to learn more about the developers
- Click on the Learn More button to see a detailed technical explanation of the application
- You can also click on any of the technologies to learn more about them individually
- All pages in the app are completely responsive
- The app can be viewed on any screen size without compromising the user experience
- Click on the
<>
icon - The GitHub repo will open in a new page
Civics Central is developed using React, Typescript and Vite. Typescript is utilized to enforce strict static typing. Axios is used to query multiple different API's from the Google Cloud Suite from which the reposes are memoized in order to limit overuse of Google Civics API and hitting our rate limit. Our application using React Router to handle rendering different pages as well as React Context and State to share data between components. Material UI component library is leveraged for pre-built components, implementing custom application themes and applying principals of responsive design.
Our local development configuration is focused on enforcing frontend development best practices. We utilized prettier and eslint to enforce code format standards as well as build and push scripts that run linters and tests and the Vite build tool to package code for production. Our application also has React Testing Library and Jest for unit testing and code coverage reports. Environment variables are used to pass various run time arguments to the application, such as API keys.
Our team practiced a trunk based development methodology to effectively and efficiently collaborate on on this project. We utilized git branches and github issues in order to collaborate together and mitigate potential merge conflicts. In a trunk based development model the main branch acts as the single source of truth and one off branches are checked out on a per issue basis then merged back into the main branch after the issue is complete.
Which frameworks, libraries, or other tools did you use to create your project?
- React.js - Web framework
- TypeScript - Programming language to enforce static typing
- Node.js - JavaScript runtime environment
- Google Cloud - Google Civic Information API, monitor API usage, and prevent API overuse
- Google Firebase - To host the application
- Vite.js - As a local development and build tool
- Material UI - Pre-build components, for consistent UI/UX, and responsive design
- Git/GitHub - Version control system, trunk based development
- Prettier - Enforce code formatting
- EsLint - Enforce Javascript best practices
In the future we would like to add user accounts and a search history for each account. This would allow the user to see all of their previously queried data without having to search again. We would also like to integrate a map into the Civic Info page that shows the address/location fo the election. 0