diff --git a/frontend/index.html b/frontend/index.html
index 523abde..df1d178 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -202,7 +202,7 @@
data.pbToken = pb.authStore.token;
try {
- const response = await fetch('/idea-feedback/api/submit', {
+ const response = await fetch('/api/submit', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
diff --git a/package.json b/package.json
index 8adb75f..8cf18e8 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"description": "Idea and Feedback Form with PocketBase",
"type": "module",
"scripts": {
- "dev": "bun run server.ts",
+ "dev": "PORT=7001 bun run server.ts",
"start": "bun run server.ts"
},
"dependencies": {
diff --git a/server.ts b/server.ts
index 474f510..b5f78ee 100644
--- a/server.ts
+++ b/server.ts
@@ -2,9 +2,6 @@ import { Hono } from 'hono';
import { serveStatic } from 'hono/bun';
import { cors } from 'hono/cors';
import PocketBase from 'pocketbase';
-import { config } from 'dotenv';
-
-config();
const app = new Hono();
@@ -14,9 +11,12 @@ app.use('/*', cors());
// Serve static files from frontend directory
app.use('/*', serveStatic({ root: './frontend' }));
-// PocketBase client
+// PocketBase client - PB_DB from service environment
const pb = new PocketBase(process.env.PB_DB || 'https://pocketbase.ccllc.pro');
+// Collection name from service env (fallback to Ideas_Feedback)
+const PB_IDEA_COLLECTION = process.env.PBIdea_Collection || 'Ideas_Feedback';
+
// Use user's PocketBase token (passed from authenticated frontend)
function setUserPocketBaseAuth(token: string) {
pb.authStore.save(token);
@@ -41,7 +41,7 @@ app.post('/api/submit', async (c) => {
delete data.pbToken;
// Create the record in PocketBase as the authenticated user
- const record = await pb.collection(process.env.PB_COLLECTION!).create(data);
+ const record = await pb.collection(PB_IDEA_COLLECTION).create(data);
console.log(`✓ Created PocketBase record with ID: ${record.id}`);
return c.json({