Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
/ twittercard Public archive

Twittercard creates beautiful Twitter tweet images.

License

Notifications You must be signed in to change notification settings

genesis331/twittercard

Repository files navigation

Introduction

Twittercard creates beautiful Twitter tweet images.

Development

This section describes the process for running the application on a local environment.

Getting Started

You'll need NodeJS to run the app. To install NodeJS, get the installer from nodejs.org.

Once you've installed Node.js (which includes the popular npm package manager), launch a Terminal and run the following commands:

git clone https://github.com/genesis331/twittercard.git
npm install
npm start

Create an .env file and include your Twitter API Authorization Bearer Token, following the format provided below.

TWITTER_AUTH_TOKEN={YOUR_TOKEN_HERE}

Do not include the curly braces!

Visit localhost:3000 in your browser.

When you're ready to stop your local server, type Ctrl+C in your terminal window.

Usage

Basic example

Make a GET request to /image & provide a tweet ID to id parameter.

https://domain.com/image?id=1250966843545640960

Enable dark mode

Add the darkMode=true parameter to the URL.

https://domain.com/image?id=1250966843545640960&darkMode=true

Inspect HTML

Perform a GET request to /html to return a HTML.

https://domain.com/html?id=1250966843545640960

You may also add the darkMode=true parameter to enable dark mode.

Self-Hosting

  1. Pull the latest Docker image from GitHub Packages
docker pull ghcr.io/genesis331/twittercard:latest
  1. Run the Docker image
docker run -d --restart unless-stopped -p {PREFERRED_PORT}:3000 --name twittercard -v /{VOLUME_NAME}:/twittercardtemp -e TWITTER_AUTH_TOKEN={YOUR_TOKEN_HERE} ghcr.io/genesis331/twittercard:latest

Again, do not include the curly braces!