Ensure Eme (a web-based messaging app) correctly wires VITE_API_BASE for API calls and SSE connections, configures Vite dev proxy, and updates CI/CD health checks—without touching UI, CSS, or assets.
Configure the Eme messaging app to correctly use `VITE_API_BASE` for API calls and SSE (Server-Sent Events) connections, set up Vite development proxy, and update CI/CD health checks.
**DO NOT modify:**
**ONLY modify:**
**Technical requirements:**
**Objective:** Ensure SSE connection and API calls use `VITE_API_BASE` environment variable.
```javascript
const apiBase = import.meta.env.VITE_API_BASE || window.location.origin;
```
**Example pattern:**
```javascript
// Bad
const sseUrl = '/api/events';
// Good
const apiBase = import.meta.env.VITE_API_BASE || window.location.origin;
const sseUrl = `${apiBase}/api/events`;
```
**Objective:** Set up proxy for local development when backend runs on different port.
**Example pattern:**
```javascript
export default defineConfig({
server: {
proxy: {
'/api': {
target: 'http://localhost:3001',
changeOrigin: true,
ws: true
}
}
}
});
```
**Objective:** Document the VITE_API_BASE variable for developers.
**Example:**
```bash
VITE_API_BASE=
```
**Objective:** Ensure health check works with configurable API base URL.
**Requirements:**
**Objective:** Ensure workflows use correct Node version and pass environment variables.
For each workflow file:
```yaml
- uses: actions/setup-node@v3
with:
node-version: '20'
```
After making changes, verify:
1. **Development mode:**
- [ ] `npm run dev` starts without errors
- [ ] API calls proxy correctly to backend
- [ ] SSE connections establish successfully
2. **Production build:**
- [ ] `VITE_API_BASE` can be set at build time
- [ ] Built app uses correct API base URL
- [ ] SSE connections work with custom API base
3. **Health check:**
- [ ] Script runs successfully with Node 20
- [ ] Accepts environment variable for API base
- [ ] Returns correct exit codes
4. **CI/CD:**
- [ ] Workflows use Node 20
- [ ] All checks pass
- [ ] No UI/CSS files were modified
**Local development:**
```bash
npm run dev
```
**Staging deployment:**
```bash
VITE_API_BASE=https://api-staging.eme.com
npm run build
```
**Production deployment:**
```bash
VITE_API_BASE=https://api.eme.com npm run build
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/eme-event-bus-backend-integration/raw