DEV Community

Cover image for How I Built a Multilingual AI Fitness Coach with Gemini and 90+ Languages
Aman singh
Aman singh

Posted on

How I Built a Multilingual AI Fitness Coach with Gemini and 90+ Languages

How I Built a Multilingual AI Fitness Coach with Gemini and 90+ Languages

Building an AI fitness coach is one thing.

Building one that can communicate with users across 90+ languages, understand fitness-related questions, respond naturally, and also support voice interaction was a much more interesting challenge.

For my fitness project ASFORGE FITNESS, I wanted to go beyond a traditional chatbot.

So I built Titan AI Coach โ€” a multilingual AI fitness assistant powered by Google Gemini, React, JavaScript, and a Node.js backend.

In this article, I'll explain how I approached the multilingual AI system and how the different parts work together.

๐Ÿค– What is Titan AI Coach?

Titan AI Coach is the AI assistant inside my fitness platform.

The goal was to make it feel more like a digital fitness coach rather than a simple text chatbot.

It can help users with things like:

๐Ÿ‹๏ธ Workout guidance
๐Ÿฅ— Nutrition-related questions
๐Ÿ’ช Exercise guidance
๐Ÿ“‹ Fitness routines
๐Ÿ’ฌ General fitness conversations
๐ŸŒ Multilingual conversations
๐ŸŽ™๏ธ Voice interaction

The project combines an interactive frontend with a backend AI service.

๐ŸŒ Why 90+ Languages?

One of the biggest ideas behind this project was accessibility.

A fitness assistant shouldn't be limited to English users.

Different users are comfortable communicating in different languages, so I wanted Titan to support a large number of languages.

The application maintains a language list and allows the user to select their preferred language.

The selected language becomes part of the AI interaction so that the response can be generated in the user's chosen language.

For example, a user can interact using languages such as:

English
Hindi
Spanish
French
German
Japanese
Portuguese
Italian

โ€ฆand many more.

The exact supported language list is maintained by the application rather than hard-coding a small number of languages.

๐Ÿง  Using Gemini as the AI Brain

For the AI responses, I used Google Gemini.

The basic architecture looks like this:

User
โ†“
React Frontend
โ†“
Titan AI Coach
โ†“
Node.js / Express Backend
โ†“
Google Gemini API
โ†“
AI Response
โ†“
React UI

The important part is that the Gemini API key is not exposed directly in the frontend.

Instead, the frontend communicates with my backend, and the backend communicates with Gemini.

This keeps the API credential on the server side.

โš›๏ธ React Frontend

The frontend is built with React.

The AI Coach UI handles:

User messages
AI responses
Language selection
Chat history
Loading states
Voice interaction
Error handling

The frontend sends the user's request to the backend instead of directly calling Gemini.

A simplified version of the flow looks like:

const response = await fetch("/api/chat", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
message,
language
})
});

const data = await response.json();

The backend then processes the request and sends the AI response back to React.

๐ŸŸข Node.js + Express Backend

I used Node.js with Express as the backend layer.

The backend is responsible for:

Receiving the user's message
Receiving the selected language
Preparing the Gemini request
Calling the Gemini API
Handling errors
Returning the response to the frontend

This separation also makes the application easier to maintain.

Instead of putting everything inside the React application, the AI logic stays behind the backend API.

๐ŸŒ Language Switching

The user can select a language from the AI Coach interface.

The selected language is then passed to the backend.

Conceptually:

Selected Language
โ†“
User Message
โ†“
Backend
โ†“
Gemini
โ†“
Response in Selected Language

This means the same AI Coach can be used by users with different language preferences without creating a separate chatbot for every language.

๐ŸŽ™๏ธ Adding Voice Interaction

I also wanted Titan to support voice interaction.

For this, the browser's speech capabilities are used for voice input and speech output.

The basic experience is:

User speaks
โ†“
Speech Recognition
โ†“
Text
โ†“
Gemini AI
โ†“
AI Response
โ†“
Speech Synthesis
โ†“
User hears response

This makes the interaction more natural than typing every question.

It also makes the AI Coach feel closer to an actual digital assistant.

๐Ÿ”„ Retry and Fallback Handling

AI APIs can sometimes fail because of temporary network problems, rate limits, or service issues.

Instead of immediately showing an error to the user, I added retry and fallback handling to make the experience more reliable.

The general flow is:

Request
โ†“
Gemini API
โ†“
Success? โ”€โ”€ Yes โ†’ Return Response
โ”‚
No
โ†“
Retry
โ†“
Success? โ”€โ”€ Yes โ†’ Return Response
โ”‚
No
โ†“
Fallback / Error Message

This is especially useful for a user-facing application where a temporary API issue shouldn't completely break the interface.

๐Ÿ” Keeping API Keys Secure

One of the most important lessons while building this project was never exposing private API keys in frontend code.

For example, sensitive keys should not be hard-coded like this:

const API_KEY = "YOUR_SECRET_KEY";

Instead, sensitive credentials are stored in environment variables on the backend.

For example:

GEMINI_API_KEY=your_secret_key

The frontend talks to the backend, and the backend uses the secret key.

This is much safer than exposing the key to every browser user.

๐Ÿ‹๏ธ Making the AI Fitness-Specific

Titan isn't designed as a completely generic chatbot.

The project is a fitness platform, so the AI experience is designed around fitness-related conversations.

The surrounding website provides context through features such as:

Workout routines
Diet routines
Exercise demonstrations
Fitness tracking
Premium fitness plans
AI coaching

The idea is to make the AI part of the complete fitness experience instead of having an unrelated chatbot sitting on a fitness website.

๐Ÿงฉ Technologies Used

Here are the main technologies behind this project:

Technology Purpose
React Frontend UI
JavaScript Application logic
Vite Frontend development/build
Node.js Backend runtime
Express API server
Google Gemini AI responses
Browser Speech APIs Voice interaction
Three.js 3D/interactive experience
Supabase Application data/backend services
๐Ÿšง Challenges I Faced

Building this system wasn't just about connecting an AI API.

Some of the challenges included:

  1. Multilingual responses

Supporting many languages required a clean way to manage language selection and pass that information through the AI request.

  1. API failures

Temporary failures required retry and fallback handling.

  1. Voice interaction

Speech recognition and speech synthesis behave differently across browsers, so voice features need careful handling.

  1. Security

Keeping API credentials away from frontend code was another important part of the architecture.

  1. User experience

The AI shouldn't feel like a plain API response.

The goal was to make Titan feel integrated with the rest of the fitness platform.

๐Ÿ”ฎ What's Next?

The project is still evolving.

Some of the areas I'm working toward include:

Better AI fitness conversations
More personalized coaching
Improved voice interaction
Better workout recommendations
User progress integration
More intelligent fitness guidance
Further improvements to the multilingual experience
Mobile application expansion

The long-term goal is to turn the project into a more complete AI-powered fitness platform.

๐Ÿ’ก What I Learned

This project taught me that building an AI application is not only about calling an AI API.

A good AI product also needs:

A clean frontend
Secure backend architecture
Error handling
Good user experience
Voice interaction
Language support
Reliable API communication
Proper separation between frontend and backend

The AI is only one part of the complete system.

๐Ÿš€ Final Thoughts

Titan AI Coach started as an idea to add an AI assistant to my fitness website.

It gradually became a much bigger experiment involving AI, multilingual communication, voice interaction, React, Node.js, Three.js and backend architecture.

The most interesting part for me was seeing a fitness assistant communicate across many different languages while remaining part of the same application.

I'm continuing to improve ASFORGE FITNESS and experiment with new ways to combine AI with fitness technology.

Thanks for reading! โค๏ธ

If you're also building AI-powered applications, I'd love to hear what you're working on.

๐Ÿ”— Project

ASFORGE FITNESS โ€” AI-Powered Fitness Platform

Built with React โ€ข JavaScript โ€ข Gemini AI โ€ข Node.js โ€ข Three.js

Top comments (0)