Skip to content

bcc-code/bcc-media-platform

Folders and files

NameName
Last commit message
Last commit date
Oct 15, 2024
Mar 12, 2025
Mar 17, 2025
Jan 29, 2025
Sep 6, 2024
Jan 27, 2025
Feb 10, 2025
Dec 6, 2024
Mar 11, 2025
Jun 11, 2024
Aug 3, 2023
Mar 19, 2025
May 12, 2022
Apr 24, 2024
May 15, 2023
Sep 14, 2022
Jun 13, 2024
Apr 18, 2023
Apr 12, 2023
Mar 10, 2025
Sep 5, 2024
Jul 8, 2024
Jan 27, 2023
Sep 17, 2024
Sep 17, 2024
Mar 14, 2024
Mar 21, 2025
Mar 21, 2025
Oct 13, 2022

Repository files navigation

Build Status

BCC Media

Prerequisites

  • make
  • Database
    • pg-diff-cli npm i -g pg-diff-cli
    • Goose go install github.com/pressly/goose/v3/cmd/goose@latest
  • Backend
    • Golang v1.19.0^
  • WEB
    • NodeJS
    • PNPM
    • NPM
  • CMS
    • NPM

Installing

Run

make install

To install the database and run the initial migrations. This will clean the existing database if present

Services

BCC Media is split into different services which are responsible for different parts of the application.

is an event listener hooked up to Google's PubSub. Events sent to PubSub triggers requests to endpoints on this service (in Cloud Run) which in turn do something based on the data in the event.

For example:

  • Reindexing Search
  • Synchronize Translations
  • Update entries in respective external systems (search, crowdin)

A fake pubsub instance is run with the compose file, and is configured/triggered manually by the "commands" in the backend Makefile

is the public facing/open GraphQL API which an (un)authenticated user can retrieve data. It is built on the GraphQL schema files located at graph/schema

In most cases, this is the only backend service (in addition to a filled database/CMS) you need to run in order to get a working local environment, as this is what the frontend will exclusively communicate with.

You can start the API with make run-api inside the 'backend' folder. Just remember to update the backend/cmd/api/.env file (run make run-api once and it'll make a sample one you can update.)

Authentication

Authentication is implemented with Auth0. At the moment, we use custom claims which means an Auth0 tenant and application won't work out of the box, even if the options are configured correctly in the environment here.

Additional user data is retrieved from the BCC Members API (api.bcc.no)

The CMS is the system for managing the content, and is run in a separate container with Directus. This application only writes to the database and has hooks to our event service for triggering actions based on the events.

The database must be running and installed with the migrations in order for this to work. It is run with the make run command in the respective directory.

Setup the cms with make init.

The initial login credentials are: Username: admin@brunstad.tv Pass: btv123

Test-data

You can quickly make some dummy data with ./packages/test-data. Do npm install and make all.

Formats

The default date format is RFC3339. For go: x.Format(time.RFC3339)

Do make tests.setup to install dependencies and set up a testing environment.

Do make tests.run to run configured tests.

E2E testing is written mostly in TypeScript and uses AVA as the testing framework.