OneCompiler
Gemini

Gemini

AI/ML

A working chat app built on Google's Gemini models, ready to run in your browser. It's an Express and Socket.IO server that streams replies token by token into a clean chat UI. Add your own Gemini API key, run it and start talking to the model.

What's included

Streaming chat UI

A ready chat interface in public/index.html, wired to the server over Socket.IO so responses stream in as the model generates them.

Real VS Code

The full cloud editor with an integrated terminal and extensions, so you can edit the server and front end in one place.

Express backend

A small TypeScript server that talks to Gemini through the Google GenAI SDK and keeps the conversation history for context.

Git ready

Clone, commit and push from the terminal, or connect a GitHub repo whenever you want.

Tech stack

Node.jsExpressSocket.IOTypeScriptGoogle GenAI SDKGemini

What is the Gemini template?

Gemini is Google's family of AI models for text, code and multimodal tasks. This template is a small, complete chat application built on top of it: a Node.js server using Express and Socket.IO, plus a browser chat interface. When you send a message, the server calls Gemini through the Google GenAI SDK and streams the reply back to the page as it's generated.

It's meant as a starting point rather than a finished product. The code is short enough to read in a sitting, so you can see how streaming, the socket connection and the conversation history fit together, then build your own AI features from there.

What's inside this workspace

The server lives in src/app.ts. It sets up Express, serves the static files in public/, and handles chat over a Socket.IO connection. Each incoming message is appended to an in-memory history and sent to Gemini with streaming on, so chunks arrive at the client one after another.

The front end is a single public/index.html with the chat UI. It also checks whether an API key is configured and shows setup instructions when it isn't, which makes the first run friendlier.

Running it and adding your key

You supply your own Gemini API key. Create one in Google AI Studio, copy env.example to .env, and set GEMINI_API_KEY to your key. The free key from AI Studio is enough to try the template.

Then run npm run dev. The server starts on port 3000 and Studio opens the chat interface in a browser preview. If the tab doesn't open on its own, run the Studio Manager: SimpleBrowser Default URL command from the VS Code command palette.

What you can build with it

Use it as the base for a support assistant, a writing or coding helper, a documentation Q&A bot, or any app where you want a streaming chat backed by Gemini. The streaming and history handling are already wired up, so you mostly add your own prompts, UI and data.

Frequently asked questions

Do I need an API key?

Yes. You bring your own Gemini API key. Create one for free in Google AI Studio, then copy env.example to .env and set GEMINI_API_KEY. The template doesn't include a key, so nothing calls the model until you add yours.

Where does the chat UI run?

On port 3000. After npm run dev, Studio opens the chat interface in a built-in browser preview. If it doesn't open automatically, use the Studio Manager: SimpleBrowser Default URL command from the command palette.

How does the streaming work?

The browser and server talk over Socket.IO. The server calls Gemini with streaming enabled and forwards each chunk to the page as it arrives, so you see the reply build up in real time instead of waiting for the whole response.

Which Gemini model does it use?

It calls one of Google's fast Gemini models through the Google GenAI SDK. You can switch the model in src/app.ts if you want a different one.

Can I change the front end or add features?

Yes. The chat UI is a single HTML file in public/ and the server is a short TypeScript file, so you can edit both directly and rebuild your own app around them.

Is it free?

Yes, this template runs on the free tier, so you can launch it without a paid plan. Keep in mind that your Gemini API usage is billed separately by Google according to their terms.

Related templates

Gemini online Studio — cloud AI chat app workspace | OneCompiler