browsertrix/frontend
Ilya Kreymer 05c1129fb8
Frontend + Backend Integrated Deployment (K8s only) (#45)
* support running backend + frontend together on k8s
* split nginx container into separate frontend service, which uses nignx-base image and the static frontend files
* add nginx-based frontend image to docker-compose build (for building only, docker-based combined deployment not yet supported)

* backend:
- fix paths for email templates
- chart: support '--set backend_only=1' and '--set frontend_only=1' to only force deploy one or the other
- run backend from root /api in uvicorn
2021-12-03 10:17:22 -08:00
..
scripts Use settings to determine if sign up route is enabled (#51) 2021-12-03 10:05:55 -08:00
src Use settings to determine if sign up route is enabled (#51) 2021-12-03 10:05:55 -08:00
xliff Add frontend localization support (#18) 2021-11-20 07:44:21 -08:00
.env Use settings to determine if sign up route is enabled (#51) 2021-12-03 10:05:55 -08:00
.gitignore Set up frontend dev tooling (#6) 2021-11-18 17:26:10 -08:00
Dockerfile Frontend + Backend Integrated Deployment (K8s only) (#45) 2021-12-03 10:17:22 -08:00
index.html Frontend responsive UI tweaks (#20) 2021-11-22 10:25:34 -08:00
lit-localize.json Add frontend localization support (#18) 2021-11-20 07:44:21 -08:00
nginx.conf Frontend + Backend Integrated Deployment (K8s only) (#45) 2021-12-03 10:17:22 -08:00
package.json Use settings to determine if sign up route is enabled (#51) 2021-12-03 10:05:55 -08:00
postcss.config.js Set up frontend dev tooling (#6) 2021-11-18 17:26:10 -08:00
README.md Add frontend localization support (#18) 2021-11-20 07:44:21 -08:00
sample.env.local Use settings to determine if sign up route is enabled (#51) 2021-12-03 10:05:55 -08:00
tailwind.config.js Allow users to change password (#25) 2021-11-23 17:01:08 -08:00
tsconfig.json Switch frontend to use Typescript (#12) 2021-11-19 14:07:13 -08:00
web-test-runner.config.mjs Fix frontend test mocks (#23) 2021-11-22 16:31:35 -08:00
webpack.config.js Frontend + Backend Integrated Deployment (K8s only) (#45) 2021-12-03 10:17:22 -08:00
yarn.lock Use settings to determine if sign up route is enabled (#51) 2021-12-03 10:05:55 -08:00

Browsertrix Cloud frontend

Quickstart

Copy environment variables from the sample file:

cp sample.env.local .env.local

Install dependencies:

yarn

Start the dev server:

yarn start-dev

This will open localhost:9870 in a new tab in your default browser.

To develop against a local instance of the backend API, follow instructions for deploying to a local Docker instance. Update API_BASE_URL and then restart the dev server.

Scripts

yarn <name>
start-dev runs app in development server, reloading on file changes
test runs tests in chromium with playwright
build-dev bundles app and outputs it in dist directory
build bundles app app, optimized for production, and outputs it to dist
lint find and fix auto-fixable javascript errors
format formats js, html and css files
localize:extract generate XLIFF file to be translated
localize:build output a localized version of strings/templates

Testing

Tests assertions are written in Chai.

To watch for file changes while running tests:

yarn test --watch

To run tests in multiple browsers:

yarn test --browsers chromium firefox webkit

Localization

Wrap text or templates in the msg helper to make them localizable:

// import from @lit/localize:
import { msg } from "@lit/localize";

// later, in the render function:
render() {
  return html`
    <button>
      ${msg("Click me")}
    </button>
  `
}

Entire templates can be wrapped as well:

render() {
  return msg(html`
    <p>Click the button</p>
    <button>Click me</button>
  `)
}

See: https://lit.dev/docs/localization/overview/#message-types

To add new languages:

  1. Add BCP 47 language tag to targetLocales in lit-localize.json
  2. Run yarn localize:extract to generate new .xlf file in /xliff
  3. Provide .xlf file to translation team
  4. Replace .xlf file once translated
  5. Run yarn localize:build bring translation into src

See: https://lit.dev/docs/localization/overview/#extracting-messages