Migrate from Supabase to local Express API

This commit is contained in:
2026-06-14 16:57:50 +08:00
parent 217b81c506
commit 6359231b99
24 changed files with 3208 additions and 1192 deletions
+51 -3
View File
@@ -1,5 +1,53 @@
# Vue 3 + TypeScript + Vite
# OpenCloud
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Vue 3 + Vite frontend with a Node/Express API, PostgreSQL, and local file storage.
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
## Development
1. Install dependencies:
```bash
npm install
```
2. Create the PostgreSQL schema:
```bash
psql "$DATABASE_URL" -f server/schema.sql
```
3. Start the API:
```bash
DATABASE_URL="postgres://..." JWT_SECRET="change-me" npm run dev:api
```
4. Start the frontend:
```bash
npm run dev
```
The Vite dev server proxies `/api/*` and `/uploads/*` to `http://localhost:3001`.
## Scripts
- `npm run dev` - Vite frontend dev server
- `npm run dev:api` - Express API with `tsx`
- `npm run build` - Vue typecheck and production frontend build
- `npm run typecheck:api` - Typecheck the Express API
- `npm run start:api` - Start the API with Node and `tsx`
## Environment
Frontend:
- `VITE_AMAP_KEY` - required for map features
- `VITE_SITE_URL` - optional canonical URL for generated SEO files
Backend:
- `DATABASE_URL` - PostgreSQL connection string
- `JWT_SECRET` - secret for HTTP-only JWT session cookies
- `PORT` - API port, defaults to `3001`
- `UPLOAD_ROOT` - optional upload directory, defaults to `server/uploads`