EchoRead is a Vite + React app for English reading practice with Gemini-powered text-to-speech.
- Frontend: Vite builds the SPA into
dist/ - Backend:
server.jsserves the SPA and exposesPOST /api/tts - TTS provider: Gemini via
@google/genai - Production auth: Cloud Run service account + Vertex AI
Prerequisites:
- Node.js 24
- Install dependencies:
pnpm i - Create
.env.localfrom.env.example - For local development, set
GEMINI_API_KEY - Start the API server:
pnpm dev:server - In another terminal, start the frontend dev server:
pnpm dev
- Build the frontend:
pnpm build - Start the Cloud Run-compatible server:
pnpm start - Open
http://localhost:8080
Set your active project first:
gcloud config set project PROJECT_IDEnable required services:
gcloud services enable \
run.googleapis.com \
cloudbuild.googleapis.com \
artifactregistry.googleapis.com \
aiplatform.googleapis.comCreate a service account for Cloud Run:
gcloud iam service-accounts create echoread-run \
--display-name="EchoRead Cloud Run"Grant Vertex AI access:
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="serviceAccount:echoread-run@PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/aiplatform.user"Deploy from source:
gcloud run deploy echoread \
--source . \
--region asia-northeast1 \
--allow-unauthenticated \
--service-account echoread-run@PROJECT_ID.iam.gserviceaccount.com \
--set-env-vars GOOGLE_CLOUD_PROJECT=PROJECT_ID,GOOGLE_CLOUD_LOCATION=global,GOOGLE_GENAI_USE_VERTEXAI=true,NODE_ENV=production- Do not expose
GEMINI_API_KEYto the browser. - In production, prefer Vertex AI over a direct API key.
- The current library is stored in browser
localStorage, so it is device-local.