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
15 Posts 5 Posters 1.3k Views 6 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.
  • Dave SwiftD Offline
    Dave SwiftD Offline
    Dave Swift
    wrote on last edited by james
    #1

    Hi Cloudron community!

    I've created a Typesense Cloudron package that provides lightning-fast, typo-tolerant search functionality. Typesense is an open-source alternative to Algolia and an easier-to-use alternative to ElasticSearch.

    Installation

    You'll need the Cloudron CLI to install this. Here's the command:

    # Clone the repository from source https://github.com/clientamp/typesense-cloudron
    git clone https://github.com/clientamp/typesense-cloudron.git && cd typesense-cloudron
    # Install Typesense Search Engine with dockerhub image clientamp/typesense-cloudron:29.0.0
    # change $YOUR_CUSTOM_LOCATION to e.g. typesense
    cloudron install --image clientamp/typesense-cloudron:29.0.0 --location $YOUR_CUSTOM_LOCATION
    

    What You Get

    • Fast search with sub-second response times
    • Typo tolerance - finds results even with spelling mistakes
    • Auto-generated API keys with secure defaults
    • CORS support for web application integration
    • Health checks and monitoring for production use
    • Automatic backups through Cloudron

    Perfect For

    E-commerce sites, documentation, content management, user directories - basically any application that needs fast, intelligent search.

    I'm using it on my Ghost website now, see it in action: daveswift.com (it's a big upgrade over Ghost's native search!)

    Requirements

    • Cloudron 7.0.0 or higher
    • Minimum 512MB RAM (1GB+ recommended for production)

    How It Works

    The package automatically generates secure API keys, sets up data directories, and configures everything needed for production use. You can then create search collections via REST API and integrate with any programming language.

    Why Typesense?

    It's simpler than ElasticSearch to set up and use, provides an open-source alternative to Algolia with no vendor lock-in, and includes real-time updates and typo tolerance out of the box.

    Getting Started

    Once installed, check out the Typesense API documentation for examples of creating collections, adding documents, and performing searches.

    Docker Hub

    Repository: https://hub.docker.com/r/clientamp/typesense-cloudron
    Image: clientamp/typesense-cloudron:29.0.0

    GitHub

    Repository: https://github.com/clientamp/typesense-cloudron

    This package has been tested and as I mentioned, is currently running in production on my Cloudron instance.

    1 Reply Last reply
    7
    • Dave SwiftD Dave Swift referenced this topic on
    • robiR Offline
      robiR Offline
      robi
      wrote on 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 on 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 on 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 on 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 on 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 on 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 on 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 on 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
                        • nebulonN Offline
                          nebulonN Offline
                          nebulon
                          Staff
                          wrote last edited by
                          #12

                          the blocker here is, that Cloudron has no way currently to trigger app internal scripts at the point of creating a backup. For database addons, there are special hooks to do so. For sqlite (which is using /app/data via localStorage addon) we have added specific code to issue a db dump. So something like this is required for typesense also then.

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

                            To add to what @nebulon said, I think the api call requires a token as well . So, the platform code cannot call a http route and there is no CLI either afaict (for all the db tools, we use CLI).

                            1 Reply Last reply
                            2
                            • robiR Offline
                              robiR Offline
                              robi
                              wrote last edited by
                              #14

                              Sounds like a useful enhancement then.

                              Conscious tech

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

                                Hi @girish, @nebulon, and team,

                                I've updated the Typesense package to address the backup roadblock from the docs (https://typesense.org/docs/guide/backups.html#backup-steps). This should make it compatible with Cloudron's strategy for database-like apps.

                                Key changes in v29.0.1:

                                • Added "localstorage" addon for persistent /app/data (includes DB files and snapshots).
                                • Defaulted data-dir to /app/data in start.sh.
                                • Added backup.sh to trigger a full server snapshot via /operations/snapshot API, saving to snapshots/latest.tar (relative to /app/data). It backs up all collections automatically and checks for success.
                                • Added restore.sh to untar latest.tar on startup if present, ensuring consistent restores.
                                • Improved logging for the API key in start.sh.

                                Tested on my live install (search.daveswift.com with existing collections)—backup creates the snapshot file, and restore loads it on restart without issues. The snapshot is a complete dump of all data, per Typesense docs.

                                Repo: https://github.com/clientamp/typesense-cloudron (changes on main, see CHANGELOG.md). Latest image: clientamp/typesense-cloudron:29.0.1 (or timestamped builds like 20250929-111100).

                                For integration, Cloudron could run backup.sh via a hook before filesystem backup, then ignore raw DB files. Happy to add more (e.g., compression).

                                Thanks!

                                1 Reply Last reply
                                4
                                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