A simple, accessible web application that allows users to submit questions to the Grok AI and share the answers.
- Submit questions to Grok AI and view responses
- Copy answers or question-answer pairs for sharing
- Share links directly to specific questions and answers
- Toggle between light and dark themes
- Fully accessible interface with keyboard navigation and screen reader support
- Dynamic content updates are announced to screen readers
- Loading states use
aria-live="polite"
to inform users of progress - Toast notifications use
aria-live="assertive"
for important updates
- Full keyboard navigation throughout the application
- Focus management for modal dialogs
- Focus trapping within modals for improved usability
- Automatic focus on interactive elements in the response area
/
or?
- Focus the search inputh
- Open the help modalt
- Toggle between light and dark themesEsc
- Close any open modal
c
- Copy the answerq
- Copy the question and answers
- Copy the share linkg
- Continue on Grok
- Clone the repository
- Install dependencies:
npm install
- Configure the API endpoint (see below)
- Start the development server:
npm run serve
For development with the team's API endpoint:
-
Create a
config.local.json
file in the project root (this file is gitignored) -
Add the following content, replacing the example URL with the actual development API endpoint:
{ "apiBaseUrl": "https://development-api-domain.com", "debugMode": true }
-
The application will automatically use this API endpoint when running locally
-
In production, the application uses relative URLs by default (
/api/grok
)
Note: The development API endpoint is confidential and should not be committed to the repository or shared publicly. Contact a team member to get the correct endpoint URL.
When working with the development API:
- HTTPS is required: The API endpoint must use HTTPS to avoid mixed-content issues
- CORS support: The API server must allow cross-origin requests from your local development server
- Troubleshooting: If you encounter CORS errors, ensure the API server includes the following headers in its responses:
Access-Control-Allow-Origin: http://localhost:8080 Access-Control-Allow-Methods: POST, OPTIONS Access-Control-Allow-Headers: Content-Type
- Run unit tests:
npm test
- Run end-to-end tests:
npm run test:e2e
This project is deployed using Cloudflare Pages, which automatically minifies all assets for production.
- Development is done on the
development
branch with unminified code for easier debugging - When code is pushed to either the
development
ormain
branch, Cloudflare Pages:- Runs the build script located at
cloudflare/build.sh
- Minifies all JavaScript, CSS, and HTML files
- Deploys the minified code to Cloudflare's global CDN
- Runs the build script located at
The Cloudflare Pages configuration is documented in cloudflare/cloudflare-pages.json
and includes:
- Build command:
bash cloudflare/build.sh
- Output directory:
dist
- Environment variables for both production and preview deployments
For more details on the deployment configuration, see the Cloudflare Pages documentation.
To test the minified production build locally:
# Run the build script
bash cloudflare/build.sh
# Serve the dist directory to preview the minified site
npx http-server dist