Skip to main content

Local mock server for social media platform APIs - auth, publishing, the lot

Project description

posthole

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. CI

[!WARNING] Pre-release / alpha. APIs and UI may break without notice. Not yet recommended for any production use.

Local mock server for social media platform APIs - auth, publishing, the lot.

posthole is a developer tool that stands in for real social media platform APIs so you can build and test integrations end-to-end on your laptop. Run it next to your app, point your code at 127.0.0.1:5176 instead of the real provider, and an inbox-style UI shows every post you've published alongside the complete HTTP transcript of each call. Instagram is the first platform supported; TikTok, Facebook, and others are on the roadmap.

It mocks the parts of these APIs you actually need while developing:

  • OAuth flows — authorize dialogs, token exchange, and token refresh.
  • Content publishing — images, videos, reels, stories, and carousels (including mixed-media), modeled on the real multi-step container → poll → publish lifecycle.
  • Accounts and permissions — switch between seeded test accounts and simulate revoked permissions.
  • Per-endpoint behavior toggles — flip any endpoint into a failure mode at runtime: rate-limited, validation error, media URL unreachable, reel duration too long, expired token, async-finished-with-error, slow response.
  • Scenarios — named bundles of behaviors (Validation, Quota, Auth, Async, Latency) so a single switch flips a whole class of failures on at once and you can watch how your code copes.

On the roadmap: replay (re-drive a captured request chain under a different scenario without re-running your app), inject (seed posts manually to reproduce specific UI states), more platforms (TikTok, Facebook, then YouTube and Threads), and richer device-preview frames.

Quick start

Docker (recommended):

docker run --rm -p 5176:5176 ghcr.io/socialpyre/posthole:latest
# → http://127.0.0.1:5176

As a uv tool (once published to PyPI):

uvx posthole
# → http://127.0.0.1:5176

Getting started

Prerequisites

  • Python 3.12+
  • uv ≥ 0.11 — curl -LsSf https://astral.sh/uv/install.sh | sh
  • Node 22 + pnpm 11nvm use (reads .nvmrc) then corepack enable
  • Docker (optional, only if you want to run the containerized image or test it locally)

Clone, install, run

git clone https://github.com/socialpyre/posthole
cd posthole
make install            # uv sync + pnpm install
make dev                # server + asset watchers + browser auto-reload

Then open http://127.0.0.1:5176.

Configurable knobs live in .env.schema; copy to .env.local to override locally. See CONTRIBUTING.md for the workflow.

Common make targets

Command What it does
make help Show available targets
make install Sync Python (uv sync) + Node (pnpm install) deps
make dev Run FastAPI server + esbuild + Tailwind watchers + browser auto-reload
make run Run the FastAPI server only (no watchers), with varlock-injected env
make assets One-shot rebuild of app.js + app.css
make test Run pytest
make lint ruff check + ruff format --check
make typecheck ty check (Python) + tsc --noEmit (TypeScript)
make check Everything CI runs (lint + typecheck + test)
make build Build wheel + sdist into dist/
make docker Build the Docker image locally as posthole:dev
make docker-run Run the locally built image

Live reload

make dev starts three watchers under one shell (trap 'kill 0' EXIT so a single Ctrl-C tears them all down):

  • fastapi dev restarts the server on .py / .toml edits via watchfiles.
  • esbuild --watch rebuilds src/posthole/static/app.js on .ts edits.
  • tailwindcss --watch rebuilds src/posthole/static/app.css on template / CSS edits.
  • arel is mounted on /hot-reload (gated by POSTHOLE_DEV_RELOAD=1) and reloads the browser when watched files change.

See CONTRIBUTING.md for the full development workflow, commit conventions, and release process.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

posthole-0.2.0.tar.gz (149.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

posthole-0.2.0-py3-none-any.whl (58.9 kB view details)

Uploaded Python 3

File details

Details for the file posthole-0.2.0.tar.gz.

File metadata

  • Download URL: posthole-0.2.0.tar.gz
  • Upload date:
  • Size: 149.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for posthole-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9fffd1d4cd2bb144b168526adb49718a1f9cf3dd975a42fa0fe8b1b953e163c1
MD5 20c00ab177a3da3a9f870574d8d62c78
BLAKE2b-256 b07ea08de82605d0f5b857e3e031c896cf39e19c13d19f897456b40e8fe0064b

See more details on using hashes here.

Provenance

The following attestation bundles were made for posthole-0.2.0.tar.gz:

Publisher: release.yml on socialpyre/posthole

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file posthole-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: posthole-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 58.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for posthole-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0d4d0690261449b9645c8ea8e0a9fb77348e785581904f391d511af61a217a3
MD5 42a979b9c87fea6331679fb259664e5c
BLAKE2b-256 c1d8c198bbc3286f60a541183f33445b018c4c0d8875cb070b705378345ac60c

See more details on using hashes here.

Provenance

The following attestation bundles were made for posthole-0.2.0-py3-none-any.whl:

Publisher: release.yml on socialpyre/posthole

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page