The backend server for LingDocs
  • TypeScript 63.7%
  • EJS 29.6%
  • JavaScript 3.9%
  • Python 1.9%
  • CSS 0.5%
  • Other 0.4%
Find a file
adueck f44352de90
All checks were successful
CI / Deploy (push) Successful in 30s
cleanup
2026-07-26 16:42:33 +02:00
.forgejo/workflows move in anki service 2026-07-20 19:34:16 +02:00
anki-service with uuid on filenames 2026-07-25 22:25:33 +02:00
public initial commit 2025-08-29 14:52:15 +05:00
src cleanup 2026-07-26 16:42:33 +02:00
views oops 2026-07-19 18:08:10 +02:00
.dockerignore move in anki service 2026-07-20 19:34:16 +02:00
.gitignore move in anki service 2026-07-20 19:34:16 +02:00
.npmrc new registry 2026-07-13 16:40:59 +02:00
check-couchdb.ts cleaner env var thing 2026-07-19 18:02:52 +02:00
Dockerfile sharing dir 2026-07-25 20:44:55 +02:00
google-sheets-app-script.js initial commit 2025-08-29 14:52:15 +05:00
LICENSE initial commit 2025-08-29 14:52:15 +05:00
package-lock.json sharing dir 2026-07-25 20:44:55 +02:00
package.json sharing dir 2026-07-25 20:44:55 +02:00
README.md cleanup 2026-07-26 16:42:33 +02:00
tsconfig.json ok 2026-07-19 13:56:06 +02:00

lingdocs-backend

The backend node server app for LingDocs sites. Handles auth and various apis.

CouchDB

This relies on an external CouchDB instance which manages both the accounts as well as the user's personal databases for wordlists.

When a user upgrades their account level to student or editor:

  1. A doc in the _users db is created with their authentication info, account level, and a password they can use for syncing their personal wordlistdb
  2. A user database is created which they use to sync their personal wordlist.

There is also a review-tasks database which is used to store all the review tasks for editors and syncs with the review tasks in the app for the editor(s).

Deploying

docker-compose.yml

services:
  redis:
    image: redis:8
    restart: unless-stopped
    command: redis-server --appendonly yes
    volumes:
      - ./volumes/redis:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 3s
      retries: 10
    networks:
      - backend

  python:
    image: git.lingdocs.com/lingdocs/lingdocs-anki-service
    restart: unless-stopped
    networks:
      - backend
    volumes:
      - ./anki-media:/anki-media

  app:
    image: git.lingdocs.com/lingdocs/lingdocs-backend:latest
    restart: unless-stopped
    depends_on:
      redis:
        condition: service_healthy
      python:
        condition: service_started
    ports:
      - "4000:4000"
    networks:
      - backend
    volumes:
      - ./anki-media:/anki-media
    environment:
      NODE_ENV: "production"
      PORT: "4000"
      NTFY_TOPIC:
      NTFY_URL:
      LINGDOCS_EMAIL_HOST:
      LINGDOCS_EMAIL_USER: 
      LINGDOCS_EMAIL_PASS: 
      LINGDOCS_COUCHDB: 
      LINGDOCS_COUCHDB_USERNAME:
      LINGDOCS_COUCHDB_PASSWORD:
      LINGDOCS_DICTIONARY_URL:
      LINGDOCS_ACCOUNT_COOKIE_SECRET: 
      LINGDOCS_ACCOUNT_GOOGLE_CLIENT_SECRET:
      LINGDOCS_ACCOUNT_GITHUB_CLIENT_SECRET: 
      LINGDOCS_ACCOUNT_RECAPTCHA_SECRET:
      LINGDOCS_ACCOUNT_UPGRADE_PASSWORD:
      STRIPE_SECRET_KEY:
      STRIPE_WEBHOOK_SECRET:
      LINGDOCS_SERVICE_ACCOUNT_EMAIL: 
      LINGDOCS_DICTIONARY_SPREADSHEET:
      LINGDOCS_DICTIONARY_SHEET_ID:
      LINGDOCS_SERVICE_ACCOUNT_KEY:

networks:
  backend:
    driver: bridge