Archiving your Twitter account with Eleventy

Last week, I finally deleted all my tweets[1]. I haven't used Twitter for some time, and hadn’t posted in years, but the latest round of vaguely sinister terms-of-service updates prompted me to pull the plug for good.

However, I wanted to keep an archive of my account, on my own terms. I wanted it to be lo-fi, low-maintenance, and low-cost. I'm happy to report that it worked: I’ve now got a complete record at twitter.gfscott.com. Here's how I did it.

How it works

The site is an Eleventy project, which uses the tweets.js file that's part of your Twitter archive download. Basically it just churns through that file, generating a permalink for each tweet. The final product is just a giant pile of static HTML files.

I've deployed my personal archive to Cloudflare Pages, so it costs me nothing and could easily be moved if needed.

Create your own

If you'd like to make your own version, you can use this GitHub template. All the instructions are in the readme:

  1. Download your Twitter archive.
  2. On the GitHub template repo, click Use this template, then select Create a new repository. Fill in the required details to create your own repo.
  3. Copy the contents of {archive}/data/tweets.js into ./src/_data/__tweets.js.
  4. Change window.YTD.tweets.part0 = to export default.
  5. Copy image files from {archive}/data/tweets_media/ into ./src/static/images/twitter/.
  6. Run npm run dev to preview.

Caveats and limitations

  • My aging desktop outputs about 1,000 tweets/sec, so expect build-times to scale with how prolific you were.
  • The conversational context is incomplete. You can see who you were replying to, but not what they said. So it's a one-sided conversation.
  • No threads. Given the available data, I don't see a way to group posts together, but perhaps others have ideas. Happy to discuss in an issue or PR.
  • The site replaces t.co links with the actual URL when possible, but (especially in the early days of Twitter) there were a lot of link shortener services that have since vanished, leaving irretrievably broken links behind. Sad!
  • I don't think there's any truly sensitive data in the tweets.js file you get in the archive download, but I'm keeping mine in a private repo all the same.

Alternatives

Marco Maroni has created a Twitter-to-Bluesky tool, which imports and backdates tweets into your Bluesky account. I decided that I wanted a clean break, so I haven't tried it out, but others have and it seems pretty cool.


  1. I used this script, which worked well and was free. I’m keeping the username, just to prevent it from falling into enemy hands. ↩︎