r/purpleteamsec

▲ 15 r/purpleteamsec+5 crossposts

I built a CLI tool to sync your Notion pages locally & images actually work

Hey guys!

I've been using Notion for my writeups and notes for a while, and every time I tried to export or sync content programmatically, images were always broken. The official API gives you signed S3 URLs that expire in ~1 hour, so by the time your static site builds, half your images are dead.

So I built a small CLI tool that actually handles this properly, images get downloaded locally and the URLs get rewritten, so nothing breaks.

**What it does:**

- Pulls pages or entire databases as clean local markdown files

- Downloads images locally and rewrites the URLs (no more expiring links)

- Auto-detects your workspace and space ID

- Tracks sync state so it only re-pulls pages that actually changed

- Works with any stack - Astro, Hugo, Obsidian, whatever

**Setup is pretty simple:**

```

npm install -g notion-sync-cli

```

Add your Notion PAT to a `.env` file (Settings -> Personal access tokens, not integrations):

```

NOTION_TOKEN=ntn_xxxx

```

Then just run:

```

notion-sync init

```

It walks you through picking your database or pages interactively, no config file editing needed.

Package: `npm install -g notion-sync-cli`

GitHub: https://github.com/Chaelsoo/Notion-sync

Happy to answer any questions or take feedback.

u/Chaelsoo — 1 day ago