Skip to content

debtcollective/membership

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Membership

Membership is a simple app for non profit organizations, that allows users to create an account using Discourse and donate to the organization. It contains the following features:

  • Simple donations payment management through Stripe.
  • One time donations through anonymous accounts.
  • One time donations through user accounts.
  • User dashboard to manage their own subscription.
  • Simple statistics for the Organization around donations.
  • Organization dashboard to manage memberships.

CircleCI

Table of contents

Table of contents generated with markdown-toc

Quick start

cp .env.sample .env # copy .env file
bundle install # install gems
yarn install # install packages
rake db:create # create database
rake db:migrate # migrate database
rake db:seed # seed database

# run project with
overmind s

At this point, you should be able to see the app at http://membership.lvh.me:5000

Environment Variables

The easiest way to run the app is by using Doppler. Ask to be added to the project.

You can install it by running brew install dopplerhq/cli/doppler. You can can check the Doppler docs here, but below is the gist of commands you need to run.

doppler login
doppler setup

To use Doppler to inject environment variables, prepend doppler run to commands. You can run Overmind with Doppler running.

doppler run overmind s

We also support Dotenv to configure environment variables. But you will need to supply all the secrets manually.

Dotenv

To do this, just run cp .env.sample .env and replace the variables you need. For most of them we are providing defaults that work in development.

Stripe

You can get the Stripe keys by registering for a free Stripe account and generating test keys. Here's a link to their Docs on how to obtain these keys https://stripe.com/docs/keys#obtain-api-keys.

Google reCAPTCHA

In order to obtain this key, you need to go to this address and generate one https://www.google.com/recaptcha/admin/create. Be sure to use the reCAPTCHA V2 and select the I'm not a robot" checkbox option. Also, set the correct domain names the app is running on, these are membership.lvh.me and localhost.

If you need help to get some of these key right or setting this up, please ask other devs for help.

System dependencies

You'll need to have installed the following dependencies installed, if you don't want to use the provided Docker containers.

  • Ruby
  • Node
  • PostgreSQL
  • Overmind

An instance of PostgresSQL needs to be actively running. Note: MacOS users can use the Postgres app.

Running tests

Prepare tests

rails db:test:prepare

RSpec

bundle exec rspec

Cypress

rails cypress:open

Developer notes

User sessions

We use cookie based authentication across subdomains instead of creating sessions between apps. This provides a better experience and fixes out of sync sessions between Discourse and other apps. Read how to setup a user session.

Running Overmind

Overmind is a process manager for Procfile-based apps.

You can install on OSX by running brew install tmux overmind.

A cool feature that Overmind has is that it allows you to connect to specific process terminal via tmux. This is really useful when debugging apps. If you use for example binding.pry, you can connect to the debugging terminal by running overmind connect web

Running Docker

You can run the app using docker compose.

docker compose up

Solargraph

Install Ruby Solargraph VSCode extension to enable autocompletion.

Formatting with Standard and Prettier

We are using Standard that is a wrapper on top of Rubocop with a predefined set of Rules. If you use VS Code you will want to install vscode-ruby extension and enable formatting on save.

We include a .vscode folder with configuration specific to this project.

{
  "[ruby]": {
    "editor.formatOnSave": true
  },
  "ruby.lint": {
    "standard": true
  },
  "ruby.format": "standard",
  "ruby.useLanguageServer": true,
  "editor.formatOnSaveTimeout": 5000
}

We're also using standardjs and prettier to standarize our JavaScript development. This is running automatically on a before commit hook using husky.

Codecov

We use codecov for our test coverage metrics. In CI we need to provide a CODECOV_TOKEN env variable to upload code coverage stats correctly.

Preview emails in development with Mailhog

We use Mailhog to preview emails in development. You can install it with brew by running brew install mailhog. Once you have it installed, you can run it in a separated terminal session with mailhog.

You can preview the email by going to http://127.0.0.1:8025

Data migrations with the data_migrate gem

We use data_migrate to handle data migrations, instead of having many one-off scripts. You can generate a data migration by running.

rails g data_migration migration_name

and apply the data migrations by running.

rails data:migrate