# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: LibreChat
spec:
    description: Enhanced ChatGPT Clone with many features and AI models.
    icon: https://github.com/danny-avila/LibreChat/raw/638ac5bba61a524cc4ae99711a91f19572c4f2a0/client/public/assets/logo.svg
    variables:
        - key: OPENROUTER_KEY
          type: STRING
          name: OpenAI Router Key
          description: Your OpenRouter API Key, required for OpenRouter Models.
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Domain
          description: The domain of your LibreChat website.
    readme: "# LibreChat\n\nEnhanced ChatGPT Clone: Features OpenAI, GPT-4 Vision, Mistral, Bing, Anthropic, OpenRouter, Google Gemini, AI model switching, message search, langchain, DALL-E-3, ChatGPT Plugins, OpenAI Functions, Secure Multi-User System, Presets, completely open-source for self-hosting.\n\n## features\n\n\U0001F5A5️ UI matching ChatGPT, including Dark mode, Streaming, and 11-2023 updates\n\n\U0001F4AC Multimodal Chat:\nUpload and analyze images with GPT-4 and Gemini Vision \U0001F4F8\nMore filetypes and Assistants API integration in Active Development \U0001F6A7\n\n\U0001F916 AI model selection: OpenAI API, Azure, BingAI, ChatGPT, Google Vertex AI, Anthropic (Claude), Plugins\n\n\U0001F4BE Create, Save, & Share Custom Presets\n\n\U0001F504 Edit, Resubmit, and Continue messages with conversation branching\n\n\U0001F4E4 Export conversations as screenshots, markdown, text, json.\n\n\U0001F50D Search all messages/conversations\n\n\U0001F50C Plugins, including web access, image generation with DALL-E-3 and more\n\n\U0001F465 Multi-User, Secure Authentication with Moderation and Token spend tools\n\n⚙️ Configure Proxy, Reverse Proxy, Docker, many Deployment options, and completely Open-Source\n"
    services:
        - name: mongodb
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/mongodb.svg
          template: PREBUILT
          spec:
            source:
                image: mongo:7.0
                command:
                    - sh
                args:
                    - -c
                    - sed -i '10,23d' /usr/local/bin/docker-entrypoint.sh && exec docker-entrypoint.sh mongod
            ports:
                - id: database
                  port: 27017
                  type: TCP
            volumes:
                - id: data
                  dir: /data/db
            instructions:
                - title: Command to connect to your MongoDB
                  content: mongosh "mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}"
                - title: MongoDB connection string
                  content: mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}
                - title: MongoDB username
                  content: ${MONGO_USERNAME}
                - title: MongoDB password
                  content: ${MONGO_PASSWORD}
                - title: MongoDB host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: MongoDB port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
            env:
                MONGO_CONNECTION_STRING:
                    default: mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@${MONGO_HOST}:${MONGO_PORT}
                    expose: true
                MONGO_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                MONGO_INITDB_ROOT_PASSWORD:
                    default: ${PASSWORD}
                MONGO_INITDB_ROOT_USERNAME:
                    default: mongo
                MONGO_PASSWORD:
                    default: ${MONGO_INITDB_ROOT_PASSWORD}
                    expose: true
                MONGO_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                MONGO_URI:
                    default: ${MONGO_CONNECTION_STRING}
                    expose: true
                MONGO_USERNAME:
                    default: ${MONGO_INITDB_ROOT_USERNAME}
                    expose: true
        - name: meilisearch
          icon: https://www.meilisearch.com/favicon.svg
          template: PREBUILT
          spec:
            source:
                image: getmeili/meilisearch
            ports:
                - id: web
                  port: 7700
                  type: HTTP
            volumes:
                - id: data
                  dir: /meili_data
            instructions:
                - title: Meilisearch Master Key
                  content: ${MEILI_MASTER_KEY}
            env:
                MEILI_MASTER_KEY:
                    default: ${PASSWORD}
                    expose: true
        - name: postgresql
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg
          template: PREBUILT
          spec:
            source:
                image: pgvector/pgvector:pg16
            ports:
                - id: database
                  port: 5432
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/postgresql/data
            instructions:
                - title: Connection String
                  content: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}
                - title: PostgreSQL Connect Command
                  content: psql "postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}"
                - title: PostgreSQL username
                  content: ${POSTGRES_USERNAME}
                - title: PostgresSQL password
                  content: ${POSTGRES_PASSWORD}
                - title: PostgresSQL database
                  content: ${POSTGRES_DATABASE}
                - title: PostgreSQL host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: PostgreSQL port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
            env:
                PGDATA:
                    default: /var/lib/postgresql/data/pgdata
                POSTGRES_CONNECTION_STRING:
                    default: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}
                    expose: true
                POSTGRES_DATABASE:
                    default: ${POSTGRES_DB}
                    expose: true
                POSTGRES_DB:
                    default: mydatabase
                POSTGRES_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                POSTGRES_PASSWORD:
                    default: mypassword
                    expose: true
                POSTGRES_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                POSTGRES_URI:
                    default: ${POSTGRES_CONNECTION_STRING}
                    expose: true
                POSTGRES_USER:
                    default: myuser
                POSTGRES_USERNAME:
                    default: ${POSTGRES_USER}
                    expose: true
        - name: rag-api
          icon: https://github.com/danny-avila/LibreChat/raw/638ac5bba61a524cc4ae99711a91f19572c4f2a0/client/public/assets/logo.svg
          template: PREBUILT
          spec:
            source:
                image: ghcr.io/danny-avila/librechat-rag-api-dev-lite:latest
            ports:
                - id: ragapi
                  port: 8000
                  type: HTTP
            env:
                DB_HOST:
                    default: ${POSTGRES_HOST}
                RAG_OPENAI_API_KEY:
                    default: ${OPENROUTER_KEY}
                RAG_OPENAI_BASEURL:
                    default: https://openrouter.ai/api/v1
                RAG_PORT:
                    default: "8000"
        - name: librechat
          icon: https://github.com/danny-avila/LibreChat/raw/638ac5bba61a524cc4ae99711a91f19572c4f2a0/client/public/assets/logo.svg
          template: PREBUILT
          spec:
            source:
                image: ghcr.io/danny-avila/librechat-dev-api:latest
            ports:
                - id: api
                  port: 3080
                  type: HTTP
            volumes:
                - id: images
                  dir: /app/client/public/images
            env:
                ALLOW_REGISTRATION:
                    default: "true"
                CREDS_IV:
                    default: e2341419ec3dd3d19b13a1a87fafcbfb
                CREDS_KEY:
                    default: f34be427ebb29de8d88c107a71546019685ed8b241d8f2ed00c3df97ad2566f0
                HOST:
                    default: 0.0.0.0
                JWT_REFRESH_SECRET:
                    default: jwt-refresh-secret
                JWT_SECRET:
                    default: secret
                JWT_SECRET_KEY:
                    default: jwt-secret-key
                MEILI_HOST:
                    default: http://meilisearch:7700
                MONGO_URI:
                    default: ${MONGO_CONNECTION_STRING}
                NODE_ENV:
                    default: production
                RAG_API_URL:
                    default: http://rag-api:8000
                RAG_PORT:
                    default: "8000"
            configs:
                - path: /app/librechat.yaml
                  template: "# For more information, see the Configuration Guide:\n# https://www.librechat.ai/docs/configuration/librechat_yaml\nversion: 1.1.5\ncache: true\nendpoints:\n  custom:\n    - name: \"OpenRouter\"\n      apiKey: ${OPENROUTER_KEY}\n      baseURL: \"https://openrouter.ai/api/v1\"\n      models:\n        default:\n          - openai/gpt-4o              \n          - anthropic/claude-3-sonnet   \n          - x-ai/grok-4-fast            \n        fetch: true\n      titleConvo: true\n      titleModel: \"current_model\"\n      summarize: false\n      summaryModel: \"current_model\"\n      forcePrompt: false\n      modelDisplayLabel: \"OpenRouter\"\ninterface:\n  privacyPolicy:\n    externalUrl: 'https://librechat.ai/privacy-policy'\n    openNewTab: true\n  termsOfService:\n    externalUrl: 'https://librechat.ai/tos'\n    openNewTab: true\nregistration:\n  socialLogins: ['github', 'google', 'discord', 'openid', 'facebook']\n"
                  permission: null
                  envsubst: null
          domainKey: PUBLIC_DOMAIN
