This website is built using Docusaurus 3, a modern static website generator.
yarn installAutoBot is an AI-powered chatbot that helps users with SHAFT-related questions. It uses Google's Gemini AI models with automatic failsafe fallback for maximum reliability.
How AutoBot Works:
- AutoBot scans the complete SHAFT User Guide documentation (all markdown files from
/docsdirectory) - It includes context about the official SHAFT_ENGINE GitHub repository
- It provides answers based ONLY on the loaded documentation, without using internet searches or pre-trained knowledge
- This ensures all answers are accurate, verified, and based on official SHAFT documentation
Model Failsafe Sequence (tries in order):
gemini-3-flash(latest, fastest model)gemini-2.5-flash(reliable flagship model)gemini-2.5-flash-lite(lightweight fallback)gemma-3-27b(larger open model)gemma-3-12b(balanced open model)gemma-3-4b(efficient open model)gemma-3-2b(compact open model)gemma-3-1b(minimal fallback)
The chatbot automatically tries each model in sequence until one successfully responds, ensuring high availability even during rate limits or service disruptions.
To enable AutoBot:
- Get a Gemini API key from Google AI Studio
- Copy
.env.exampleto.env:cp .env.example .env
- Add your API key to the
.envfile:GEMINI_API_KEY=your_actual_api_key_here - Install Netlify CLI (if not already installed):
npm install -g netlify-cli
- Run the development server with Netlify Functions:
This will start both the Docusaurus dev server and Netlify Functions locally.
netlify dev
Note:
- The
.envfile is gitignored and should never be committed to the repository. - Regular
yarn startwon't work for the chatbot since Netlify Functions won't be available. - Use
netlify devinstead to test the full functionality locally.
Important: The AutoBot chatbot requires a Gemini API key to function securely. The key is now stored server-side and never exposed to the client.
To ensure security, the website uses a serverless proxy architecture:
- The AutoBot frontend sends chat requests to a Netlify Function (
/api/gemini-proxy) - The Netlify Function securely accesses the Gemini API using a server-side API key
- The API key is never embedded in the client-side JavaScript bundle
- Get a Gemini API key from Google AI Studio
- Optional but Recommended: Add API restrictions in Google Cloud Console:
- Under "API restrictions", select "Restrict key" and enable only "Generative Language API"
- Note: HTTP referrer restrictions are not necessary since the key is server-side only
- Sign up for a free Netlify account
- Connect your GitHub repository to Netlify
- Configure build settings:
- Build command:
yarn build - Publish directory:
build
- Build command:
- Add environment variable:
- Go to Site settings → Environment variables
- Add
GEMINI_API_KEYwith your API key value
- Deploy the site
The Netlify Function will automatically handle Gemini API requests securely without exposing the key.
The test workflow (.github/workflows/test.yml) requires the GEMINI_API_KEY secret:
- In the repository settings, go to Settings → Secrets and variables → Actions
- Click New repository secret
- Name:
GEMINI_API_KEY - Value: Paste your Gemini API key
- Click Add secret
For detailed testing instructions, see CHATBOT_TESTING.md.
To run tests:
# Run all tests
npm test
# Run only chat history tests
npm run test:history
# Run only API tests (requires GEMINI_API_KEY environment variable)
npm run test:api- Start a local server by running this command:
yarn start- A new browser window will open; most changes are reflected live without having to restart the server.
- Create your own .md files under the
docsorblogdirectories. - You can use something like https://dillinger.io/ to help you create the .md file.
- Add your new file to the sidebar if needed by editing this file
/sidebars.js.
The site is primarily deployed to Netlify at https://shaftengine.netlify.app/ for integrated serverless function support:
- When you push to the
masterbranch, Netlify automatically builds and deploys the site - Pull requests get preview deployments for review
- The AutoBot chatbot works securely through Netlify Functions (no API keys in client code)
GitHub Pages Redirect: The GitHub Pages site (https://shafthq.github.io/) automatically redirects all visitors to the Netlify deployment. The GitHub Actions workflow in .github/workflows/deploy.yml maintains this redirect page.
If you need support to contribute, kindly join our slack channel to align and discuss.