Skip to content

sikaeducation/activity-api

Repository files navigation

Activity API

CI

RESTful API for Sika Education activities. Deployed at https://activity-api.fly.dev.

API Documentation

Webhook Endpoint

  • POST /regenerate-posts: RPC command to update the posts cache with latest data from the posts repo, authenticated with the WEBHOOK_TOKEN environment variable.

Development

Requires Docker.

git clone git@github.com:sikaeducation/activity-api.git
cd activity-api
npm install
cp .env.example .env # Fill out values
npm run dev

@/ is aliased ./src/ and $/ is aliased to ./test-helpers/.

Install flyctl to change deployment configuration.

Environment Variables

  • For development, copy .env.example to .env and set values (see below for explanation)
  • For production, set these in GitHub secrets and variables:
    • Secrets:
    • Variables:
      • SENTRY_DSN: Connection URL for Sentry, retrieve on the Sentry dashboard
      • AUTH_KEY_URL: JWKS well-known URL
      • AUTH_AUDIENCE: Authorized requester
      • PUBLIC_PORT: External port to advertise (doesn't bind the port)
      • PRIVATE_PORT: Internal container port (must be 8080 for fly.io)

GitHub actions needs its auto-generated GITHUB_TOKEN to have permissions to create releases (repo permissions). Set this under Workflow Permissions.

Scripts

  • npm start
  • npm dev
  • npm run lint
  • npm run build
  • npm run build:docker
  • npm run test, npm run test:watch

Deployment

  • Increment the version with npm version { patch | minor | major } and push.
  • App dashboard)