Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


release badge

An open, portable, searchable image repository with twitter card and telegram bot integration.

(using nodejs + sqlite)

What's New in V2

  • Better image resize (and up to 4K screenshot support)
  • OAuth login so users can manage their own content
  • Moderator support
  • User bookmarks and flags
  • Telegram bot built-in support

(v2 however isn't compatible with v1, due to image quality difference and database backend change)

First Time Setup

  1. Have nodejs installed.
  2. Download latest release
  • Alternatively, git clone
  • Then git checkout tags/<version>
  1. Unzip and cd into your folder
  2. Run these commands in order:
  • npm install
  • npm run db:migrate
  1. Edit the config (see guide below)
  2. Run these commands to start the server
  • npm start
  • you may need sudo due to restriction on port 80/443
  • but don't run your public server with sudo, instead, do this
  1. Access localhost or your domain
  2. To actually login and upload images: you need to create a GitHub or Twitter app for OAuth authentication. We recommend starting with GitHub as it's faster.

(we might add a local password login in future, but for now, you need an OAuth provider)

Updating to Latest

  1. Download latest release, and replace all files
  • If you use git repo: git pull then git checkout tags/<version>
  1. npm install
  2. npm run db:migrate
  3. Your site is now up-to-date.

Telegram Bot

  1. Make sure your site is up and running
  2. Apply for a bot with BotFather
  3. Edit the config (see guide below)
  4. npm run bot
  5. Now you should be able to type @yourbot some-text to search the animeshot database
  6. You can also register your domain with BotFather, and use the optional Telegram web login

Other Commands

  • npm run db:mod -- username will toggle username moderator capability
  • npm run db:upload -- username will toggle username upload capability
  • npm run db:import -- v1.json will import json data extracted from v1 animeshot database (mongodump then bsondump), and import image data from /public/legacy/.
  • npm run db:seed will seed database with some test data
  • npm run db:reset clean up the database
  • npm run db:drop drop all tables
  • npm run dev launch auto-reload dev server for development

Site Config

This is the full config with explanation, but since it's just a JSON file, you shouldn't copy this one, instead: cp animeshot-example.json animeshot.json.

  "site": {
    "meta": {
      "title": "AnimeShot", // site name
      "owner": "your twitter handle", // twitter handler for twitter card
      "tagline": "your site description", // site description
      "logo": "/images/logo.jpg", // site logo for twitter card
      "lang": "en", // language hint and translations, see i18n.json
      "base_url": "", // site domain name
      "version": "r20181016" // only used in static asset cache bursting
    "service": {
      "source": "", // finding out image origin
      "twitter": "" // sharing image
    "server": {
      "ssl_certificate": "/ssl/localhost.crt", // cert file location, see https guide below
      "ssl_key": "/ssl/localhost.key", // key file location, see https guide below
      "http_port": 80, // always redirect to https port, unless has_proxy is true
      "https_port": 443,
      "server_port": 3000, // only used when you set has_proxy to true
      "has_proxy": true // indicate whether server has a reverse proxy
  "cookie": {
    "keys": ["keep this string secret"], // cookie key for signature verification
    "session": {
      "signed": true, // check cookie signature
      "maxAge": 86400000, // cookie expire time
      "key": "animeshot:login" // cookie name
  "oauth": {
    "server": {
      "protocol": "https", // oauth callback protocol
      "host": "", // oauth callback domain
      "callback": "/oauth/callback", // oauth callback route, defined in routes.js
      "transport": "session", // use session for token transport
      "state": true // a random state for added security check
    "twitter": {
      "key": "...apply for a twitter app...", //
      "secret": "...apply for a twitter app..."
    "github": {
      "key": "...apply for a github app...", //
      "secret": "...apply for a github app..."
  "bot": {
    "telegram": "...apply for a telegram bot..." //
    "result_count": 10, // how many result to return per search
    "cache_time": 0, // how long to cache response (used by telegram)
    "is_personal": false, // whether to cache response by user (used by telegram)
    "callback": "/bot/callback" // callback route for telegram login

OAuth Callback

When you are creating a GitHub or Twitter App for OAuth login, remember to fill in the callback or redirect url as following:

  • https://your.domain/connect/github/callback
  • https://your.domain/connect/twitter/callback

This is not the oauth callback route defined in your site config, and the redirect is actually handled internally by grant.

HTTPS Certificate

  • For localhost, you want to read this guide to generate test cert/key files and put them in the ssl folder.
  • For public server, you want to use certbot to generate valid cert/key and then chmod permission and ln certificate/key files to the ssl folder.
  • Then you can modify ssl_certificate and ssl_key in above config to use these cert and key files.

Continuous Service


  • Install forever with sudo npm install -g forever
  • Launch service with forever start index.js and foerver start bot.js
  • If you are using certbot for certificate without a reverse proxy (web server) like nginx, you can config certbot to auto restart animeshot service (so that port 80/443 is available for renewal).
  • sudo nano /etc/letsencrypt/renewal/your.domain.conf and add these lines:
pre_hook = forever stop /full-path/index.js
post_hook = forever start /full-path/index.js


  • Install pm2 with sudo npm install -g pm2
  • Launch service with pm2 start index.js and pm2 start bot.js
  • pm2 startup can setup startup service for you on major linux distributions (like Ubuntu 18's systemd)
  • If you are using certbot for certificate without a reverse proxy (web server) like nginx, you can config certbot to auto restart animeshot service (so that port 80/443 is available for renewal).
  • sudo nano /etc/letsencrypt/renewal/your.domain.conf and add these lines:
pre_hook = pm2 stop /full-path/index.js
post_hook = pm2 start /full-path/index.js




An open, portable, searchable image repository with telegram bot integration.




No packages published