Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. App Packaging & Development
  3. [Package] Typesense Search Engine - Fast, Typo-Tolerant Search

[Package] Typesense Search Engine - Fast, Typo-Tolerant Search

Scheduled Pinned Locked Moved App Packaging & Development
11 Posts 4 Posters 898 Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • robiR Offline
    robiR Offline
    robi
    wrote last edited by
    #2

    Can you add a bit about how you did your Ghost integration as an example?

    Conscious tech

    1 Reply Last reply
    1
    • Dave SwiftD Offline
      Dave SwiftD Offline
      Dave Swift
      wrote last edited by
      #3

      Sure, i’m using webhooks from Ghost (Settings >Integrations > Custom) to n8n when a post is created, updated, unpublished, or deleted and then n8n updates Typesense.

      1 Reply Last reply
      2
      • Dave SwiftD Offline
        Dave SwiftD Offline
        Dave Swift
        wrote last edited by
        #4

        Will share more later, if you’d like more detail.

        1 Reply Last reply
        2
        • Dave SwiftD Offline
          Dave SwiftD Offline
          Dave Swift
          wrote last edited by Dave Swift
          #5

          More details:

          My integration focuses on two main parts: (1) setting up webhooks in Ghost to trigger real-time sync via n8n to Typesense, and (2) embedding the search UI directly in the Ghost theme for the frontend.

          Ghost Webhook Setup (for Real-Time Sync)

          In Ghost Admin (yourblog.com/ghost/#/integrations), I created a Custom Integration called "Typesense n8n Integration." This gives you a Content API key (used in n8n to fetch full post/page data).

          Then, add webhooks for key events (publish, update, unpublish, delete). Each points to an n8n webhook URL:

          • Post published or Post updated: https://n8n.yourdomain.com/webhook/ghost-typesense
            (n8n workflow: Receives minimal payload with post ID, fetches full data via Ghost Content API /posts/{id}?key=CONTENT_API_KEY&include=tags,authors, transforms to Typesense schema, upserts.)

          • Post unpublished or Post deleted: https://n8n.yourdomain.com/webhook/ghost-typesense-delete
            (n8n: Extracts ID, sends DELETE to Typesense /collections/ghost/documents/{id}.)

          Ghost webhooks send limited data (e.g., just ID/slug), so n8n always fetches the full object. This keeps Typesense updated in near real-time (n8n adds ~30-60s delay, but it's seamless for users).

          For initial bulk sync: Separate n8n workflows paginate Ghost API (/posts/?key=CONTENT_API_KEY&limit=100&page=N&filter=status:published), transform to NDJSON, and bulk import to Typesense with action=upsert.

          Frontend UI Integration in Ghost Theme

          I used the official Typesense InstantSearch Adapter. In your custom theme's default.hbs (head section):

          <script src="https://cdn.jsdelivr.net/npm/typesense-instantsearch-adapter@2/dist/typesense-instantsearch-adapter.min.js"></script>
          <script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
          <script src="{{asset 'js/search.js'}}"></script>  <!-- Custom init script -->
          <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@8/themes/reset-min.css">
          <link rel="stylesheet" href="{{asset 'css/search.css'}}">  <!-- Custom styles -->
          

          In assets/js/search.js, initialize InstantSearch with your search-only Typesense key, query params (e.g., query_by: 'title,excerpt,plaintext,tags.name,authors.name'), and a custom hit template to display tags/authors:

          // Simplified excerpt
          const search = instantsearch({
            indexName: 'ghost',
            searchClient: typesenseInstantsearchAdapter.searchClient
          });
          
          search.addWidgets([
            instantsearch.widgets.searchBox({ container: '.js-search-input' }),
            instantsearch.widgets.hits({
              container: '.js-search-results',
              templates: {
                item: hit => `
                  <article>
                    <h2><a href="${hit.url}">${hit.title}</a></h2>
                    <p>${hit.excerpt}</p>
                    <div>By ${hit.authors?.map(a => a.name).join(', ') || 'Unknown'}</div>
                    <div>${hit.tags?.map(t => `<span class="tag">#${t.name}</span>`).join(' ') || ''}</div>
                  </article>
                `
              }
            }),
            // Add refinementList for facets (tags, authors, type)
          ]);
          
          search.start();
          // Bind to theme's search button/modal
          

          Styles in search.css for cards, facets sidebar, etc. Trigger the modal via a button in your header partial (e.g., <button class="js-search-button">Search</button>).

          This gives full control—e.g., facets for filtering by tags.

          After making changes, Zip your theme and upload it in Ghost Admin and restart Ghost.

          Hope this helps as an example!

          1 Reply Last reply
          6
          • girishG Offline
            girishG Offline
            girish
            Staff
            wrote last edited by
            #6

            @Dave-Swift Looks great! I will add this to our publishing queue . Thanks again.

            1 Reply Last reply
            4
            • jamesJ Offline
              jamesJ Offline
              james
              Staff
              wrote last edited by james
              #7

              Hello @Dave-Swift
              I took the liberty to edit your initial post to add the missing CloudronManifest.json and Icon which is needed for the custom installation.

              1 Reply Last reply
              1
              • Dave SwiftD Offline
                Dave SwiftD Offline
                Dave Swift
                wrote last edited by
                #8

                Thanks James -- I'm confused though as both of those files were included.

                1 Reply Last reply
                0
                • jamesJ Offline
                  jamesJ Offline
                  james
                  Staff
                  wrote last edited by
                  #9

                  @Dave-Swift
                  Yes they are in included in the git repo, indeed.
                  But your code block for copy-paste installing was only:

                  cloudron install --image clientamp/typesense-cloudron:29.0.0 --location $YOUR_CUSTOM_LOCATION
                  

                  Without knowing that one needs the other files locally, just this command will fail the installation.
                  It is just a failsafe to prevent posts like "the provided command failed with xyz" if people simple copy-paste.

                  1 Reply Last reply
                  1
                  • girishG Offline
                    girishG Offline
                    girish
                    Staff
                    wrote last edited by
                    #10

                    @vladimir.d has been cleaning this up. Unfortunately, we hit a road block - https://typesense.org/docs/guide/backups.html#backup-steps . This means Cloudron backup strategy as it is right now won't work since Typesense is like a database.

                    robiR 1 Reply Last reply
                    0
                    • girishG girish

                      @vladimir.d has been cleaning this up. Unfortunately, we hit a road block - https://typesense.org/docs/guide/backups.html#backup-steps . This means Cloudron backup strategy as it is right now won't work since Typesense is like a database.

                      robiR Offline
                      robiR Offline
                      robi
                      wrote last edited by
                      #11

                      @girish why is that a blocker? As it points out it can generate a snapshot from an api call, drop it in /app/data and then you can ignore the data dir during backup since it would be redundant and potentially inconsistent.

                      But even if you leave it, you would just untar that snapshot over it to make it consistent.

                      Conscious tech

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Bookmarks
                      • Search