Skip to content

Pubky Docker

Pubky Docker is a Docker Compose orchestration that provides a one-click local development environment for running the complete Pubky Social (App) stack. It’s designed for developers who want to experiment with the full Pubky ecosystem or test components in an isolated environment.

Pubky Docker orchestrates the following components:

  1. Pubky Homeserver - Decentralized data storage instance
  2. Pubky Nexus - Social media indexer and aggregator
  3. Homegate - Signup verification service for preventing automated signup spam
  4. pubky.app - Social media client frontend

Third-party infrastructure images (Postgres, Neo4j, Redis, Redis Insight, WireMock) are pulled from their public registries.

  • Experimenting with the complete Pubky Social stack
  • Developing or testing Pubky Nexus integrations
  • Building custom social media frontends
  • Testing Homeserver configurations
  • Learning how all Pubky components interact
  • Debugging cross-component issues
  • Building applications using Pubky Core (use SDK libraries instead)
  • Developing simple Pubky integrations (use official client libraries)
  • Just testing basic read/write operations

For application development, use the official client libraries:

This is the fastest way to get started. All images are available on Docker Hub.

  1. Clone the repository:
Terminal window
git clone https://github.com/pubky/pubky-docker.git
cd pubky-docker
  1. Configure environment:
Terminal window
cp .env-sample .env
# Edit .env to set NETWORK=mainnet or NETWORK=testnet
  1. Start the stack:
Terminal window
docker compose up -d

For source builds, see Local Setup From Source in the Pubky Docker README.

Local instance of Pubky Homeserver with PostgreSQL backend.

Configuration: homeserver.config.toml

Database: PostgreSQL (Port 5432)

Endpoints:

  • 6287: Primary HTTP API
  • 6286: Admin API
  • 6288: Metrics
  • 15411-15412: HTTP relay

Pubky Nexus indexer and aggregator with graph database and search capabilities.

Configuration: pubky-nexus-config-{testnet|mainnet}.toml

Dependencies:

  • Neo4j graph database (Ports 7474, 7687)
  • Redis search index (Port 6379)

Endpoints:

  • 8080: Main API
  • 8081: Admin/metrics

Homegate signup verification service configured for local development.

Configuration: homegate.config.toml

Access: http://localhost:6300

pubky.app social media frontend configured to use the local stack.

Access: http://localhost:3000

Configuration is managed through a .env file. Copy the sample and adjust as needed:

Terminal window
cp .env-sample .env

See .env-sample in the repository for all available variables and their defaults.

The stack uses a custom Docker bridge network (172.18.0.0/16) with static IPs:

ServiceIPExternal Ports
Nexus172.18.0.38080, 8081
Homeserver172.18.0.46286-6288, 15411-15412
Neo4j172.18.0.57474, 7687
Redis172.18.0.66379
Redis Insight172.18.0.75540
pubky.app172.18.0.83000
Postgres172.18.0.95432
Homegate172.18.0.106300
Terminal window
docker compose up -d
Terminal window
# All services
docker compose logs -f
# Specific service
docker compose logs -f homeserver
docker compose logs -f nexusd
Terminal window
docker compose down
Terminal window
docker compose build
docker compose up -d
Terminal window
docker compose down -v
rm -rf .storage/
  1. Modify code in ../pubky-core/
  2. Rebuild Homeserver:
Terminal window
docker compose build homeserver
docker compose up -d homeserver
  1. Modify code in ../pubky-nexus/
  2. Rebuild nexus:
Terminal window
docker compose build nexusd
docker compose up -d nexusd
  1. Modify code in ../pubky-app/
  2. Rebuild pubky.app:
Terminal window
docker compose build pubky-app
docker compose up -d pubky-app

All data is stored in the .storage/ directory:

.storage/
├── postgres/ # Homeserver database
├── homegate/ # Homegate data
├── neo4j/ # Nexus graph data
├── redis/ # Nexus search index
└── static/ # Nexus static files

This directory is gitignored. To reset your environment, simply delete it.

Check if ports are already in use:

Terminal window
# Check port availability
lsof -i :3000 -i :6287 -i :8080 -i :6300

Ensure PostgreSQL is healthy:

Terminal window
docker compose ps postgres
docker compose logs postgres

Verify Homeserver is running and accessible:

Terminal window
curl http://localhost:6287/
docker compose logs homeserver
Terminal window
# Stop service
docker compose stop nexusd
# Remove its data
rm -rf .storage/neo4j .storage/redis
# Restart
docker compose up -d nexusd

The Pubky Docker stack demonstrates the full architecture of a Pubky Social application:

┌───────────────────────────────────────────────────────────────┐
│ Browser │
│ (localhost:3000) │
└───────────────────────────────┬───────────────────────────────┘
┌───────────────────────────────▼───────────────────────────────┐
│ Docker Compose stack │
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ pubky.app (Client) │ │
│ │ Next.js Frontend │ │
│ └────────────┬──────────────────────┬─────────────────────┘ │
│ │ │ │
│ ┌────────▼─────────┐ ┌────────▼──────────┐ │
│ │ Pubky Nexus │ │ Pubky Homeserver │ │
│ │ (Social API) │ │ (User Storage) │ │
│ │ - Neo4j Graph │ │ - PostgreSQL │ │
│ │ - Redis Search │ │ - File Storage │ │
│ └──────────────────┘ └────────┬──────────┘ │
│ │ │
│ ┌──────▼───────┐ │
│ │ Homegate │ │
│ │ (Signup) │ │
│ └──────────────┘ │
└───────────────────────────────┬───────────────────────────────┘
┌───────────────────────────────────────────────────────────────┐
│ Synonym-hosted PKARR Relay │
│ used by the configured stack │
└───────────────────────────────────────────────────────────────┘