diff --git a/backend/src/routes/version.ts b/backend/src/routes/version.ts
index a15bc203..e9e24645 100644
--- a/backend/src/routes/version.ts
+++ b/backend/src/routes/version.ts
@@ -1,7 +1,18 @@
import { Router, Request, Response } from 'express';
+import { readFileSync } from 'fs';
+import { join } from 'path';
const router = Router();
+// Read package.json version at startup
+let packageVersion = 'unknown';
+try {
+ const packageJson = JSON.parse(readFileSync(join(__dirname, '../../package.json'), 'utf-8'));
+ packageVersion = packageJson.version || 'unknown';
+} catch {
+ // Fallback if package.json not found
+}
+
/**
* GET /api/version
* Returns build version information for display in admin UI
@@ -10,10 +21,11 @@ router.get('/', async (req: Request, res: Response) => {
try {
const gitSha = process.env.APP_GIT_SHA || 'unknown';
const versionInfo = {
+ version: packageVersion,
build_version: process.env.APP_BUILD_VERSION?.slice(0, 8) || 'dev',
git_sha: gitSha.slice(0, 8) || 'unknown',
git_sha_full: gitSha,
- build_time: process.env.APP_BUILD_TIME || new Date().toISOString(),
+ build_time: process.env.APP_BUILD_TIME || 'unknown',
image_tag: process.env.CONTAINER_IMAGE_TAG?.slice(0, 8) || 'local',
};
diff --git a/cannaiq/src/components/Layout.tsx b/cannaiq/src/components/Layout.tsx
index ad5878f5..7b499be9 100755
--- a/cannaiq/src/components/Layout.tsx
+++ b/cannaiq/src/components/Layout.tsx
@@ -20,6 +20,7 @@ import {
Menu,
X,
Users,
+ UserCog,
ListOrdered,
Key,
Bot
@@ -30,6 +31,7 @@ interface LayoutProps {
}
interface VersionInfo {
+ version: string;
build_version: string;
git_sha: string;
build_time: string;
@@ -124,7 +126,14 @@ export function Layout({ children }: LayoutProps) {
+ v{versionInfo.version} ({versionInfo.git_sha}) {versionInfo.build_time !== 'unknown' && `- ${new Date(versionInfo.build_time).toLocaleDateString()}`} +
+ )} +{user?.email}
@@ -152,6 +161,7 @@ export function Layout({ children }: LayoutProps) {{versionInfo.build_version} ({versionInfo.git_sha.slice(0, 7)})
-{versionInfo.image_tag}
-