Skip to content

Send automated messages (DMs) to your new Twitter followers

License

Notifications You must be signed in to change notification settings

elhardoum/twitter-auto-dms

Repository files navigation

Twitter Auto DMs

Send automated messages (DMs) to your new Twitter followers

Imgur Image

Running the app

Copy .env.sample to .env and add your environment variables.

The project uses mongodb for persisting data. You're expected to provide a mongodb connection string via the MONGODB_URI environment variable. You may use mongodb atlas for a free cloud database instance, or skip to the docker instructions if you don't wish to install mongodb and/or the app.

First, install the app dependencies, if not done already

npm install

Then, you may run the app any of the following modes:

# development
npm run start

# watch mode
npm run start:dev

# production mode
npm run start:prod

Run with Docker

The public docker image makes it easy to run an instance of the app as it also comes with a running self-hosted mongodb instance.

You're expected to pass any required environment variables to the image while running a container. Please make sure not to pass MONGODB_URI in order to use the self-hosted mongodb instance.

# pass environment variables inline
docker run --rm -p 3000:80 \
  -e COOKIE_SECRET=some-very-secret-value \
  -e TWITTER_API_KEY=your_api_key \
  -e TWITTER_API_KEY_SECRET=your_api_secret \
  elhardoum/twitter-auto-dms:latest

Or use a .env file for passing the environment variables:

# pass environment variables via a file
docker run --rm -p 3000:80 --env-file .env elhardoum/twitter-auto-dms:latest

Finally, to persist mongodb data to your local machine, you can use a volume:

# first, make a data storage folder if not done previously
mkdir -p data/db

# next, mount it to the existing volume
docker run --rm -p 3000:80 \
  -e COOKIE_SECRET=some-very-secret-value \
  -e TWITTER_API_KEY=your_api_key \
  -e TWITTER_API_KEY_SECRET=your_api_secret \
  -v $(pwd)/data/db:/data/db \
  elhardoum/twitter-auto-dms:latest

The app should briefly be running at http://127.0.0.1:3000. Once everything works, you may consider running the app in detached mode via docker run -d ..., and/or restart on errors --restart always (without passing the --rm flag).

Test

# unit tests
npm run test

# e2e tests
npm run test:e2e

# test coverage
npm run test:cov

Todo

  • base functionality
  • unit tests
  • documentation
  • docker deployment
  • fix safari cookies issue