The source code for tecktip.today, a revolutionary website which delivers the best and brightest tecknological advice directly to a web browser near you.
This website is a joke. It was initially a Discord bot named "teck tip bot" which would reply with innovative teck tips from Linus himself after hearing certain trigger words -- and eventually, when I realized .today existed as a TLD, I had to make it a website.
The joke as a whole was, I think, somewhat inspired by @LinusTechTip_ on Twitter.
It accepts submissions from anyone, and has a neat admin panel that allows for managing tips, submissions, and images.
The backend is a simple Quart API written in Python and backed by a MySQL database. The frontend is built on SvelteKit and uses Tailwind.
Both of these are automatically deployed using GitHub Workflows and an Ansible playbook.
TeckGPT, a teck tip generating assistant running off of a ChatGPT fine-tuned model.
The site allows visitors to submit their own teck tips for review.
Images can be uploaded by admins. Definitely don't want submissions for that one.
I'm not sure why anyone would want this... but here's how to run it:
To run the backend, set the following env vars:
- MYSQL_HOST
- MYSQL_USER
- MYSQL_PASSWORD
- MYSQL_DB
- HYPERCORN_CERTFILE ("/etc/letsencrypt/live/{{ site_host }}/fullchain.pem")
- HYPERCORN_KEYFILE ("/etc/letsencrypt/live/{{ site_host }}/privkey.pem")
- PORT
- IMAGE_URL
- IMAGE_FOLDER
- OPENAI_API_KEY
- OPENAI_MODEL
Then install dependencies:
cd src_api
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txtThen run:
python3 main.pyTo get the frontend, first build it:
cd src_site
npm run buildThen start it:
SITE_HOST="some-host" API_PORT="backend-port" HOST="127.0.0.1" PORT=some-port node build/index.js
For development purposes, you can also run it with:
SITE_HOST="some-host" API_PORT="backend-port" HOST="127.0.0.1" PORT=some-port npm run devYour vault needs to contain the following:
- sql.db
- sql.user
- sql.password
- site_host (ie: tecktip.today)
- cdn_host (ie: cdn.tecktip.today)
- site_name (nginx site name)
- openai_key (for TeckGPT)
- openai_model (for TeckGPT)
The server this is being deployed to must have a local MySQL instance running on it. Assuming a login is permitted with sudo mysql -uroot and no password, the database and user do not need to be created beforehand. Your server should be using Nginx. A records should exist for site_host and cdn_host.
You can then run the Ansible playbook:
ansible-playbook playbooks/main.yml