8000 GitHub - xergic/og-tester: See how a link looks when shared on social and chat apps, before you ship it. · GitHub
[go: up one dir, main page]

Skip to content
xergicPublic

About

See how a link looks when shared on social and chat apps, before you ship it.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

OG Tester

See how a link looks when shared on social and chat apps, before you ship it. Works with localhost.

OG Tester showing Facebook and X previews

Official debuggers such as the Facebook Sharing Debugger or LinkedIn Post Inspector cannot reach your local dev server. OG Tester runs on your machine, fetches the page like a social crawler, and renders a close replica of the post on 14 services, in light and dark mode.

Two ways to use it:

  • Hosted: check live, public sites at og.kandera.cz. Nothing to install.
  • Local: clone and run it (see Quick start) to check localhost and private networks.

Features

  • 14 previews: Facebook, Messenger, X, Threads, LinkedIn, Pinterest, Bluesky, Mastodon, Slack, Discord, WhatsApp, iMessage, Telegram, and Google search.
  • Real crawler behavior: no JavaScript runs, so tags added on the client are missing here too, just like on the real platforms.
  • Per-platform rules: each card uses that platform's tag fallbacks and picks a large, small, or text-only layout from the real image size.
  • Warnings: missing tags, relative or http image URLs, small or heavy images, crop ratio, long titles, og:url mismatch, and more. Each warning names the platforms it affects.
  • Image checks: real dimensions, type, and file size of every og:image and twitter:image.
  • Tag table: all tags grouped by type. Click a value to copy it.
  • Light, dark, and system theme for the app and every card.

Quick start

Requirements: Bun 1.4 or newer.

git clone https://github.com/xergic/og-tester.git
cd og-tester
bun install
bun run dev

Open http://127.0.0.1:4321 and paste a URL, for example http://localhost:3000/.

The server listens on 127.0.0.1 only. Set PORT< 7C41 /code> to change the port.

URL parameters

Parameter Effect
?url=<page> Fetch this page on load
?theme=light|dark Override the theme without saving it
?platforms=x,facebook Show only these cards

How accurate are the previews?

Close, not perfect. The platforms change their UI often and most are closed source.

  • Bluesky and Mastodon values come from their open-source code.
  • The other platforms use values from official docs, public write-ups, and inspection. Each value is marked verified or estimated in docs/platform-specs.md.
  • Some behavior is surprising but real: X large cards show only the image with a domain label, and LinkedIn shows a compact card for normal (not promoted) posts.

Spotted a difference? Open an issue with a screenshot of the real post.

Development

bun test            # unit and integration tests
bun run typecheck   # TypeScript
bun run lint        # Biome (bun run format to fix)

scripts/screenshot.sh renders cards in headless Chrome for visual checks. Test pages live in tests/fixtures/ and are served at /fixtures/*.

Tech: Bun server with HTML imports, vanilla TypeScript client, no framework. Runtime dependencies: image-size and entities.

Deploy to Cloudflare Workers

The hosted version previews public URLs only. A Worker cannot reach localhost or private networks, so it rejects them with a message that points to the local setup.

bun run preview   # build and run the Worker locally with wrangler dev
bun run deploy    # build and deploy (runs wrangler login on first use)
  • worker.ts serves /api/preview and the built client from dist/ as static assets.
  • /api/preview is rate limited to 30 requests per minute per IP. Change it in wrangler.jsonc.
  • The Worker rewrites og:image and og:url to absolute URLs on the current domain, so no domain config is needed.

Contributing

Contributions are welcome. Read CONTRIBUTING.md for setup, project layout, and how to add or fix a platform.

License

MIT © Ondra Kandera

Brand icons come from Simple Icons (CC0). All product names, logos, and brands belong to their owners. OG Tester is not affiliated with or endorsed by any of them.

About

See how a link looks when shared on social and chat apps, before you ship it.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages

0