# Wiki.js Knowledge Base

> Wiki.js modern wiki platform with PostgreSQL.

- Category: Productivity & Collaboration
- Difficulty: beginner
- Components: wikijs, postgresql
- Tags: wikijs, wiki, documentation, knowledge-base, postgresql
- Source: https://docker.recipes/productivity/wikijs-knowledge-base

## Overview

Wiki.js is a modern, lightweight wiki engine built on Node.js that transforms how teams create, manage, and share documentation. Launched in 2017, it offers a sleek web interface with markdown support, real-time editing, and extensive customization options that make it ideal for technical documentation, knowledge bases, and collaborative content creation. Unlike traditional wikis, Wiki.js provides a Git-based storage system, multiple authentication providers, and a plugin architecture that adapts to diverse organizational needs. This stack combines Wiki.js with PostgreSQL to create a robust documentation platform where PostgreSQL's ACID compliance and advanced querying capabilities ensure data integrity for wiki content, user management, and search indexing. PostgreSQL's full-text search features enhance Wiki.js's built-in search functionality, while its JSON support efficiently stores the platform's metadata and configuration settings. The database's reliability ensures that documentation remains accessible and consistent, even under heavy concurrent editing loads. This combination is perfect for development teams needing reliable documentation workflows, IT departments building internal knowledge repositories, and organizations requiring professional wiki solutions with enterprise-grade data persistence. The PostgreSQL backend provides the scalability and performance needed for large content repositories while maintaining the flexibility that makes Wiki.js appealing for both small teams and large enterprises.

## Features

- Real-time collaborative editing with live preview and conflict resolution
- Git synchronization for version control and backup of wiki content
- Multiple authentication methods including LDAP, OAuth, and SAML integration
- Advanced search capabilities powered by PostgreSQL's full-text indexing
- Page templating system with custom layouts and reusable content blocks
- Multi-language content support with automatic translation workflows
- Comprehensive permission system with page-level access controls
- Theme customization with CSS injection and logo branding options

## Use cases

- Software development teams creating API documentation and technical guides
- IT departments building internal knowledge bases for procedures and troubleshooting
- Educational institutions developing course materials and student resources
- Open source projects maintaining community documentation and contribution guides
- Customer support teams creating searchable FAQ and help desk resources
- Remote teams establishing centralized information hubs for company policies
- DevOps teams documenting infrastructure, deployment processes, and runbooks

## Prerequisites

- Minimum 1GB RAM for optimal PostgreSQL and Wiki.js performance
- Port 3000 available for Wiki.js web interface access
- Basic understanding of markdown syntax for content creation
- Git repository access if planning to use Git synchronization features
- SMTP server details for email notifications and user registration
- SSL certificate configuration knowledge for production deployments

## docker-compose.yml

```yaml
services:
  postgres:
    image: postgres:16-alpine
    container_name: wikijs-postgres
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${POSTGRES_USER:-wikijs}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-wikijs}
      POSTGRES_DB: ${POSTGRES_DB:-wikijs}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      - wikijs-network

  wikijs:
    image: ghcr.io/requarks/wiki:2
    container_name: wikijs
    restart: unless-stopped
    ports:
      - "${WIKIJS_PORT:-3000}:3000"
    environment:
      - DB_TYPE=postgres
      - DB_HOST=postgres
      - DB_PORT=5432
      - DB_USER=${POSTGRES_USER:-wikijs}
      - DB_PASS=${POSTGRES_PASSWORD:-wikijs}
      - DB_NAME=${POSTGRES_DB:-wikijs}
    depends_on:
      - postgres
    networks:
      - wikijs-network

volumes:
  postgres_data:

networks:
  wikijs-network:
    driver: bridge
```

## .env

```bash
# Wiki.js
WIKIJS_PORT=3000
POSTGRES_USER=wikijs
POSTGRES_PASSWORD=wikijs
POSTGRES_DB=wikijs
```

## Usage notes

- Wiki.js at http://localhost:3000
- Complete setup wizard
- Supports Git sync
- Multiple auth methods

## Troubleshooting

- Wiki.js shows database connection error: Verify PostgreSQL container is running and POSTGRES_PASSWORD matches DB_PASS environment variable
- Setup wizard loops or won't complete: Clear browser cache and ensure no existing Wiki.js data in postgres_data volume
- Git sync fails with authentication error: Configure SSH keys or personal access tokens in Wiki.js admin panel under Storage settings
- Search results incomplete or missing: Run database maintenance from Admin > System > Utilities to rebuild search indexes
- Upload failures for images or files: Check available disk space and increase Docker volume size limits if necessary
- Performance issues with large content: Enable PostgreSQL query optimization by increasing shared_buffers and work_mem in database configuration

