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.
🔧 Setup
Getting Started 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 docker-compose
- install docker and docker compose.
- Ensure
openssl
is installed.brew install openssl
- In your browser, navigate to
brave://flags
. Make sureAllow invalid certificates for resources loaded from localhost.
is enabled. - Run
make
- Create an admin user.
make admin EMAIL="[email protected]"
If for any reason some step in the command chain breaks, simply review the Makefile and execute each command utilized by Makefile:default
individually.
The critical pieces
- Understanding and Configuring Eyeshade
- Contributing to Brave Creators
- Linting
- Service Diagram
- Creators Interaction with Promo Services
The advanced pieces
- Environment Variables (Optional, Docker should handle most of this)
- Docker Network Configuration(Informational)
- Creating a new Channel
- Configuring 3rd Party APIs (Optional)
- Configuring Vault Promo Services (Optional)
- Generating Referral Charts
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
$ rails c
$ p = Publisher.where(email: '[email protected]').first
$ p.update!({ feature_flags: {"gemini_enabled"=>true, "bitflyer_enabled"=>true, "promo_lockout_time"=>"2020-11-23", "referral_kyc_required"=>true}})
Macbook M1, Docker-compose, and Sorbet
We recommend both the usage of Sorbet for static analysis/linting as well as docker-compose
for local development, however at the time of writing (3/21/22) the Sorbet binary is not available for Linux running on ARM processes (i.e. within docker-compose).
There is an open issue and an incomplete PR that adds support for aarch64 systems. For now, linting/tests have been configured to run on every push to the remote so that developers can gain some of the benefit of static type analysis using sorbet.
We recommend continuing to develop using Sorbet type annotations and explicit types.
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.
Errata
- Legacy Docs - Preserved content that requires review/updates