Deployment guide

Typesense

Overview

Typesense is a fast, open-source, typo-tolerant search engine built for instant, relevant search. It delivers as-you-type full-text search that tolerates spelling mistakes. It also adds semantic and vector search, so results can be ranked by meaning as well as keywords. This makes it a strong backend for site and product search, in-application search bars, and retrieval for AI applications.

This SecureAnyCloud image installs the latest stable Typesense server from the official release and fronts it with an nginx reverse proxy. A unique API key is generated on the first boot of every VM.

What you get:

  • The latest stable Typesense server binary at /opt/typesense, run by an unprivileged typesense account
  • An nginx reverse proxy on :80 in front of the Typesense server (bound to loopback :8108, REST API)
  • A dedicated Azure data disk at /var/lib/typesense that holds the on-disk store, indexes and documents (data-dir), separate from the OS disk and re-provisioned with every VM
  • Secure-by-default access: a strong per-VM API key (TYPESENSE_API_KEY) generated at first boot in a root-only file, with no default login to change
  • An open health endpoint, so load balancers can probe it, while every data endpoint requires the API key
  • typesense.service and nginx.service as systemd units, enabled and active
  • 24/7 SecureAnyCloud support

Prerequisites

  • An active Azure subscription, an SSH key pair, and a VNet and subnet in the target region
  • Standard_B2s (2 vCPU / 4 GiB RAM) as a starting size. Scale up for larger indexes or higher query volume.
  • NSG inbound rules that allow 22/tcp from your management network and 80/tcp from the clients that query Typesense. Front port 80 with TLS for public exposure (see Enabling HTTPS).

Step 1 - Deploy from the Azure Marketplace

Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Typesense by SecureAnyCloud, and select Create. On Basics, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22) and HTTP (80). On the Disks tab, check the dedicated data disk. Then choose Review + create, followed by Create.

Step 2 - Deploy from the Azure CLI

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:typesense-ubuntu-24-04:default:latest
az vm create \
  --resource-group <your-rg> \
  --name typesense \
  --image sac1647283583153:typesense-ubuntu-24-04:default:latest \
  --size Standard_B2s \
  --admin-username azureuser \
  --ssh-key-values ~/.ssh/id_ed25519.pub \
  --vnet-name <your-vnet> --subnet <your-subnet> \
  --public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name typesense --port 80 --priority 1010

Step 3 - Connect to your VM

ssh azureuser@<vm-public-ip>

Step 4 - Confirm the services are running

systemctl is-active typesense.service nginx.service ss -tln | grep -E ':80 |:8108 ' curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1/health

Both services report active. The server listens on loopback 127.0.0.1:8108, nginx listens on :80, and the health endpoint returns 200.

Step 5 - Retrieve your API key

The API key is generated uniquely on the first boot of your VM and written to a root-only file. Print the file with the following command.

sudo cat /root/typesense-credentials.txt

The TYPESENSE_API_KEY value is the key. Callers authenticate by sending it in the X-TYPESENSE-API-KEY header. There is no default key baked into the image, so there is nothing to rotate before you go live.

Step 6 - Call the API and confirm auth is enforced

The health probe is open, and data endpoints require the API key. Read the key into a shell variable, confirm the server version, and confirm that a request without the key is rejected.

KEY=$(sudo grep '^TYPESENSE_API_KEY=' /root/typesense-credentials.txt | cut -d= -f2-)
curl -s -H "X-TYPESENSE-API-KEY: $KEY" http://127.0.0.1/debug | python3 -c "import sys,json; print('version:', json.load(sys.stdin)['version'])" echo "no key -> HTTP $(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1/collections)" echo "with key -> HTTP $(curl -s -o /dev/null -w '%{http_code}' -H "X-TYPESENSE-API-KEY: $KEY" http://127.0.0.1/collections)"

A request to /collections without the key returns 401. With the key, it returns 200.

Step 7 - Create a collection, index a document and run a typo-tolerant search

Create a collection (a schema) and add a document. Then search with a deliberate typo to see Typesense return the right result anyway.

KEY=$(sudo grep '^TYPESENSE_API_KEY=' /root/typesense-credentials.txt | cut -d= -f2-)
curl -s -X POST http://127.0.0.1/collections -H "X-TYPESENSE-API-KEY: $KEY" -H 'Content-Type: application/json' \
  -d '{"name":"books","fields":[{"name":"title","type":"string"}]}' -o /dev/null -w 'create -> HTTP %{http_code}\n'
curl -s -X POST http://127.0.0.1/collections/books/documents -H "X-TYPESENSE-API-KEY: $KEY" -H 'Content-Type: application/json' \
  -d '{"id":"1","title":"The Hitchhiker Guide to the Galaxy"}' -o /dev/null -w 'index -> HTTP %{http_code}\n'
curl -s "http://127.0.0.1/collections/books/documents/search?q=hitchiker&query_by=title" -H "X-TYPESENSE-API-KEY: $KEY" \
  | python3 -c "import sys,json; d=json.load(sys.stdin); print('found:', d.get('found'), '->', d['hits'][0]['document']['title'] if d.get('hits') else None)"

The search query hitchiker is misspelled, yet it still matches The Hitchhiker Guide to the Galaxy, because Typesense corrects typos automatically. Collections and documents you create persist on the dedicated data disk at /var/lib/typesense.

Step 8 - Connect from your application

Point any Typesense client (JavaScript, Python, Go, PHP, Ruby and more) at the VM. Use the VM public IP as the host, port 80, protocol http (or 443 and https once you enable TLS), and the API key from Step 5. Replace <vm-public-ip> and <your-api-key> in the following example.

curl "http://<vm-public-ip>/collections/books/documents/search?q=galaxy&query_by=title" \
  -H "X-TYPESENSE-API-KEY: <your-api-key>"

The install layout keeps the server binary on the OS disk and all search data on the dedicated data disk. An unprivileged service account runs the server.

Enabling HTTPS

For production, terminate TLS at nginx with a real domain pointed at the VM's public IP. Install certbot and request a certificate, replacing the domain in the example.

sudo apt-get update && sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.example.com

certbot edits the nginx site at /etc/nginx/sites-available/sac-typesense to add the TLS listener, and it arranges automatic renewal. Point your client at https://your-domain.example.com and keep sending the API key.

Backup and maintenance

All Typesense data lives on the dedicated data disk at /var/lib/typesense. This includes the on-disk store, indexes and documents. Snapshot that disk in Azure to back up your search data. The API key is in /etc/typesense/typesense-server.ini (api-key).

Keep the OS patched with sudo apt update && sudo apt upgrade. Restart the server with sudo systemctl restart typesense.service. View logs with sudo journalctl -u typesense.service or under /var/log/typesense.

Support

This image is backed by 24/7 SecureAnyCloud support. Contact us by email or chat for help with schema and collection design, semantic and vector search configuration, backups, TLS termination and scaling.

All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

Deploy on Azure

Launch Typesense on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure