POSTARYX

Development Environment

Set up Postiz for local development

This article guides you for local development on Postiz. If you're only looking to self-host, docker-compose is the recommended method. Docker-Compose is the recommended method and now includes the Temporal stack for workflow processing.

Important: Postiz uses Temporal for background workflows. If you are upgrading from v2.11.2 to v2.12.0 or later, follow the migration guide at /installation/migration and use the maintained Docker Compose repository which includes the Temporal stack: /installation/docker-compose.

Tested configurations

  • macOS
  • Linux (Fedora 40)

Naturally you can use these instructions to setup a development environment on any platform, but there may not be much experience in the community to help you with any issues you may encounter.

Warning about Windows

Several users using Windows (and WSL) have reported issues with the setup. This is not well tested as the main developers of the project do not use Windows/WSL for development. If you are using Windows and encounter issues, please do not try to get support, as we aren't able to support you.

Installation Prerequisites

This section will ask you to install & configure several services explained below.

Network Requirements

HTTPS / HTTP Requirement

Postiz marks it's login cookies as Secure, this is called "secure context" in modern web browsers.

If you want to use a secure Login Process, you need to set up a Certificate, which can be done via Reverse Proxy like Caddy or Nginx.

If you cannot use a certificate (HTTPS), add the following environment variable to your .env file:

NOT_SECURED=true

Security Warning: Setting NOT_SECURED=true disables secure cookie requirements. This should only be used in development environments or when you fully understand the security implications. Not recommended for production use.

Network Ports

  • 5000/tcp: for a single single entry point for Postiz when running in a container. This is the one port your reverse proxy should talk to.
  • 4200/tcp: for the Frontend service (the web interface). Most users do not need to expose this port publicly.
  • 3000/tcp: for the Backend service (the API). Most users do not need to expose this port publicly.
  • 5432/tcp: for the Postgres container. Most users do not need to expose this port publicly.
  • 6379/tcp: for the Redis container. Most users do not need to expose this port publicly.

If you are using Docker images, we recommend just exposing port 5000 to your external proxy. This will reduce the likelihood of misconfiguration, and make it easier to manage your network.

graph TD;
	A[Your Browser] -->|HTTPS 443/tcp| B[Your Reverse Proxy]
	B -->|HTTP 5000/tcp| C["Internal Proxy (Caddy)"]

	subgraph "Postiz Container"
	C -->|4200/tcp| D[Frontend Service]
	C -->|3000/tcp| E[Backend Service]
    C -->|/api| H[uploads]
	end

	E -->|5432/tcp| F[Postgres Container]
	E -->|6379/tcp| G[Redis Container]

Prerequisite Local Services

  • Node.js - for running the code! (version 18+)
  • PostgreSQL - or any other SQL database (instructions below suggest Docker)
  • Redis - for handling worker queues (instructions below suggest Docker)
  • Temporal - runs as a separate stack (Postgres + Elasticsearch + Temporal services). For local development run the Temporal stack via the postiz-docker-compose repository described in /installation/docker-compose. Set TEMPORAL_ADDRESS in your .env to point at the Temporal service (example below).

We have some messages from users who are using Windows, which should work, but they are not tested well yet.

Installation Instructions

Node.js (version 18+)

A complete guide of how to install Node.js is on the Node.js download page.

PostgreSQL (or any other SQL database) & Redis

You can choose Option A to Option B to install the database.

Option A) Postgres and Redis as Single containers

You can install Docker and run:

docker run -e POSTGRES_USER=root -e POSTGRES_PASSWORD=your_password --name postgres -p 5432:5432 -d postgres
docker run --name redis -p 6379:6379 -d redis

Option B) Postgres and Redis as docker-compose

Download the docker-compose.yaml file here, or grab it from the repository in the next step.

docker compose -f "docker-compose.dev.yaml" up

To run Temporal locally, clone the maintained Docker Compose repository which includes the Temporal stack and follow the instructions in /installation/docker-compose. See /installation/migration for migration steps when moving data to the Temporal-enabled setup.

Build Postiz

Clone the repository

git clone https://github.com/gitroomhq/postiz-app.git

Set environment variables

Copy the .env.example file to .env and fill in the values

# Required Settings
DATABASE_URL="postgresql://postiz-user:postiz-password@localhost:5432/postiz-db-local"
REDIS_URL="redis://localhost:6379"
JWT_SECRET="random string for your JWT secret, make it long"
FRONTEND_URL="http://localhost:4200"
NEXT_PUBLIC_BACKEND_URL="http://localhost:3000"
BACKEND_INTERNAL_URL="http://localhost:3000"
TEMPORAL_ADDRESS="localhost:7233"

# Optional. Your upload directory path if you host your files locally.
UPLOAD_DIRECTORY="/opt/postiz/uploads/"

# Optional: your upload directory slug if you host your files locally.
NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY=""

# Your email provider, optional
EMAIL_PROVIDER="resend|nodemailer"
RESEND_API_KEY="re_1234567890" # api key if you choose resend
EMAIL_HOST="smtp.gmail.com" # smtp host if you choose nodemailer
EMAIL_PORT="465" # smtp port if you choose nodemailer
EMAIL_SECURE="true" # smtp secure if you choose nodemailer
EMAIL_USER="user" # smtp user if you choose nodemailer
EMAIL_PASS="pass" # smtp pass if you choose nodemailer

## These are dummy values, you must create your own from Cloudflare.
## Remember to set your public internet IP address in the allow-list for the API token.
CLOUDFLARE_ACCOUNT_ID="QhcMSXQyPuMCRpSQcSYdEuTYgHeCXHbu"
CLOUDFLARE_ACCESS_KEY="dcfCMSuFEeCNfvByUureMZEfxWJmDqZe"
CLOUDFLARE_SECRET_ACCESS_KEY="zTTMXBmtyLPwHEdpACGHgDgzRTNpTJewiNriLnUS"
CLOUDFLARE_BUCKETNAME="postiz"
CLOUDFLARE_BUCKET_URL="https://QhcMSXQyPuMCRpSQcSYdEuTYgHeCXHbu.r2.cloudflarestorage.com/"
CLOUDFLARE_REGION="auto"

# Social Media API Settings
X_API_KEY="Twitter API key for normal oAuth not oAuth2"
X_API_SECRET="Twitter API secret for normal oAuth not oAuth2"
LINKEDIN_CLIENT_ID="Linkedin Client ID"
LINKEDIN_CLIENT_SECRET="Linkedin Client Secret"
REDDIT_CLIENT_ID="Reddit Client ID"
REDDIT_CLIENT_SECRET="Linkedin Client Secret"
GITHUB_CLIENT_ID="GitHub Client ID"
GITHUB_CLIENT_SECRET="GitHub Client Secret"

# AI
OPENAI_API_KEY="OpenAI API key"

# Developer Settings
NX_ADD_PLUGINS=false
IS_GENERAL="true" # required for now

Install the dependencies

pnpm install

Generate the prisma client and run the migrations

pnpm run prisma-db-push

Run the project

pnpm run dev

If everything is running successfully, open http://localhost:4200 in your browser!

If everything is not running - you had errors in the steps above, please head over to our support page.

Next Steps