Skip to content

The worker

The Worker manages and updates the repository data used by the app.

Repository: vimcolorschemes/worker

As of v3.0.0, the Worker uses SQLite/libSQL for storage. It can run against a local SQLite database or a hosted Turso database.

The Worker runs four jobs:

JobPurpose
importSearch for new repositories and store their basic information
updateRefresh repository metadata such as timestamps and stars
generateGenerate the color data used in code previews
publishTrigger a frontend deploy after the daily data jobs succeed

The jobs are currently configured to run daily.

After import, update, and generate finish successfully, publish triggers a frontend deploy so vimcolorschemes.com can build with the latest data.

ChangeStart here
Add or rename a jobcmd/worker/main.go
Repository search queries and import datacli/import.go
Repository metadata, eligibility, pruning, disable behaviorcli/update.go, internal/repository/
Preview generation and Neovim runtime setupcli/generate.go, vim/init.lua, vim/code_sample.vim
Publish gate, deploy webhook, daily summarycli/publish.go
Database schema and migrationsinternal/database/migrations/
Database reads and writesinternal/database/
GitHub API clientinternal/github/
AWS/SNS notificationsinternal/notify/, infra/

Run Worker changes locally with bin/start <job>. Add --repo owner/name for a focused loop and --force when you need to bypass normal incremental behavior for jobs that support it.

The import job fetches repositories that could be Vim or Neovim colorschemes. The matching queries can also return dotfiles, unrelated Vim plugins, and other false positives.

Each repository is inserted into the repositories table with basic fields:

ColumnExample
id397434315
owner_namecatppuccin
owner_avatar_urlhttps://avatars.githubusercontent.com/u/93489351?v=4
namenvim
descriptionSoothing pastel theme for (Neo)vim
github_urlhttps://github.com/catppuccin/nvim
github_created_at2021-08-18T01:14:49Z

A matching row is also added to repository_job_events with job = 'import' and either a success or error status.

Set GITHUB_REPOSITORY_COUNT_LIMIT in .env to limit how many repositories a broad import tries to fetch.

The update job fetches repositories one by one and enriches them with data used by the website.

It updates fields like:

ColumnExample
pushed_at2025-02-22T19:13:26Z
stargazers_count6021
stargazers_count_historyJSON text containing date/count pairs
week_stargazers_count10
is_eligible1
is_disabled0
updated_at2025-02-22T22:45:45Z

A row is added to repository_job_events with job = 'update'.

If GitHub returns 404, the Worker treats the repository as deleted, renamed, or private and prunes it from the database. If a repository has no commits, the Worker disables it so generation can skip it.

The generate job installs vimcolorschemes/extractor.nvim, installs each candidate repository as a Neovim plugin, lists the colorschemes it contains, and generates highlight data for each one.

Generated color data is written to two tables:

  • colorschemes stores one row per colorscheme name found in a plugin.
  • colorscheme_groups stores one row per highlight group per background variant.

A row is added to repository_job_events with job = 'generate'.

Read Code Previews for the full preview data shape.

The publish job does not modify repository or colorscheme data.

Instead, it checks the latest reports for import, update, and generate for the current UTC day. If all three jobs succeeded, it triggers the frontend deploy webhook.

This keeps deploys separate from data processing. The website is rebuilt after the daily data jobs succeed.

publish needs PUBLISH_WEBHOOK_URL. In production it also sends a daily summary notification through SNS when notification infrastructure is configured.

Run these from the Worker repository:

Terminal window
bin/test
bin/lint
bin/format