Sync Astro content with Polar


Polar Astro

Today, we're thrilled to introduce the @polar-sh/astro package - offering seamless publishing of your Astro content to your page on Polar.

Astro is an incredible static-first web framework loved by countless developers. Chances are you've built your personal site & blog with it. Well, now it's painless to keep your blog & Polar profile up-to-date without any manual effort.

So naturally, we're thrilled. But the coolest part & what makes us over the moon about this is that we had no part in it. It was contributed to us by the incredible @isaacharrisholt who uses both Astro & Polar himself.

That's the power of open source 🚀🎉

Getting started

The first iteration (v0.1.3) of @polar-sh/astro is predominantly focused on pushing your existing and future Astro content to your profile on Polar. It provides a neat wrapper around the Polar SDK for Astro's Content Collections along with some extra tools to help you keep your frontmatter type safe.

Let's dive in.

Step 1. Install the package

pnpm add @polar-sh/sdk

Step 2. Create a Polar access token

  • Goto your personal settings on Polar
  • Scroll down to Access token and create one
  • Copy & save it somewhere safe

Step 3. Publish from Astro

import { getCollection } from 'astro:content'
import { Polar } from '@polar-sh/astro'

const organizationName = '<your_polar/github_username>'
const accessToken = '<your_access_token>'

const posts = await getCollection('blog')
const polar = new Polar({ accessToken })

const { data, error } = await polar.upload(posts, {

The code above will upload all your posts to Polar and will update any existing posts that share a slug between Astro and Polar.

Note: Your organizationName on Polar is the same as your GitHub username or organization name - depending on which one you've connected.

Filtering and transforming posts + more

You can of course filter which content you want to publish, transform posts and more.

@isaacharrisholt has written a great in-depth post about all the features @polar-sh/astro offers today & how you can use them. Be sure to check it out to help us give credit where credit is due.

While you're at it, we highly recommend you give him a follow on Polar, YouTube & Twitter and checkout his personal site - built with Astro, of course.

We can't wait to see what you all do with this and don't hesitate to join our Discord to share your integration with the community. Or to hangout with us, Isaac and other fellow friendly developers 🙂

Until next time, keep building.