This project simulates Google Gemini Gems capabilities, providing a flexible interface for managing and executing custom AI instructions ("Gems"). It is designed to run as a containerized service, leveraging the latest Gemini 3.0 models with low-latency thinking capabilities.
Since the standard Gemini Gems interface does not currently support direct API access, this project emulates that functionality by:
- Storage: Storing Gem definitions (system instructions, prompts) in a Supabase database.
- Execution: Providing a FastAPI backend service that reads Gem definitions from Supabase and combines them with user input to execute requests via the Google Gemini API (using the latest
google-genaiSDK). - Management: Offering a React-based web interface for creating, editing, and testing Gems.
- Optimization: Automatically handling Gemini 3.0 "thinking" artifacts and optimizing for low latency.
- Frontend: React (Vite) - Served statically by FastAPI in production
- Backend: FastAPI (Python)
- Database: Supabase (PostgreSQL)
- AI Model: Google Gemini (Supports 1.5, 2.0, and 3.0 series)
- Initial Project Setup
- Dockerize the application (Multi-stage build)
- Configure Nginx Proxy Manager for secure deployment
- Setup private networking (Docker
shared_net) to avoid exposing ports on localhost
POST /api/gems/execute: Execute a specific Gem by name.- Body:
{"gem_name": "Name", "user_prompt": "..."}
- Body:
POST /api/gemini/generate: Direct access to the configured Gemini model.- Body:
{"system_instructions": "...", "user_prompt": "..."}
- Body:
GET /api/gems: List all available Gems.
- Docker & Docker Compose (Recommended)
- Supabase Account
- Google Gemini API Key
- Keep
SUPABASE_KEYandAPI_TOKENserver-only; never add them toVITE_*variables or frontend code. - The backend fails to start if a service key is exposed to the frontend or bundled into
dist. - Before committing, run
npm run secret:checkto scan for leaked tokens in assets, source, and docs.
Create a .env file with the following:
GEMINI_API_KEY=your_gemini_key
# Model to use (defaults to gemini-3-pro-preview if unset)
GEMINI_MODEL=gemini-3-pro-preview
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_service_role_key
PORT=8000
NODE_ENV=productionThis project is designed to be run via Docker Compose.
-
Build and Start:
docker compose up -d --build
-
Access:
- The service runs on port
8000inside the container. - It connects to the external
shared_netnetwork. - Configure your reverse proxy (e.g., Nginx Proxy Manager) to point to the container name
gemsapion port8000.
- The service runs on port
If you wish to run without Docker:
-
Install Node dependencies:
npm install
-
Install Python dependencies:
pip install fastapi uvicorn google-genai supabase python-dotenv slowapi pydantic httpx aiofiles
-
Run Frontend:
npm run dev
-
Run Backend:
uvicorn fastapi_server:app --reload