Purpose: I built this project to cement what I had learned about using the OpenAI library, making API calls to the 'chat' and 'response' endpoints, the difference between 'zero-shot' and 'few-shot' prompting, the impact of 'temperature' and 'stop-sequences', as well as 'frequency penalties' and 'presence penalties', through Scrimba's "Intro to AI Engineering" course in the "AI Engineer Path".
Function: Concise, AI-powered language lessons for travellers, students, or professional pollyglots. Users can choose from 12 languages: Arabic, Australian (a lighthearted Easter Egg), Chinese, Dutch, French, German, Hebrew, Italian, Japanese, Portuguese, Spanish, and Urdu.
Live Link: https://project-pollyglot.vercel.app/
App Files: project-pollyglot/pollyglot-app/
OpenAI no longer offers $5 in credit to new users, but I highly recommend making the investment over free options like Gemini API. In addition to the excellent documentation:
- The Fine-Tuning tool allows you to, using either the GUI or API, create fine-tuning jobs from JSONL datasets and use your saved models. It offers less control and deployment options compared to alternatives than SageMaker AI, but is still quite powerful if you're just getting started.
- The OpenAI Playground allows you to do 'back-of-the-napkin' model evals and experiment with different models (including your own fine-tuned models!) by saving your parameters in unique code snippets
- For more methodical evals, you can use the Model Evaluation tool and by referencing the eval documentation here as well as the model optimization docs here
If you're dead-set on a no-cost alternative, you can use the Gemini API OpenAI compatibility option. I've compiled some quickstart guides and working API calls in these files (located in docs/ and gemini-alt/):
Quickstart Guides
Sample API Calls
AI Usage: For this project, I really made an effort to use AI as little as possible. I also turned off tab-complete and React snippets. It came at the cost of less intricate design, but paid back in full in the form of my own sanity and helping me remember that I'm still capable of writing a full stack React/Node app without it.
I used AI to generate the README.md file, and to ask for clarification on dependencies, CORS configuration, and to debug the server setup, but I did not use AI to generate any of the actual code for this project. The code is quite simple, and mostly solidifies what I have been learning through The Odin Project and Full Stack Open.
Starter Files: The starter files provided for this project included empty index.html, index.js, and index.css files, as well as 5 images for the flags of France, Japan, Spain, a parrot logo, and a world map. While Figma design template was provided, I opted for a more minimalist approach.
App Function: Pollyglot is an AI-powered language learning application that helps users practice and learn new languages through interactive translation. Built with React and powered by OpenAI's GPT models, it provides instant translations and language learning assistance.
- Frontend: React, Vite
- Backend: Node.js, Express (or Cloudflare Workers for lightweight alternative)
- AI: OpenAI Models (or Gemini via the Gemini )
- Styling: External CSS
- Node.js (v16 or higher)
- npm or yarn
- OpenAI API key
This project supports two development setups:
- Full-Stack Local Server: Run the React client and a Node.js/Express backend on your machine. This is ideal for developing and testing the backend server logic.
- Client with Cloudflare Worker: Run the React client locally and connect to a deployed Cloudflare Worker for API calls. This is a more lightweight setup that mirrors a serverless production environment.
- Fork + Clone the repository
git clone git@github.com:[YOUR-USERNAME]/ai-eng-build-with-me.git
cd ai-eng-build-with-me/project-pollyglot/pollyglot-app- Install dependencies
# Install root dependencies
npm install
# Install server dependencies
cd server
npm install
cd ..- Environment Setup
- Create a
.envfile in theserverdirectory - Add your OpenAI API key:
OPENAI_API_KEY=your_api_key_here PORT=3001
- Start the backend server
cd server
npm start- Start the frontend development server (in a new terminal)
# From the project root
npm run dev- Open your browser and navigate to
http://localhost:5173
Note: For this setup, ensure the
fetchrequest insrc/components/Content.jsxpoints to your local server:http://localhost:3001/api/chat.
Follow these steps to set up the frontend client with a deployed Cloudflare Worker.
-
Set up the Frontend
- Follow steps 1 and 2 from the Installation section under Option 1 to clone the repo and install the root dependencies.
-
Set up the Cloudflare Worker
- The
/pollyglot-cloudflare-workerdirectory contains the source code for the worker. - You will need a Cloudflare account and the
wranglerCLI installed and configured.
# Install worker dependencies cd pollyglot-cloudflare-worker npm install # Save your OpenAI API key as a secret npx wrangler secret put OPENAI_API_KEY # Deploy the worker npx wrangler deploy
- The
-
Configure and Run the Frontend
-
In
src/components/Content.jsx, update thefetchURL to your deployed Cloudflare Worker's URL. -
Start the frontend development server from the root directory:
npm run dev
-
.
├── .gitignore
├── README.md
├── eslint.config.js
├── figma-template.md
├── index.html
├── package.json
├── pollyglot-cloudflare-worker
│ ├── .editorconfig
│ ├── .gitignore
│ ├── .prettierrc
│ ├── .vscode
│ │ └── settings.json
│ ├── .wrangler
│ │ ├── state
│ │ │ └── v3
│ │ │ ├── cache
│ │ │ │ └── miniflare-CacheObject
│ │ │ └── workflows
│ │ └── tmp
│ ├── package.json
│ ├── src
│ │ └── index.js
│ ├── test
│ │ └── index.spec.js
│ ├── vitest.config.js
│ └── wrangler.jsonc
├── public
├── server
│ ├── .env
│ ├── index.js
│ └── package.json
├── src
│ ├── App.css
│ ├── App.jsx
│ ├── assets
│ │ ├── arabic.webp
│ │ ├── australian.webp
│ │ ├── chinese.webp
│ │ ├── dutch.webp
│ │ ├── french.webp
│ │ ├── german.webp
│ │ ├── hebrew.webp
│ │ ├── italian.webp
│ │ ├── japanese.webp
│ │ ├── portuguese.webp
│ │ ├── spanish.webp
│ │ ├── urdu.webp
│ │ └── worldmap.png
│ ├── components
│ │ ├── Button.jsx
│ │ ├── Content.jsx
│ │ ├── Footer.jsx
│ │ ├── Header.jsx
│ │ ├── Input.jsx
│ │ ├── Language.jsx
│ │ └── Response.jsx
│ ├── index.css
│ └── main.jsx
├── tree.txt
└── vite.config.js
17 directories, 44 files
The following environment variables need to be set in server/.env:
OPENAI_API_KEY: Your OpenAI API keyPORT: Port for the backend server (default: 3001)
- Push your code to a GitHub repository
- Import the repository into Vercel
- Set up environment variables in Vercel's dashboard
- Deploy!
- Create a new Web Service on Render
- Connect your GitHub repository
- Set the root directory to
server - Add environment variables
- Deploy!
- Scrimba for their excellent courses and practical approach to teaching AI Engineering, and Tom Chant and Per Borgen for their dedication to sharing knowledge. Highly recommend their "The AI Engineer Path" here: https://scrimba.com/the-ai-engineer-path-c02v. IMO very worth getting the subscription.












