No description
Find a file
Paulo Castellano c871edf144 refactor: split MediaAttacher into orchestrator + downloader + safety guard
The previous MediaAttacher had ~5 responsibilities crammed in one class
(URL validation, HTTP fetch, streaming, MIME check, Storage write,
post.media merge) plus an `if ($app->runningUnitTests()) return true`
inside the SSRF guard — production code that knew about test mode.

Split into three:

- UrlSafetyGuard (interface) + DnsUrlSafetyGuard (default impl). The
  full SSRF check is now isolated and unit-testable in
  tests/Unit/Services/Post/DnsUrlSafetyGuardTest. Tests bind a permissive
  guard in tests/TestCase::setUp so feature tests using Http::fake() with
  synthetic hosts (cdn.example.com) still work — the runningUnitTests()
  check inside production code is gone.

- MediaDownloader: takes a URL, returns a temp file + MIME or null. Uses
  Http::sink with a Guzzle progress callback that throws once maxBytes
  is exceeded, so we abort mid-stream without buffering the body in PHP
  memory (the previous chunk loop was append-to-string which defeated
  the whole point of streaming).

- MediaAttacher: pure orchestrator. Calls MediaDownloader, validates the
  MIME against the post's enabled platforms, persists via Storage::putFileAs,
  appends the Media record under a row lock. Drops from 275 to ~190 lines
  with zero responsibility overlap.

The IO contract (`null` on failure, `['path','mime','bytes']` on success)
keeps MediaAttacher free of the temp-file lifecycle on the happy path —
ownership is documented in MediaDownloader's PHPDoc and the orchestrator
unlinks via try/finally in processOne().

Bind the interface in AppServiceProvider so production resolves
DnsUrlSafetyGuard automatically; tests override it.

7 new unit tests cover the SSRF cases (loopback, RFC1918, link-local,
zero/broadcast, IPv6 loopback/ULA/link-local, plus a public-IP positive
test). The 14 existing AttachMedia feature tests stay green.
2026-05-04 13:45:43 -03:00
.claude/skills feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
.github ci: fix tests workflow and clear pre-existing lint errors 2026-05-04 12:03:44 -03:00
app refactor: split MediaAttacher into orchestrator + downloader + safety guard 2026-05-04 13:45:43 -03:00
bootstrap feat: complete create + publish post flow via MCP and REST API 2026-05-04 08:12:28 -03:00
config feat: update Bluesky to use public AppView and remove Mastodon access token from public status requests 2026-05-03 22:16:19 -03:00
database feat: transition AI usage from feature-based limits to a centralized monthly credit system with token tracking. 2026-05-03 19:36:26 -03:00
lang feat: add duplicate post functionality and migrate LinkedIn analytics to the /rest/ API. 2026-05-03 22:37:51 -03:00
maizzle feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
public chore: posthog, ui, features and more 2026-03-30 21:18:07 -03:00
resources ci: fix tests workflow and clear pre-existing lint errors 2026-05-04 12:03:44 -03:00
routes feat: complete create + publish post flow via MCP and REST API 2026-05-04 08:12:28 -03:00
storage chore: first commit 2026-01-14 22:13:44 -03:00
stubs feat: implement MCP server with tools, Post API tests, auth middleware 2026-03-29 20:30:36 -03:00
templates refactor: reorganize settings UI, migrate post templates to a file-based registry, and remove legacy video generation features 2026-05-03 13:44:13 -03:00
tests refactor: split MediaAttacher into orchestrator + downloader + safety guard 2026-05-04 13:45:43 -03:00
.editorconfig chore: first commit 2026-01-14 22:13:44 -03:00
.env.ci feat: adding tests.. 2026-01-18 22:01:55 -03:00
.env.example feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
.env.testing feat: improvements on ui 2026-01-21 20:50:57 -03:00
.gitattributes chore: first commit 2026-01-14 22:13:44 -03:00
.gitignore chore: working 2026-04-02 17:57:06 -03:00
.mcp.json chore: update boost skills and config 2026-03-31 09:36:09 -03:00
.prettierignore chore: first commit 2026-01-14 22:13:44 -03:00
.prettierrc chore: first commit 2026-01-14 22:13:44 -03:00
artisan chore: first commit 2026-01-14 22:13:44 -03:00
boost.json feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
CLAUDE.md feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
components.json chore: first commit 2026-01-14 22:13:44 -03:00
compose.yaml feat: add documentation for connecting social media platforms and getting started guide 2026-01-18 18:57:15 -03:00
composer.json feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
composer.lock feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
eslint.config.js fix: address PR review findings — publish, REST store, SSRF, race 2026-05-04 12:16:39 -03:00
GEMINI.md chore: update config files and remove unused translation files 2026-01-26 12:02:24 -03:00
LICENSE.md feat: Introduce a self-hosted mode, refactor email notifications to use Mailable classes with new templates, and update the project README. 2026-01-18 17:48:12 -03:00
package-lock.json fix: resolve all TypeScript errors 2026-03-31 09:34:39 -03:00
package.json fix: resolve all TypeScript errors 2026-03-31 09:34:39 -03:00
phpunit.xml feat: adding tests 2026-01-18 22:04:34 -03:00
pint.json chore: first commit 2026-01-14 22:13:44 -03:00
README.md fix: Stripe webhook setup completion, notifications routing, billing UI 2026-03-31 13:52:36 -03:00
tsconfig.json chore: first commit 2026-01-14 22:13:44 -03:00
vite.config.ts chore: add resources/css/app.css to vite build input 2026-05-03 20:30:34 -03:00

TryPost

The open-source social media scheduling platform

Schedule, manage, and publish content to all your social media accounts from one place.
Self-hosted. Privacy-focused. No limits.

Stars License Release

DocumentationRoadmapCommunity


Why TryPost?

Tired of paying expensive monthly fees for social media scheduling tools? Want full control over your data? TryPost is the solution.

100% Open Source Inspect the code, contribute, make it yours
Self-Hosted Your data stays on your servers
No Limits Schedule unlimited posts, connect unlimited accounts
Privacy First No tracking, no analytics, no data selling

Features

Visual Calendar Drag and drop posts across your content calendar
Post Composer Create and preview posts for multiple platforms at once
Media Library Upload images and videos with automatic optimization
Team Collaboration Invite team members with role-based permissions (Owner, Admin, Member)
Workspaces Manage multiple brands or clients separately
REST API Full API with Bearer token authentication
MCP Server AI-ready with Model Context Protocol support
Google Login Sign up and log in with Google OAuth
Notifications In-app and email notifications for post status
i18n Available in English, Spanish, and Portuguese

Supported Platforms


X (Twitter)

LinkedIn

Facebook

Instagram

TikTok

YouTube

Pinterest

Threads

Bluesky

Mastodon

Tech Stack

Layer Technology
Backend Laravel 13, PHP 8.4
Frontend Vue 3, Inertia.js v3, Tailwind CSS v4
Database PostgreSQL
Queue Redis + Laravel Horizon
WebSockets Laravel Reverb
API REST with Bearer token auth
MCP Laravel MCP for AI integrations
Payments Laravel Cashier (Stripe)

Getting Started

Get TryPost running in minutes:

Installation Guide Step-by-step setup
Docker Setup Run with Laravel Sail
Configuration Environment setup
Platform Setup Connect your social accounts

Quick Start

git clone https://github.com/trypost-it/trypost.git
cd trypost
cp .env.example .env
composer install
npm install
php artisan key:generate
php artisan migrate
npm run build

API

TryPost includes a REST API for programmatic access. All endpoints are under /api and require a Bearer token.

curl -H "Authorization: Bearer tp_your_token" \
  https://your-domain.com/api/posts

See the API documentation for all available endpoints.

MCP Server

TryPost ships with a Model Context Protocol (MCP) server at /mcp/trypost, enabling AI assistants to manage your social media directly.

Contributing

We love contributions! Check the issues for open tasks.

License

TryPost is licensed under the Functional Source License (FSL).

You can: Use for personal or business use, self-host, modify and contribute.

You cannot: Offer as a competing SaaS, white-label and resell.


If TryPost helps you, please give us a star