How it works

From a slot on a calendar to a post on a platform.

This page describes the real path, including which endpoints are called and what is stored on the way. If you are reviewing Postiva for a platform integration, this is the page to read.

Architecture

Two processes on one server, one database file.

The panel and the worker are separate on purpose.

The panel is a Next.js application: it renders the calendar, accepts uploads and writes rows. It does not publish anything. Publishing is done by a second process, a worker on a 20 second tick that reads due jobs from the same SQLite database, calls the platform APIs and writes the result back. The split means a browser tab closing, a deploy or a panel error cannot interrupt a publish in flight, and it makes the failure mode obvious: if the worker is down, nothing goes out, and the panel says the line is closed rather than queueing silently.

Step one

Nothing is stored until you complete the platform's own consent screen.

Connecting an account.

Platform OAuth, in a popup
The connect button opens the platform's own authorisation screen. Postiva never asks for, sees or stores a social media password. The state parameter is signed and verified on return, so a callback that did not originate from your panel is rejected.
Encrypted at rest
The access token, the refresh token and their expiry times are encrypted with AES-256-GCM before being written. TikTok rotates the refresh token on every renewal, so renewals hold a per account lock and persist the new pair atomically: an interrupted refresh cannot leave a half written credential behind.
What is read from the platform
The account id, the username and the profile picture, so the panel can show you which profile a post is going to. Postiva does not read follower lists, audience data, comments or direct messages.
Renewal
The worker checks token expiry on a slow loop and refreshes ahead of time. If a token cannot be renewed, the account is flagged in the panel and a notification is sent instead of posts failing quietly.

TikTok

Login Kit and the Content Posting API. Scopes: user.info.basic, video.upload, video.publish.

How a video reaches TikTok.

  1. 01

    Draft mode, the default

    The worker initialises an upload against the content posting inbox endpoint, sends the file in chunks, then polls for the status. The video lands in the account holder's own TikTok inbox as a draft. A person opens TikTok, reviews it and taps publish. Nothing becomes public without that tap.

  2. 02

    Direct mode, only if the operator turns it on

    Before initialising, Postiva calls the Creator Info endpoint. It uses a privacy level the account actually offers rather than assuming one, and it refuses a video longer than the maximum duration that endpoint reports for the account. Only then does it initialise the publish, upload the file and poll for the result.

  3. 03

    Photo posts

    Photo and carousel posts are initialised as photo content and the images are pulled from URLs on the same verified domain, which is the path the API supports for this content type.

  4. 04

    Limits are respected in code

    TikTok caps how many shares an account can have pending in a day. When that cap is reached, the job is deferred and picked up later instead of being retried into a rate limit error. The upload is chunked according to file size and resumed from its checkpoint if a step is interrupted.

Every TikTok post originates from a slot the operator placed on the calendar for an account they own and authorised. There is no auto generated content, no reposting of other people's videos and no engagement automation of any kind.

Instagram and Threads

Instagram Graph API content publishing, Threads API.

The same shape, different endpoints.

Instagram
A media container is created for the reel, image, carousel or story, the platform fetches the file from a URL on the same domain, and the container is published once it reports as ready. The container id is checkpointed before publishing so a retry finishes the existing container rather than creating a second one.
Threads
A container is created and then published, with the same checkpoint discipline.
Result
On success the platform post id and permalink are written to the queue row and sent to Telegram. On failure the platform error text is kept verbatim, because a paraphrased error is useless a week later.

When it fails

Publishing is a network operation. It will fail sometimes.

What the system does about it.

Temporary errors
Retried with growing delays, up to a bounded number of attempts, then parked as failed with the reason attached.
Permanent errors
Wrong aspect ratio, video too long, revoked permission: these stop immediately rather than burning retries, and the queue row explains what to fix.
Downtime
Slots that passed while the server was down are published on recovery if they are inside the late window, and marked missed if they are not.
Double posting
Prevented structurally. The platform side id is written before the step that would create a second post, and every retry checks it first.