Instantly break down language barriers! Kodo Chat provides seamless, real-time, AI-powered translation directly within a simple web-based chat interface. Connect with anyone, anywhere, regardless of the language they speak.
This project demonstrates the use of Node.js, Socket.IO, React Native (with Expo for web), Redis, and the OpenAI API to create a functional multilingual chat application.
Live Demo: https://kodo-frontend.onrender.com/ (Replace with your actual Render frontend URL if different)
- Real-Time Translation: Messages are translated instantly using OpenAI's powerful language models (defaults to
gpt-4o). - Multi-Language Support: Users select their preferred language upon joining.
- Easy Connection: Start a chat and share a unique QR code or invite link with your partner.
- Typing Indicator: See when your chat partner is actively typing.
- Simple Interface: Clean chat interface built with React Native Paper.
- WebSocket Communication: Uses Socket.IO for efficient real-time messaging.
- Session Management: Redis is used to manage connection tokens and active chat rooms.
- Frontend:
- React Native (via Expo)
- Expo Router
- React Native Paper (UI Components)
- Socket.IO Client
i18n-js&expo-localization(Localization)date-fns(Timestamps)expo-clipboard(Copy Link)
- Backend:
- Node.js
- Express
- Socket.IO
- Redis (
ioredis) - OpenAI Node Library
dotenv
- Infrastructure:
- Render.com (or adaptable to other platforms like Railway, Docker)
- Managed Redis (Render Redis, Railway Redis, etc.)
- OpenAI API
kodo/
├── backend/ # Node.js backend code
│ ├── src/
│ │ └── server.js # Main backend logic
│ ├── .env.example # Example environment variables
│ └── package.json
├── frontend/ # Expo (React Native web) frontend code
│ ├── app/ # Expo Router screens (index, generate, join)
│ ├── assets/ # Static assets (icons, images)
│ ├── components/ # Shared UI components (if any)
│ ├── context/ # React Context (SocketContext)
│ ├── translations/# Localization files
│ │ ├── en.json
│ │ ├── es.json
│ │ └── ... (other languages)
│ │ └── i18n.config.ts # i18n setup
│ ├── .env.example # Example environment variables
│ ├── app.json # Expo config
│ └── package.json
├── .gitignore
├── package.json # Root package file (for workspace commands)
└── README.md # This file
- Node.js (LTS version recommended)
- npm
- Docker (for running Redis easily) or a locally installed Redis instance
- An OpenAI API Key
- Clone the repository:
git clone https://github.com/jonathanleane/kodo.git cd kodo - Install Root Dependencies:
npm install
- Install Backend Dependencies:
cd backend npm install - Configure Backend Environment:
- Copy
.env.exampleto.envwithin thebackenddirectory. - Edit
backend/.envand add yourOPENAI_API_KEY. - Ensure
DATABASE_URLis set for your local Redis (default:redis://localhost:6379).
- Copy
- Install Frontend Dependencies:
cd ../frontend npm install - Configure Frontend Environment:
- Create a
.envfile in thefrontenddirectory. - Add the following lines:
EXPO_PUBLIC_BACKEND_URL=http://localhost:3001 EXPO_PUBLIC_FRONTEND_URL=http://localhost:8081 # Or your Expo web port
- For Mobile QR Testing: Replace
localhostinEXPO_PUBLIC_FRONTEND_URLwith your computer's local network IP address (e.g.,http://192.168.1.100:8081).
- Create a
- Start Redis:
- Using Docker:
docker run -d -p 6379:6379 --name kodo-redis redis(ordocker start kodo-redisif it exists). - Or start your native Redis instance.
- Using Docker:
- Start Backend:
- Open a terminal in the
backenddirectory. - Run:
npm run start:full(usesserver.js)
- Open a terminal in the
- Start Frontend:
- Open a new terminal in the
frontenddirectory. - Run:
npm run web(ornpx expo start --web) - This should open the app in your browser at
http://localhost:8081(or the port specified).
- Open a new terminal in the
See the detailed steps outlined in the conversation history or adapt for your preferred platform.
Key steps for Render:
- Create a Redis instance (copy Internal URL).
- Create a Web Service for the backend:
- Repo:
jonathanleane/kodo - Root Dir:
backend - Build:
npm install - Start:
node src/server.js - Env Vars:
DATABASE_URL(from Redis),OPENAI_API_KEY,NODE_ENV=production.
- Repo:
- Create a Static Site for the frontend:
- Repo:
jonathanleane/kodo - Root Dir:
frontend - Build:
npm install && npx expo export - Publish Dir:
frontend/dist - Add Rewrite Rule: Source
/*, Destination/index.html. - Env Vars (Build Time):
EXPO_PUBLIC_BACKEND_URL(Backend Service URL),EXPO_PUBLIC_FRONTEND_URL(This Static Site URL).
- Repo:
Contributions are welcome! Please feel free to submit issues or pull requests.
This project is licensed under the ISC License - see the LICENSE file for details (Note: No LICENSE file currently exists, using standard ISC text).