---
title: "Deploy Typesense CJK"
description: "Chinese, Japanese and Korean search with locale tokenizing"
category: "Analytics"
url: https://railway.com/deploy/deploy-typesense-cjk-search-on-railway
---

# Deploy Typesense CJK

Chinese, Japanese and Korean search with locale tokenizing

**[Deploy Typesense CJK on Railway](https://railway.com/template/deploy-typesense-cjk-search-on-railway)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-typesense-cjk-search-on-railway/manifest.json

- **Creator:** onepush
- **Category:** Analytics

## Template content

### typesense-railway

- **Source:** Shinyduo/typesense-railway
- **Public domain:** Yes

## Documentation

# Deploy and Host self hosted Typesense CJK (CJK Instant Search) on Railway

This Railway template deploys Typesense CJK from Shinyduo/typesense-railway: Typesense 30 behind Caddy. Set per-field locales like zh, ja, or ko for CJK tokenization without space splitting. It suits developers who need instant CJK search without a separate segmenter.

## About Hosting Typesense CJK open-source software on Railway (self hosted Typesense template)

This Railway template builds from the Shinyduo/typesense-railway repo: a Typesense 30 image plus a Caddy proxy on Railway's PORT 8080, forwarding to Typesense on 127.0.0.1:8118. Your zh, ja and ko collection schemas, ICU tokenizers and indexes stay in your Railway volume, so search data stays yours.

## Why Deploy Typesense CJK, the Algolia alternative on Railway (Railway Free Trial)

Algolia bills per search request and stored record, and cannot be self-hosted. Self-hosting Typesense CJK on Railway gives full control over zh, ja, and ko locale tokenization for just Railway compute and volume; Railway's $5 trial credit covers testing CJK segmentation.

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Typesense CJK on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

### Railway vs Other Hosting Providers and VPS for Typesense CJK self hosting

CJK search hosting is mostly about how much glue you want to maintain.

| Provider | What You Get with Railway | What You Get with the Other Provider |
|---|---|---|
| DigitalOcean | Managed volume + Caddy HTTPS proxy; no firewall or cert work. | Raw droplet, wire mounts, ports, certs yourself. |
| AWS | Handles health checks and rolling deploys without IAM or security groups. | EC2/Lightsail bare VMs you fully configure, more setup. |
| Hetzner | Hourly billing, private URL, one-command rollbacks. | Cheaper raw compute, but you run reverse proxy and backups. |

## Common Use Cases for hosted Typesense CJK

- **Product search** - one collection with title_zh, title_ja, title_ko lets you query_by the shopper's language without three indexes; pre_segmented_query swaps in a custom splitter.
- **Japanese docs search** - set locale ja on body fields so kanji-kana queries match without spaces; add synonyms and test half-width vs full-width input.
- **Community forums** - enable CORS and issue scoped search-only keys from /keys so browser InstantSearch clients query zh, ja, or ko fields without exposing your admin key.
- **Mobile autocomplete** - Korean agglutination needs ko locale on title and body, otherwise the field uses en tokenization; size RAM to hold indexes since Typesense is in-memory.

## Dependencies for Typesense CJK Docker hosted on Railway

The Railway service runs a Caddy reverse proxy in front of Typesense 30, so the only public port is 8080. Replace TYPESENSE_API_KEY immediately after deploy and mint scoped search-only keys for browsers later.

### Deployment Dependencies for Managed Typesense CJK Service (CJK Search)

Built from Shinyduo/typesense-railway: Typesense 30 plus Caddy on PORT 8080 forwarding to 127.0.0.1:8118. Add TYPESENSE_ENABLE_CORS=true only for browser InstantSearch clients.

### Implementation Details for Typesense CJK (Using Typesense official docker image)

For CJK, set locale per string field (zh, ja, ko); no locale means en space-separated. Typesense uses ICU to segment CJK without spaces. One doc can carry title_zh, title_ja, title_ko and query_by the right field. Test short queries and half-width vs full-width. Changing a locale requires dropping and re-adding the field.

## How does Typesense CJK compare against other Multilingual and CJK search engines platforms

### Typesense CJK vs Algolia (Algolia Alternative)

- **Self-host and locale control:** Algolia is SaaS-only; Typesense CJK on Railway keeps data in your infra. You set per-field locales like zh, ja, ko and see ICU segmentation. Algolia wins on managed relevance tuning.
- **Cost:** Typesense CJK bills by Railway compute, not per search; a small CJK index costs single-digit to low-teens USD/month. Algolia charges per operation and records, which adds up fast.

### Typesense CJK vs Meilisearch (Meilisearch Alternative)

- **Mixed-language documents:** Typesense CJK lets one document carry title_zh, title_ja, title_ko with different locales, then query_by the user's language. Meilisearch detects languages automatically, with localizedAttributes to pin them. Meilisearch wins on typo tolerance defaults.
- **Custom segmentation:** Typesense CJK supports pre_segmented_query=true, so you run your own Chinese word splitter. Meilisearch relies on its built-in tokenizer.

### Typesense CJK vs Elasticsearch (Elasticsearch Alternative)

- **Operational weight:** Elasticsearch ICU analyzers are solid, but you run a JVM cluster. Typesense CJK is a single in-memory binary on Railway with simple env vars. Elasticsearch wins for huge scale or custom scoring.
- **Schema changes:** Changing a field's locale means dropping and re-adding it, then reindexing. Typesense CJK makes that explicit and fast on small datasets.

### Typesense CJK vs OpenSearch (OpenSearch Alternative)

- **Same tradeoffs as Elasticsearch:** OpenSearch inherits ICU and Kuromoji, but you manage cluster state and disk. Typesense CJK keeps the index in RAM for predictable latency on a small VPS.
- **VPS cost:** Typesense needs RAM sized to the index, which suits modest catalogs. OpenSearch uses disk and page cache, cheaper for huge archives but less predictable for instant search.

## How to use Typesense CJK (the OSS CJK Search)?

1. After Railway deploys Caddy on port 8080, set a long TYPESENSE_API_KEY. Add TYPESENSE_ENABLE_CORS=true for browser calls.
2. Create a collection and set locale per string field: {name: 'title_ja', type: 'string', locale: 'ja'}. Use zh, ja, ko; no locale means English tokenizing.
3. For mixed docs, add title_zh, title_ja, title_ko and query_by the user's language field. Typesense uses ICU to segment CJK without spaces.
4. To use your own segmenter, set pre_segmented_query: true and split on spaces at index and query time.
5. Test one- and two-character queries, half vs full-width, and synonyms. Changing a field's locale requires dropping and reindexing.

## How to self host Typesense CJK on other VPS Services (Typesense CJK self hosting guide)

### Clone the Repository

Clone the repo; its Dockerfile bundles Typesense 30 with a small Caddy reverse proxy.
```bash
git clone https://github.com/Shinyduo/typesense-railway.git
cd typesense-railway
```

### Install Dependencies

You only need Docker. Build the image with `docker build -t typesense-caddy .`; a persistent volume is the sole external requirement.

### Configure Environment Variables

Set `TYPESENSE_API_KEY` to a long random value, `TYPESENSE_DATA_DIR=/data` (on Railway it points at the volume), and `PORT=8080`. Caddy listens on 8080 and forwards to Typesense on 127.0.0.1:8118. CJK locale is per field in the collection schema, not an env var.

### Start the Typesense CJK Application

Run it with `docker run -d -p 8080:8080 -v ts-data:/data --env-file .env typesense-caddy`, then check `http://127.0.0.1:8080/health`. Then create a collection with fields like `title_zh` (locale `zh`), `title_ja` (locale `ja`), and query_by the right field. On a VPS you add TLS yourself; Railway handles it for you.

## Official Pricing of Typesense CJK (Typesense CJK pricing)

Typesense CJK is open source under GPL-3.0, so the software is free; you pay only for infrastructure. On Railway, a small node typically runs single-digit to low-teens USD per month (compute plus volume). Railway's $5 trial credit covers initial CJK tokenization experiments.

## Typesense CJK cloud vs self hosted comparison (Pricing, features, costs, and more)

Self-hosting Typesense CJK on Railway keeps your Chinese, Japanese and Korean indexes off per-search fees. The trade-off is you own the RAM and the reindexes.

### Monthly cost of self hosting Typesense CJK on Railway

You pay Railway compute plus the volume for your data. A small Typesense node lands in the single-digit to low-teens USD per month, with the $5 trial credit covering the first stretch.

### System Requirements for Hosting Typesense CJK on a VPS

Typesense keeps the index in memory, so size RAM to your dataset, not disk. CJK locales add ICU segmentation overhead, so leave headroom for mixed kanji and kana queries.

## Frequently Asked Questions (FAQs)

### How do I set up separate Chinese, Japanese, and Korean fields in one collection?

Add three string fields with locales `zh`, `ja`, `ko`, like `title_zh`, `title_ja`, `title_ko`. Query the matching field.

### What happens if I forget to set a locale on a CJK field?

The field defaults to `en` tokenization, expecting spaces. A run of CJK text is indexed as one long token, so partial-word queries miss. Always set a locale.

### Can I use my own Chinese word segmenter instead of Typesense's built-in tokenization?

Set `pre_segmented_query=true` and run your own segmenter at index and query time. Both must match.

### Do synonyms help with variant spellings or mixed script CJK queries?

They help with simplified vs traditional Chinese and half-width vs full-width. Test short one- and two-character queries.

### Why can't I change a field's locale after importing data?

Locale affects tokenization, so you must drop and re-add the field and reindex. Decide before big imports.

### Do I need to enable CORS for browser InstantSearch clients on this Railway template?

No CORS by default. Set `TYPESENSE_ENABLE_CORS=true` and use scoped search-only keys from `/keys`.


## Similar templates

- [Typesense Multilingual](https://railway.com/deploy/deploy-typesense-multilingual-search) — Locale-aware multilingual search with Typesense
- [Formbricks | Open-Source Typeform & Qualtrics Alternative](https://railway.com/deploy/formbricks-surveys) — Surveys, NPS and in-app feedback on your own Postgres, Hub and Cube
- [Typesense PHP](https://railway.com/deploy/typesense-php) — official PHP client against Railway

Open this page in a browser: https://railway.com/deploy/deploy-typesense-cjk-search-on-railway
