- Replace Clerk with self-hosted JWT auth (register/login/verify, bcrypt passwords, Gmail OTP with console fallback) - Add lib/db.ts pg pool + transaction helpers; seed script migrates legacy Clerk-era schema (drop clerk_id, enforce UUID ids and unique email) - Add owner-gated admin API: stats, users, drivers CRUD, rides - Add dashboard/ Vite React owner dashboard (login, overview, users, fleet, rides) with dev-server proxy to avoid Expo CORS middleware - Add scripts/set-owner.mjs for role management
26 lines
740 B
TypeScript
26 lines
740 B
TypeScript
import { defineConfig, type ProxyOptions } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
const API_TARGET = process.env.API_PROXY_TARGET ?? 'http://localhost:8081'
|
|
|
|
// Proxy API calls through the dev server so the dashboard is same-origin.
|
|
// Expo's dev-server CORS middleware rejects foreign Origin headers, so
|
|
// the proxy strips them before forwarding.
|
|
const proxy: Record<string, ProxyOptions> = {}
|
|
for (const path of ['/auth', '/user', '/ride', '/driver', '/admin']) {
|
|
proxy[path] = {
|
|
target: API_TARGET,
|
|
changeOrigin: true,
|
|
configure: (p) => {
|
|
p.on('proxyReq', (req) => {
|
|
req.removeHeader('origin')
|
|
})
|
|
},
|
|
}
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
server: { proxy },
|
|
})
|