Skip to main content

Overview

Plant Together uses Docker Compose to orchestrate multiple services including the React frontend, Express backend, Y-Redis WebSocket server, PostgreSQL database, Redis cache, and PgAdmin. This guide covers both development and production deployments.

Prerequisites

Before you begin, ensure you have the following installed:
  • Docker (version 20.10 or higher)
  • Docker Compose (version 2.0 or higher)
  • Git

Quick Start

1

Clone the Repository

Clone the Plant Together repository to your local machine:
git clone https://github.com/yourusername/plant-together.git
cd plant-together
2

Configure Environment Variables

Create a .env file in the root directory. At minimum, you must configure Firebase credentials:
The following Firebase environment variables are required:
  • FIREBASE_API_KEY
  • FIREBASE_AUTH_DOMAIN
  • FIREBASE_PROJECT_ID
See the Environment Variables page for a complete list of configuration options.
3

Build and Start Services

docker compose up --build
This command will:
  • Build Docker images for all services
  • Start all containers defined in the compose file
  • Create necessary networks and volumes
4

Access the Application

Once the containers are running, you can access:

Service Architecture

The Docker Compose configuration includes the following services:
ServiceContainer NamePurposeDefault Port
plant-together-reactplant-together-react-devReact frontend application5173 (dev), 4173 (prod)
plant-together-expressplant-together-express-devExpress REST API server3000
plant-together-yredisplant-together-yredis-devY-Redis WebSocket server for real-time collaboration3003
redis-togetherredis-together-devRedis cache for WebSocket connections6379
database-psqldatabase-psql-devPostgreSQL database5432
pgadmin-togetherpgadmin-together-devPgAdmin web interface1007

Development vs Production

Development Configuration

The development setup (docker-compose.yaml) includes:
  • Hot reload for React and Express services
  • Volume mounts for live code updates
  • Debug-friendly logging
  • PgAdmin for database management
volumes:
  - type: bind
    source: ./react
    target: /app
  - /app/node_modules
  - /app/.vite

Production Configuration

The production setup (docker-compose-prod.yaml) includes:
  • Optimized production builds
  • Restart policies for high availability
  • Additional networks for service isolation
  • Analytics integration (PostHog, Clarity)
restart: always
networks:
  - plant-together-network
  - yredis-network

Common Operations

View Service Logs

docker compose logs -f

Stop Services

docker compose stop

Restart a Service

# Restart a specific service
docker compose restart plant-together-express-dev

# Rebuild and restart a service
docker compose up --build -d plant-together-express-dev

Access Container Shell

# Access Express container
docker exec -it plant-together-express-dev sh

# Access PostgreSQL container
docker exec -it database-psql-dev psql -U postgres

Networking

Development Network

All services communicate over the plant-together-network Docker network:
networks:
  plant-together-network:

Production Networks

Production uses two isolated networks:
  • plant-together-network: For frontend and database connections
  • yredis-network: For Y-Redis and Redis communication

Persistent Storage

Two Docker volumes are created for data persistence:
volumes:
  pgdata-plant-together-dev:
    name: pgdata-plant-together-dev
    driver: local
Removing these volumes with docker compose down -v will permanently delete all database data and PgAdmin configurations.

Troubleshooting

Port Already in Use

If you encounter port conflicts, modify the port mappings in your .env file:
PORT=3001              # Express server
YREDIS_PORT=3004       # Y-Redis server
PSQL_PORT=5433         # PostgreSQL
REDIS_PORT=6380        # Redis
PGADMIN_PORT=1008      # PgAdmin

Container Fails to Start

Check the logs for the specific service:
docker compose logs plant-together-express-dev
Common issues:
  • Missing environment variables (especially Firebase credentials)
  • Database connection failures (check DB_HOST, DB_USER, DB_PASS)
  • Port conflicts

Database Connection Issues

Verify PostgreSQL is healthy:
docker compose ps
docker exec -it database-psql-dev pg_isready

Redis Connection Issues

Test Redis connectivity:
docker exec -it redis-together-dev redis-cli ping

Next Steps

Build docs developers (and LLMs) love