Skip to content

Getting started

Install the Statista Remix Stack

Preparation

Read through the documentation and prepare your GitHub repository settings accordingly.

Authenticate with GitHub Package Registry

If you can already download Statista npm packages, you can skip this section.

To access internal npm packages, you need to authenticate with GitHub. Follow these steps:

  1. Create a personal access token with the read:packages scope.
  2. Run the following command, replacing <your-github-access-token> with your token:
pnpm config set '//npm.pkg.github.com/:_authToken=<your github access token>'

Create a Remix App Using the Stack

  1. Create a personal access token using the CLI or using the GitHub settings with the repo scope.
  2. Run the following command:
pnpx create-remix@2.16.8 your-project --yes --template pit-shared/remix-stack --token 'your-github-personal-access-token'
  • Replace your-project with the desired name of your project.
  • Replace your-github-personal-access-token with your personal access token.

Central CDN setup

  • First, add your origin param configs to the Central CDN. Here is how to do this. Then wait for an approval of the CDN contributors.

AWS environment setup

  • Visit the CDK Remix Setup repository and follow the steps in the README.
  • You will need to run this shell script once per environment you want to deploy to (usually dev, stage and prod). The script will create the necessary resources in AWS and set up the GitHub OIDC integration. (Make sure to copy the ARN of the role that is created in the output section, you will need it later)
  • Switch over to https://github.com/<org>/<repository>/settings/environments and create dev, stage and prod environments
  • Under the respective environment, scroll down to Environment variables and create variables for:
    • AWS_REGION and put eu-central-1 as a value
    • AWS_GITHUB_OIDC_ROLE and put the formerly copied ARN as a value
  • Done!

Monorepo special cases

  • If you use a monorepo and want to use this setup for a package, make sure to make the following adjustments:
    • Change the paths to the lock-file in the scripts/deployment.mts file in to target the lock-file in the root of the monorepo
    • The deployment and cdk workflows for GitHub will also need some adjustments:
      • For workflow jobs a working-directory needs to be set, e.g. apps/<your-app>
      • For on events a path needs to be set, e.g. paths: [apps/<your-app>/**]

Troubleshoot

  • First setup CDN, then open id connect
  • For dev deployments, when your app responses with an error like this could not load secret at arn:xxxx:secret:dev-env-authorizer/client_encryption_key, take a look at the dev-env-authenticator and how to enable Okta authentication for your AWS account (usage docs)