Skip to content

Commit 49fad6e

Browse files
committed
feat(api): add version endpoint for instance identification
Adds GET /api/version endpoint that returns: - Application version - Application name - Build time (if available) - Git commit hash (if available) - Node environment This helps users identify the version of a running Sim Studio instance. Fixes #2014
1 parent 3d9d9cb commit 49fad6e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

apps/sim/app/api/version/route.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { NextResponse } from 'next/server'
2+
3+
export const dynamic = 'force-dynamic'
4+
5+
// Version from package.json - updated during build process
6+
const APP_VERSION = process.env.npm_package_version || process.env.APP_VERSION || '0.1.0'
7+
const APP_NAME = 'sim-studio'
8+
9+
/**
10+
* GET /api/version
11+
* Returns the current version information of the Sim Studio instance
12+
*/
13+
export async function GET() {
14+
const buildTime = process.env.BUILD_TIME || null
15+
const gitCommit = process.env.VERCEL_GIT_COMMIT_SHA || process.env.GIT_COMMIT || null
16+
17+
return NextResponse.json({
18+
version: APP_VERSION,
19+
name: APP_NAME,
20+
buildTime,
21+
gitCommit: gitCommit ? gitCommit.substring(0, 7) : null,
22+
nodeEnv: process.env.NODE_ENV,
23+
})
24+
}

0 commit comments

Comments
 (0)