Skip to content

civis-vote/civis-api

Repository files navigation

Civis API

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


Third Party Tools


Deployment

  • The deployment is triggered via Cloud66 app.
  • Upon building the app, a Cloud66 webhook is triggered which finally pushes the code to the server.
  • Servers are hosted on AWS and managed by Cloud66.

Credentials

  • Postmark API Key
  • AWS Access Key & Secret
  • Airbrake Project Key
  • Google Client ID and Secret
  • Facebook App ID and Secret
  • Scout Key

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

Exploring GraphQL API

  • Use GraphQL client such as Postman testing and interacting with the GraphQL API. . Postman GraphQL
  • GraphQL endpoint will be at /graphql. Examples:
    • Staging: https://api-staging.civis.vote/graphql
    • Production: https://api.civis.vote/graphql.
  • To fetch GraphQL schema, use interospection query on GraphQL client.
  • To use API, pass your api key, in Authorization headers.

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 and migrate

About

No description, website, or topics provided.

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
License.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published