README.md

ManyTongues #

ManyTongues is a small web app for turning text into visual word clouds.

It has two main tools:

  • Text Cloud: paste or type any text and the app sizes each word by how often it appears.
  • Translator: enter a short phrase, translate it into many languages, and render those translations as a word cloud.

Both tools let you switch between the Experimental engine (wordcloud2.js, default) and Classic (react-wordcloud).

The app is built with TanStack Start, React, wordcloud2.js, and react-wordcloud.

What The App Does #

Text Cloud #

The text cloud page lets you:

  • paste raw text into a text area
  • optionally filter stopwords and custom exclude lists
  • automatically count repeated words
  • render the most common words as a word cloud (Experimental or Classic engine)
  • customize the cloud with engine-specific style controls
  • download the finished cloud as a PNG image

This is useful for quickly visualizing themes, repeated terms, or the dominant vocabulary in a block of text.

Translator #

The translator page lets you:

  • choose a source language and enter a short phrase
  • translate that phrase into many target languages
  • show the original phrase and its translations together in a word cloud
  • remove individual translations
  • adjust each translation's weight so some languages appear larger or smaller in the cloud
  • retry after a provider or rate-limit error when the server returns a recoverable failure

Translations are looked up in a Turso database first. If the phrase has already been translated before (for the same source language), the cached result is returned. If not, the app requests translations from external translation providers, stores the result, and then displays it.

Server-side rate limiting (per client IP, when DB_URL is set) protects translation APIs from abuse.

Routes #

  • / home page with links to all tools
  • /text-cloud text-to-word-cloud generator (engine switcher: Experimental / Classic)
  • /translate phrase translator and multilingual word cloud (engine switcher: Experimental / Classic)

URL search params #

Search state for the cloud pages is serialized with Zipson (compressed JSON) plus URL-safe base64 in the query string, configured on the router in src/router.tsx. This keeps shareable URLs smaller than plain JSON.

Local Setup #

Install dependencies:

pnpm install

Start the app locally:

pnpm dev

Environment Variables #

The text cloud works without external services. The translator needs API keys and database configuration.

Create a .env file with:

DB_URL=
DB_AUTH_TOKEN=
GOOGLE_TRANSLATE_KEY=
MICROSOFT_TRANSLATE_KEY=

Notes:

  • DB_URL and DB_AUTH_TOKEN are used for the Turso translation cache and for translator rate-limit counters.
  • GOOGLE_TRANSLATE_KEY is the preferred variable for the Google Translate API key. The legacy name GOOGLE_TRANSLSTE is still read as a fallback if GOOGLE_TRANSLATE_KEY is unset.
  • MICROSOFT_TRANSLATE_KEY is used as a fallback translation provider.

Optional (analytics) #

VITE_PUBLIC_POSTHOG_KEY=
VITE_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com

Deploying to Vercel #

The app is configured for Vercel deployment with Nitro. To deploy:

  1. Push your repo to GitHub and import it in Vercel.
  2. Add the environment variables above in Project Settings → Environment Variables.
  3. Deploy. Vercel will auto-detect the Nitro/TanStack Start setup.

The nitro.config.ts sets the Vercel preset and proxies /ingest to PostHog for analytics.

Scripts #

pnpm dev
pnpm build
pnpm preview
pnpm test
pnpm typecheck
pnpm lint
pnpm format
pnpm check
pnpm db:generate
pnpm db:migrate
pnpm db:push
pnpm db:studio

Tech Stack #

  • TanStack Start for the app framework
  • TanStack Router for file-based routing (custom Zipson + base64 search serialization in src/router.tsx)
  • React for UI
  • Tailwind CSS for styling
  • react-wordcloud, d3-cloud, and wordcloud2.js for cloud layout/rendering
  • Drizzle ORM with @libsql/client for Turso persistence
  • Vitest for tests
  • Biome for linting and formatting