Add embedded Express admin API and unified dev workflow.

Move admin backend into this repo (Express + MySQL on :8085) so npm run dev starts both API and Vite, with updated env defaults and Caddy config for gadm.tkmind.cn.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
John
2026-06-16 16:29:06 -07:00
parent 680e2c9427
commit 9ecfa73831
13 changed files with 1702 additions and 45 deletions
+28
View File
@@ -0,0 +1,28 @@
import { loadProjectEnv } from './load-env.mjs';
import { bootstrapAdminServices } from './bootstrap.mjs';
import { importMemind } from './lib-path.mjs';
import { createAdminApp } from './app.mjs';
loadProjectEnv();
const port = Number(process.env.ADM_API_PORT ?? 8085);
const ready = bootstrapAdminServices();
const services = {
ready,
importUserAuthModule: () => importMemind('user-auth.mjs'),
importAuthModule: () => importMemind('auth.mjs'),
};
ready
.then(({ pool, userAuth, llmProviderService }) => {
Object.assign(services, { pool, userAuth, llmProviderService });
const app = createAdminApp(services);
app.listen(port, '127.0.0.1', () => {
console.log(`TKMind Admin API @ http://127.0.0.1:${port}`);
});
})
.catch((err) => {
console.error('Admin server bootstrap failed:', err);
process.exit(1);
});