Skip to content
/ backend Public

The Big Bots project is a social experiment aimed at identifying bots and sock puppets in the social platforms feeds. https://botim.online

License

Notifications You must be signed in to change notification settings

botim/backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

dd0e257 · Apr 1, 2019

History

88 Commits
Mar 15, 2019
Apr 1, 2019
Feb 27, 2019
Mar 26, 2019
Mar 15, 2019
Mar 9, 2019
Mar 9, 2019
Mar 9, 2019
Mar 21, 2019
Mar 2, 2019
Mar 28, 2019
Mar 25, 2019
Mar 16, 2019
Mar 28, 2019
Mar 28, 2019
Mar 16, 2019
Mar 15, 2019
Apr 1, 2019

Repository files navigation

Bots backend

Based on https://github.com/vmasto/express-babel: Express.js with Babel Boilerplate.

Using TSOA Routing https://github.com/lukeautry/tsoa.

Deployment

Deployed on Heroku

DB

You could install Postgres directrly on your computer, or install Docker and then use the docker-compose to run the container:

docker-compose up

# shutdown the container
docker-compose down

Copy .env.example into .env and update the variables to match your environment, or define local variable named DATABASE_URL of the form postgres://user:pass@localhost:5432/bots_db

Install locally:

  1. Create Database and User:

    $ psql postgres
    CREATE ROLE bots WITH LOGIN PASSWORD 'yourpass';
    ALTER ROLE bots CREATEDB;
    
    $ psql postgres -U bots
    CREATE DATABASE bots_db;
    GRANT ALL PRIVILEGES ON DATABASE bots_db TO bots;
  2. Run migrations to create tables:

    npm run migrate
    
    # to revert the last migration
    npm run migrate:revert

Run Example

enter in command line:

  • npm i
  • DATABASE_URL='postgres://user:pass@localhost:5432/bots_db'
  • npm run start

API

read swagger.yaml file.

Updating suspected to confirmed bots

The reports go to user_statuses table.

And the reporters API key checks against reporters table.

Configuration

environment variables:

  • DATABASE_URL DB URI.
  • PORT HTTP Port. (default 8080).
  • REQUESTS_LIMIT Maximum requests in 10 minutes window per IP. (default 1000).
  • USERS_CACHE_TTL Liveness of a user status cache, in seconds. (default 1 second).
  • USERS_CACHE_CHECK_PERIOD Interval of cache liveness check. (default 0).
  • JWT_SECRET JWT private stamp key. (default random).
  • JWT_EXPIRES_IN The JWT token liveness time duration. (default 2 days).