PolySearch is a smart search engine proxy that breaks down language barriers. It allows users to search the global web in their native language and receive fully translated results, giving them access to information that was previously hidden behind the "language wall."
This project was built for the Lingo.dev hackathon, demonstrating a full-stack, polyglot microservice architecture.
The internet is dominated by English-language content. This creates an "information inequality" where users searching in other languages may miss out on the best, most relevant resources simply because they aren't in their native tongue.
- Before PolySearch: A user searches in Hindi. They only get results from the small "Hindi internet."
- After PolySearch: A user searches in Hindi. PolySearch translates the query, searches the entire global internet, and translates the top results back to Hindi.
- Multilingual UI (Static i18n): The entire user interface (buttons, slogans, titles) is translated based on the user's preferred language, powered by Lingo.dev CLI-generated JSON files.
- Accessibility: Includes a Speech-to-Text (STT) feature integrated directly into the search bar for hands-free, multilingual input.
- Multilingual Querying: Search in any language (e.g., Hindi, Spanish, etc.).
- Real-Time Translation: The top search results (titles and snippets) are translated back to your original language.
- High-Performance Batching: Optimized to translate all 20 results (title + snippet) in a single API call, reducing latency from ~60 seconds to ~3-5 seconds.
- Microservice Architecture: A robust Spring Boot backend orchestrates a Node.js "sidecar" proxy to handle specialized API communication.
This project uses a polyglot microservice architecture to solve a complex integration challenge.
- Backend: Java 21 & Spring Boot
- Handles all core logic, API orchestration, and serving the frontend.
- Uses Thymeleaf for server-side HTML rendering.
- Frontend: htmx + Tailwind CSS
htmxhandles all server interactions (AJAX) for a fast, modern UI without a single line of client-side JavaScript.Tailwind CSSprovides a professional, "glassmorphism" design.
- Translation Service: Lingo.dev SDK & CLI
- SDK: Used for dynamic, real-time language detection and translation of search results.
- CLI: Used to manage and generate static JSON files for UI localization.
- Search Service: Serper.dev
- Provides Google-quality search results via a REST API.
- Translation Proxy (Sidecar): Node.js + Express
- Why? The Lingo.dev SDK uses gRPC-web, which is not directly compatible with Spring's standard
RestClient. - Solution: A lightweight Node.js "sidecar" proxy was built. This proxy uses the official Lingo.dev SDK (JavaScript) and exposes a simple REST API.
- The Spring Boot app makes a fast, local REST call to this proxy, which then handles the complex gRPC-web communication. This is a standard pattern for integrating incompatible technologies.
- Why? The Lingo.dev SDK uses gRPC-web, which is not directly compatible with Spring's standard
This project has two parts: the Java Spring Boot server and the Node.js proxy. Both must be running.
- Java JDK 21
- Node.js 18 or newer
- An API key from Serper.dev
- An API key from Lingo.dev
-
Backend (Java): Create a file at
src/main/resources/application-secrets.propertiesand add your Serper key:serper.api.key=YOUR_SERPER_API_KEY_HERE serper.api.url=[https://google.serper.dev/search](https://google.serper.dev/search)
-
Lingo.dev Keys (Root & Proxy):
- Create a file at the project root named
.envfor the CLI. - Create a file at
lingo-proxy/.envfor the Node.js server. - Both files must contain:
LINGO_API_KEY=YOUR_LINGO_API_KEY_HERE - Create a file at the project root named
Before running the app, you must generate the initial UI translation files.
- Create the master English file at
i18n/en.json(contains all UI keys likeheader.title). - In the project root, run the CLI:
This will generate the target files (e.g.,
npx lingo.dev@latest run
es.json,hi.json).
You can run both servers manually or use the included VS Code launch.json to run them with one click (F5).
A) The Manual Way (Two Terminals)
Terminal 1: Start the Lingo.dev Proxy
# Navigate to the proxy folder
cd lingo-proxy
# Install dependencies (only once)
npm install
# Start the server
node server.jsTerminal 2: Start the Spring Boot App
./mvnw spring-boot:run
... Tomcat started on port(s): 8080 (http) ...
http://localhost:8080
⚡ API Endpoint (Advanced) While the main application is the htmx web UI, the Spring Boot backend also exposes a raw JSON API. You can test this directly using a tool like Postman, Insomnia, or cURL.
http://localhost:8080/api/v1/search
Example JSON Body (for Postman)
{
"query": "मुफ्त जावा कोर्स"
}
Example Success Response (JSON)
[
{
"title": "जावा ट्यूटोरियल: जावा प्रोग्रामिंग सीखें",
"snippet": "मुफ्त कोर्स! प्रोग्रामर्स के लिए जावा। अनुभवी प्रोग्रामर्स के लिए बनाया गया यह कोर्स...",
"url": "[https://www.codecademy.com/learn/learn-java](https://www.codecademy.com/learn/learn-java)"
},
{
"title": "बिल्कुल नौसिखियों के लिए सर्वश्रेष्ठ मुफ्त जावा कोर्स : r/learnjava",
"snippet": "हम हेलसिंकी विश्वविद्यालय से MOOC की सिफारिश करते हैं। यह एक पाठ्य कोर्स है...",
"url": "[https://www.reddit.com/r/learnjava/comments/](https://www.reddit.com/r/learnjava/comments/)..."
}
]
AI assitance disclosure : I used AI tools for help with certain parts of the project- mainly for clarifying concepts, and generating code snippets for the technology i was learning for the first time. All AI generated suggestions were reviewed, tested, and integrated by me. the core idea architecture logic final implementaion are my own.