Skip to content
/ twir Public

Twitch bot written in Golang and TypeScript.

Notifications You must be signed in to change notification settings

twirapp/twir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Development

Requirements

Cli

Note

For MOST of project management tasks we use own written cli. You can use pnpm cli help for print cli usage

  • Run needed services (Postgres, Adminer, Redis, Minio)
docker compose -f docker-compose.dev.yml up -d
  • Install dependencies
pnpm cli deps
  • Build libs
pnpm cli build libs

Configure project for development

Well, now we are almost ready for developing project, just few steps.

  • Create twitch application https://dev.twitch.tv/console/apps
  • Set http://localhost:3005/login and https://tokens-generator.twir.app as your redirect url's for twitch application
  • Go to https://tokens-generator.twir.app, set clientID and clientSecret from your app and generate initial token WITH ALL SCOPES
  • cp .env.example .env and fill required envs

Run project

  • Start dev mode
pnpm cli dev

Writing migrations

  • Use command for create new migration
pnpm cli migrations create
  • Navigate to folder and edit new migration file
cd libs/migrations/migrations
  • Run new created migrations (optional, because it's running when you execute pnpm dev)
pnpm cli migrations run
Write go models
  • Go to libs/gomodels
  • Create new file and describe the go schema
  • Do not forget about TableName() for struct

Https on localhost (optional)

We'll use twir.localhost domain, which is enables ability to grant ssl out of the box, but you can use any other domain and deal with ssl yourself.

  • Add https://twir.localhost/login to your twitch application redirect url's

  • Edit .env entries:

TWITCH_CALLBACKURL=https://twir.localhost/login
SITE_BASE_URL=twir.localhost
USE_WSS=true
  • Start caddy:
pnpm cli proxy