/publishers

Publisher interface for Brave Payments

Primary LanguageRubyMozilla Public License 2.0MPL-2.0

Creators

Creators powers the https://creators.brave.com platform and enables content creators to be tipped from Brave users using the Brave Rewards system.

It allows a creator to connect channels where they are hosted content as well as a wallet through which we deposit auto-contribute suggestions.

The ledger for current creator balance is stored in bat-ledger, also known as eyeshade.

Creators is powered by Ruby on Rails and React.

Getting Started 🔧 Setup

Development with Docker and docker-compose is recommended for anyone just getting started. If for any reason you wish to run the stack locally see Local Installation Instructions. Creators has a complex set of interactions however and has another application (Eyeshade) as a core integration/service dependency that is most readily accessed via docker-compose.

Running locally with Overmind

If you don't want to use docker, and want to develop locally, you can use overmind:

Make sure to install it and then run: overmind start -N -f Procfile.dev

Running locally with docker-compose

  1. install docker and docker compose.
  2. Ensure openssl is installed. brew install openssl
  3. In your browser, navigate to brave://flags. Make sure Allow invalid certificates for resources loaded from localhost. is enabled.
  4. Run make
  5. Create an admin user. make admin EMAIL="email@example.com"

If for any reason some step in the command chain breaks, simply review the Makefile and execute each command utilized by Makefile:defaultindividually.


The critical pieces

The advanced pieces

Gotchas

Feature Flags

When logging in as a creator, you may need to enable feature flags on that creator's account to be able to access the full set of UI options on the site. Feature flags are stored as a json object on the Publisher model. To update the flags for a user, run something like:

make docker-shell
bundle exec rails c
p = Publisher.where(email: 'gemini@completed.org').first
p.update!({ feature_flags: {"gemini_enabled"=>true, "bitflyer_enabled"=>true, "promo_lockout_time"=>"2020-11-23", "referral_kyc_required"=>true}})

Gemfile

If however, you are developing on an M1 using docker-compose and find yourself in the position of needing to update a dependency/Gemfile, you are going to run into a wall. Several gems (including Sorbet) are installed conditionally based on the chipset of the device. Thus, your local development Gemfile will be different from what is run in CI/CD and Sorbet is required for builds. Unfortunately for the moment the only way to properly update the Gemfile is to either install locally or to use an device that is using an x86 chipset.

You may also need to install automake and libtools before running bundle install because of the eth gem, and libsodium for the rbnacl gem:

$ brew install automake
$ autoreconf -i
$ brew install libtool
$ brew install libsodium

Errata

  • Legacy Docs - Preserved content that requires review/updates