Building a TIL website with datasette

I came across an article from and learned about datasette. It's a pretty cool template to write and publish TILs.

TLDR; this is the commit for a base setup that works.

List of features I like:

  1. Markdown articles
  2. Integration with Github actions
  3. Search, OpenAI integration
  4. Vercel deployment

Github Actions

Thanks to simonw on the well written and easy-to-understand .github/workflows/build.yml. I disabled some features for basic template to work:

Added environment variables in github actions' secrets:

Adjusted Actions permissions > Workflow permissions to enable read and write permission.

Vercel setup

This is simple, just create a new project in vercel, disable the github integration and change the deploy script --scope and --project values.

Also, add a domain in both vercel and cloudflare dns, e.g., cname til

Cleaning up SQLite schema

I downloaded the db but it needed some cleanup.

# Clean up records
DELETE from similarities;
DELETE from embeddings;
DELETE from til;

# This will drop all til_fts_* tables as well
DROP TABLE til_fts; 

# Recreate fts
CREATE VIRTUAL TABLE til_fts USING fts5(title, body);
INSERT INTO til_fts(title, body) SELECT title, body FROM til;

It's useful to test the script locally.

$ conda create --name=alvinsj-til
$ conda activate alvinsj-til
$ conda install pip 
$ pip install -r requirements.txt
$ python


  1. Github repo:
  2. Datasette docs:

Related links

  1. SQLite on web:
  2. Hosting SQLite databases on Github Pages:

Created 2023-12-08T19:53:59+08:00, updated 2023-12-08T20:52:50+08:00 · History · Edit