This repository contains the codebase for the Civis API. Civis is a bridge between citizens and Governments, to ensure that people's voice isn't just heard but acknowledged and acted upon by those in power. More information about Civis can be found here.
Platform Architecture
- The platform implements a public GraphQL API.
- Authentication is managed via an access_token which is sent as an Authorization Header.
- User Interfaces consume the GraphQL API (including the primary interface i.e www.civis.vote)
- The ERD of the platform can be found here.
Tech Stack
- Ruby on Rails
System Requirements
- Ruby version 3.0.0 or above.
- Imagemagick for image processing
Third Party Tools
- Postmark for transactional emails.
- AWS S3 for Storage
- Facebook OAuth for Login with Facebook
- Google OAuth for Login with Google
- Venter (Machine Learning solution) for categorising responses.
Deployment
- The deployment is triggered via Travis configured via the travis.yml file.
- Upon building the app, a Cloud66 webhook is triggered which finally pushes the code to the server.
- Servers are hosted on Google Cloud and managed by Cloud66.
Credentials
- Postmark API Key
- AWS Access Key & Secret
- Sentry DSN link
- Google Client ID and Secret
- Facebook App ID and Secret
Environment Variables
- CLIENT_HOST
- HOST
- RAILS_MASTER_KEY
Running locally
- To run this project in localhost, do the following:
bundle install
rails db:setup
rails s
- To seed the database run
rails db:seed
Notes
- The project uses a few scripts to import data, the commands are -
rails import_records_from_csv:ministry_categories
rails import_records_from_csv:ministries
rails import_records_from_csv:locations
rails import_records_from_csv:consultations
rails import_records_from_csv:point_scale
- The API is based on GraphQL and hosted on
BASE_URL/graphql
- If you encountered active storage attachment errors
PG::UndefinedTable - ERROR: relation "active_storage_attachments" does not exist
- run
rails active_storage:install
andmigrate