Installation Guide

Installing Embetty involves setting up the backend server and including the frontend component in your website. The recommended way to run the server is by using the official Docker image.

1. Embetty Server (@embetty/server)

The server is responsible for fetching data from external APIs. It should be deployed on your infrastructure and made accessible via a public URL.

Running the server with Docker is the most straightforward method. The image is available on Docker Hub.

  1. Pull the Docker image:

    docker pull heiseonline/embetty-server:latest

  2. Run the container: You must provide your Twitter API credentials and specify the allowed origins for CORS. See the Configuration page for more details on environment variables.

    docker run \
      -p 8080:8080 \
      --name embetty \
      --rm \
      -e VALID_ORIGINS=https://your-website.com \
      -e TWITTER_BEARER_TOKEN=YOUR_TWITTER_BEARER_TOKEN \
      heiseonline/embetty-server:latest
    The server will be available on port 8080.

Running from Source

You can also run the server directly using Node.js. This is suitable for development or if you prefer not to use Docker.

  1. Install the package globally:

    npm install -g @embetty/server

  2. Start the server: You can pass configuration options as command-line arguments or use environment variables.

    embetty-start --port 8080 --cache "redis://"
    For a full list of options, run embetty start --help.

2. Embetty Component (@embetty/component)

After setting up the server, you need to include the frontend component in your website.

Option A: Using a <script> Tag

Download the embetty.js file from the latest GitHub Release and host it on your server.

Include it in your HTML:

<script async src="/path/to/embetty.js"></script>

Option B: Using npm/pnpm

If you have a modern JavaScript build process, you can install Embetty from the npm registry.

pnpm add @embetty/component

Then, import it into your main JavaScript file:

import '@embetty/component';

3. Client-Side Configuration

Finally, you must tell the frontend component where your Embetty server is running. Add a <meta> tag to the <head> of your HTML document:

<head>
  <meta data-embetty-server="https://embetty.your-server.com" />
</head>

Now you're ready to start using the Embetty components in your HTML. See the Quick Start guide for an example.