React-based chatbot web interface for the OrbitMesh Support Assistant. Built with React and Vite.
- Node.js 18+ and npm installed
Run the provided startup script:
./start.shOr manually run:
npm install
npm run devThe application will be accessible at: http://localhost:5173.
Create a .env or .env.local file inside frontend/ if connecting to a remote backend:
VITE_API_URL=http://localhost:8000If VITE_API_URL is omitted in local development, Vite proxies /api requests to http://127.0.0.1:8000.
To run the Vitest component test suite:
npm test
# Or from the project root:
./tests/run_frontend_tests.shResults are displayed in the terminal and logged to logs/frontend_test_<timestamp>.log.
To build and run the frontend inside a local Docker container:
docker build -t orbitmesh-frontend .docker run -d -p 80:80 --name orbitmesh-frontend orbitmesh-frontendAccess at: http://localhost:80.
Use the included push script to build and publish the image to Amazon ECR:
# Optional environment variables (or rely on defaults):
export AWS_REGION=ap-southeast-1
export AWS_ACCOUNT_ID=123456789012
export ECR_REPO_NAME=orbitmesh-frontend
export IMAGE_TAG=latest
./push_ecr.shThe script will:
- Validate AWS CLI and Docker installation.
- Authenticate Docker with Amazon ECR.
- Automatically create the ECR repository if it does not exist.
- Build the image via
Dockerfile. - Tag and push the image to ECR.
AWS Amplify is the recommended hosting platform for React single-page applications because it provides global CloudFront CDN distribution, automatic SSL, continuous deployment from Git, and zero server maintenance.
- Open the AWS Management Console and navigate to AWS Amplify.
- Click Host web app.
- Select your Git provider (GitHub, GitLab, Bitbucket, or AWS CodeCommit) and authenticate.
- Select the repository and the deployment branch (e.g.,
mainorfrontendordevorproduction).
Amplify automatically detects Vite/React. Use the following build settings (or place an amplify.yml file in the root):
version: 1
frontend:
phases:
preBuild:
commands:
- cd frontend
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: frontend/dist
files:
- '**/*'
cache:
paths:
- frontend/node_modules/**/*In the Amplify console, navigate to App settings > Environment variables and add:
VITE_API_URL: The URL of your backend API (e.g.,https://api.orbitmesh.yourdomain.comor your ALB DNS name).VITE_API_KEY: (Optional) The API key matchingAPI_KEYon your backend service if API key verification is enabled.
To ensure deep links and browser refreshes work properly:
- In Amplify Console, navigate to App settings > Rewrites and redirects.
- Add a rule:
- Source address:
</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|woff2|ttf|map|json)$)([^.]+$)/> - Target address:
/index.html - Type:
200 (Rewrite)
- Source address:
Click Save and deploy. Amplify will build the React application and distribute it across the global AWS edge network.