Skip to content

Dionid/Teleblog

Repository files navigation

Teleblog

Template to create your own site from Telegram channel.

Demo: davidshekunts.com

Stack

  1. Go
  2. Pocketbase
  3. Templ
  4. Vue
  5. Tailwind
  6. daisyUI
  7. Digital Ocean
  8. Github Actions

Word of caution

This project is NOT about best practices. It's about making product and do it efficiently. I haven't been working with Vue for a long time, and this is first time for me to use Pocketbase, Templ.

Don't take this project as a reference for best practices.

Project structure

  1. cmd/teleblog - Teleblog platform
  2. infra - some infrastructure code (nginx, systemctl)
  3. libs - libraries

How to use

  1. Configuration
    1. Create bot in @BotFather
    2. cd cmd/teleblog && cp app.env.example app.env and fill it with your data
  2. Run
    1. make serve-teleblog to run Teleblog + Pocketbase admin panel
    2. Go to 127.0.0.1:8090/_ to see Pocketbase admin panel and fill in your user
    3. Create "verification_token"
    4. Send this token to your bot /verifytoken YOUR_TOKEN
    5. Add bot to public TG channels and their groups
    6. Send group links to your bot /addchannel YOUR_CHANNEL_LINK
  3. Upload history messages
    1. Export history from your channel
    2. Paste it to cmd/teleblog folder
    3. Run cd cmd/teleblog && go run . upload-history YOUR_HISTORY.json (! DONT FORGET to upload channel posts firstly and linked groups posts afterwards)
  4. Customization
    1. Change base_layout.templ google tag manager
    2. Change base_layout.templ meta tags
    3. Change index.templ with your profile information
    4. Change any template as you need
  5. Deploy Preparations
    1. Create Digital Ocean droplet
    2. cp .env.example .env and fill it
    3. Run make setup-droplet (it will configure autorestarts and nginx)
    4. Change ENV in app.env in droplet from LOCAL to PRODUCTION
  6. Deploy Manual
    1. Run make deploy (it will build and deploy Teleblog to your droplet)
  7. Deploy Automatic (Github Actions)
    1. Create new ssh key ssh-keygen with custom name (don't use passphrase)
    2. Add public key to your droplet ~/.ssh/authorized_keys
    3. Create Repository Environment named prod (github.com/USER/REPOSITORY/settings/environments)
    4. Set 3 secrets:
      1. SERVER_IP – your droplet IP
      2. SSH_PRIV_KEY – your custom private key
      3. SSH_PUB_KEY – your custom public key
    5. Push to master and check actions

Roadmap

First phase

MG: Make it so content appears, but customization through Pocketbase admin

Status: Done

Second phase

MG: Add content improvement features

  1. Search
  2. Extract tags
  3. Tags filter
  4. Images (getFile)
    1. Webhook
    2. History
  5. Videos (getFile)
  6. Link to replied comment
  7. Quote replied comment
  8. ...

Third phase

MG: ...

  1. Repost to Medium
  2. Theme changer
  3. Links preview
  4. SEO
    1. Meta title
    2. Meta description
    3. Meta image
  5. ...

X phase

  1. Delete old tags
  2. Backup
  3. Empty chats page
  4. Author Image (getUserProfilePhotos)
  5. Admin page
  6. Partial reload
  7. Sorting
  8. ...

Don't work with History Messages

  1. Pined messages
  2. Likes counter
  3. ...