Proca - Progressive Campaigning backend
An universal action tool backend for JAM stack apps. Elixir app that uses PostgreSQL as data store and RabbitMQ for data processing. It is the backend / datastore for Proca Widget.
It is made with love, elixir and hope we can change the world for the better.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Features
- Headless
- GraphQL API
- Fine grained permission system for users organised in Organisatons (Orgs)
- Authentication using HTTP Basic Auth or JWT (to use external identity and auth system).
- Stores campaign tree (action pages organised in campaigns, where different Orgs can run a coalition)
- Stores actions and member personal data, personal data is E2E encrypted at rest. Only the Org that is data controller can decrypt it.
- Validates personal data types using various personal data schemas (email+postcode, European Citizen Initaitive, and so on)
- Handles GDPR consent (with optional double opt-in), and action staging (moderation, filtering before it is accepted)
- Sends emails (thank you emails, opt in emails, emails-to-targets) through various mail backends (Mailjet, AWS SES, more coming)
- Pluggable action processing on RabbitMQ queue
- Forward actions to AWS SQS, CRMs (needs a decrypting gateway proxy at Org premises)
- Export action data in CSV
Prerequisites
PostgreSQL >= 10
Elixir >= 1.10 Erlang Solutions provides packages and binaries for download.
You'll need the following packages:
erlang-base erlang-dev erlang-parsetools erlang-xmerl elixir
RabbitMQ (3.x, tested on 3.8)
NodeJS (>= 10)
Just trying out setup
Required:
- docker
- docker-compose
- proca-cli (install with:
npm i -g @proca/cli
)
If you would just like to try out proca server, it's easiest with docker-compose:
$ cd proca/utils
$ docker-compose up -d
# wait until the servers start
$ docker-compose logs proca
# note down the username and password for the user of primary "instance" organisation.
$ export API_URL=http://localhost:4000
$ proca-cli setup
# in interactive session, choose "set up authentication" and then input
# "instance", "admin@proca.app" and password you noted down:
Hello!
- Using current working directory: /home/marcin/Projects/proca-server/proca/utils
- There is not .env file - I will create it after asking You some questions
? What would you like to do? Set up authentication (no org set, user is not set up, password is not set)
? What is the short name of your org? instance
? What is your username (email)? admin@proca.app
? password: [hidden]
Thanks! Fetching campaign list to check the credentials
? What would you like to do? Save current config to .env file and leave
Now you can:
- Use proca-cli (in the directory where
.env
file was created) to talk to the server API. - You can also perform API calls directly using GraphQL in the GraphQL playground - it's great for exploring the API! Sign in at http://localhost:4000 to make authenticated API calls.
- You can see the processing in action using RabbitMQ management console - login with user name proca, password proca.
Development setup
The script utils/configure-development-environment.sh will setup PostgreSQL, the Erlang / Elixir / Pheonix server, the RabbitMQ server and runs npm install in the assets directory.
The script needs a few ENV varaibles set:
$ export ADMIN_EMAIL=you@example.com MIX_ENV=dev ORGANISATION='fix-the-status-quo'
You'll need sudo to run the parts of the script that configure PostgreSQL.
$ ./utils/configure-development-environment.sh
The seeds.exs command will print out your login and password:
#####
##### Created Admin user email@example.com #####
##### Password: VERY_RANDOM_PASSWORD
#####
You can then run the development server.
$ mix phx.server
By default, the development webserver is located at http://localhost:4000/
Configuration
See config/config.exs and config/dev.exs for configuration options.