Terminal Bot is a simulation of a DOS session using the Gemini LLM models from Google.
frontend/
- Contains the frontend application in React that simulates the terminal UI in the browser.backend/
- Contains the backend server code responsible for interacting with Google Gemini, handling API requests, and serving the main application.
- Node.js (v20+)
- npm
- A Gemini API Key
-
Clone this repository
git clone http://github.com/jeduardo/terminal-bot.git cd terminal-bot
-
Configure the backend
cp backend/.env.example backend/.env # Edit the .env file to have your Gemini API key
-
Run the backend
cd backend npm install npm start
-
Run the frontend (in a separate terminal)
npm install npm start
- Open your browser to the application frontend URL (e.g.,
http://localhost:3000
). - Type commands into the simulated terminal. The backend forwards these commands to Google Gemini and returns generated responses, creating the illusion of a DOS session.
- Authentication: The backend API endpoints are currently not authenticated. This is by design, as the backend works primarily to protect the Gemini API key.
- API Key Security: The Gemini API key is stored in environment variables. Ensure these are properly secured in production deployments.
-
Create the service location and service user:
# Create user sudo groupadd --system terminal-bot sudo useradd --system -g terminal-bot terminal-bot sudo usermod -d /srv/terminal-bot terminal-bot sudo usermod --shell /bin/bash terminal-bot sudo mkdir /srv/terminal-bot
-
Build the frontend assets and copy them to the service location:
cd frontend npm install npm run build sudo mv build /srv/terminal-bot/public/ cd ..
-
Set up environment variables:
sudo cp backend/.env.example /srv/terminal-bot/.env.production # Edit .env.production with production settings
# Required to use the Gemini models GOOGLE_GENERATIVE_AI_API_KEY=YOUR_API_KEY # Required to serve the React files FRONTEND_DIR=public
-
Prepare the service location
sudo cp backend/{package.json,server.js} /srv/terminal-bot/ cd /srv/terminal-bot sudo npm install cd -
-
Add the systemd service file:
sudo cp deployment/terminal-bot.service /etc/systemd/system/ sudo systemctl enable terminal-bot sudo systemctl start terminal-bot
-
Fix ownership:
sudo chown terminal-bot:terminal-bot /srv/terminal-bot/ -R
-
(Optional) Add nginx passthrough if necessary:
# rest of config location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Port $server_port; proxy_pass http://127.0.0.1:8080/; } # rest of config
-
Build the Docker image
docker build -f deployment/Dockerfile -t terminal-bot .
-
Run the Docker container
docker run -d -p 8080:8080 --env-file /path/to/your/.env terminal-bot
This repository comes with a vercel.json
file instructing Vercel to build each part of the project separately.
To deploy this project on Vercel, import the Github repository and create all environment variables from env.example using the Vercel control panel.
This project is licensed under the MIT License. See the LICENSE file for details.