vtube-studio/README.md

61 lines
2.2 KiB
Markdown

## Run locally
Prerequisites: Node.js (16+ recommended)
1. Install dependencies:
npm install
2. Copy the example env and (optionally) add your Gemini API key:
cp .env.example .env
If you set `GEMINI_API_KEY`, the project can be wired to a real image
generation backend. For local development, if the key is empty the app
will show a placeholder generated image so the UI remains usable.
3. Start the dev server:
npm run dev
## Run as an Electron app (local desktop)
1. Install dev dependencies (if not already done):
npm install
2. Start the app in Electron (dev):
npm run electron:dev
This runs Vite and then launches Electron pointed at the dev server. The renderer will use a preload bridge to ask the main process to perform avatar generation — you can extend the main process to call the `@google/genai` SDK safely.
## Tailwind CSS and production
- The app previously used the Tailwind CDN for convenience. For production we now build Tailwind locally using PostCSS (the project contains `tailwind.config.cjs` and `postcss.config.cjs`).
- To build for production (or package with Electron), run:
npm run build
- If you need to customize Tailwind, edit `tailwind.config.cjs` and your global styles in `src/styles.css`.
## Electron security note (CSP)
During development Electron warns about a permissive Content-Security-Policy (CSP). This is expected for dev, but before shipping an Electron app you must set a strict CSP and avoid `unsafe-eval` and `unsafe-inline` where possible. See: https://electronjs.org/docs/tutorial/security
---
Refactor notes
The repository was reorganized so renderer and electron-specific code live under `src/`:
- `src/renderer` — React application and browser-only services/components
- `src/electron` — main process, preload, and GenAI wrapper
- `src/shared` — types and small shared artifacts
Vite alias `@` now points to `src/` so you can import shared files as `@/shared/types`.
Compatibility: root-level electron entry files were kept as small wrappers that forward to the `src/electron` files so existing scripts should still work.
If you want further adjustments (different folders or moving more files), tell me and I will apply them.