Public React / Next.js reference app for the Alpha Camera REST API.
This example shows how to:
- start or adopt the local camera server from a Next.js route
- use the published TypeScript SDK client from
@alpha-sdk/client - handle camera discovery, connect, reconnect, and SSE updates in app code
- render live view and common camera controls in a browser UI
It is the TypeScript counterpart to the macOS Swift example app.
- Node.js 20+
- npm
- a camera supported by the SDK
- macOS / Windows / Linux machine that can run the published camera server binary
For USB SDK detection, set the camera body to remote shooting / PC Remote mode.
Typical Sony menu path:
Menu -> Setup -> USB -> USB Connection Mode -> Remote ShootingorPC RemoteMenu -> Network -> Cnct./Remote Sht. -> Remote Shooting Function -> Remote Shooting -> On
Some models also require:
Connect without Pairing
For network / Ethernet setup, compatibility depends on camera model. Use:
and the camera help guide for model-specific steps.
Not all camera models support SDK network connection, and not all network-capable models support both wired and wireless operation.
From this folder:
npm installThis installs:
- the Next.js app dependencies
@alpha-sdk/apifor local server management@alpha-sdk/clientfor typed REST calls
Development:
npm run devOpen:
Production build:
npm run build
npm run startThe browser UI does not spawn the native camera server directly.
Instead:
- the page calls
POST /api/server src/app/api/server/route.tsusesServerManagerfrom@alpha-sdk/api- the route either:
- starts a local
CameraWebApp, or - adopts an already-running healthy server
- starts a local
- the page then creates a
CameraManageragainst that server URL
Relevant files:
src/app/api/server/route.tssrc/lib/camera-manager.tssrc/lib/event-stream.tssrc/app/page.tsx
The app uses three layers:
src/app/api/server/route.ts
- starts / stops the server
- adopts an already-running server on
8080 - avoids duplicate-start races during Next.js reloads
src/lib/camera-manager.ts
- polls
GET /api/cameras - auto-connects detected cameras
- waits for SSE connect confirmation
- handles reconnect after disconnect
- exposes a bound camera helper for actions and property access
src/lib/event-stream.ts
- uses native
EventSource - reconnects automatically on stream failure
- exposes typed event listeners to the lifecycle layer and UI
The app polls live-view JPEG frames over HTTP and swaps the current image in the page.
The browser UI also supports:
- OSD toggle
- zoom in/out
- focus near/far
- AF shutter / continuous shutter
- movie record toggle
- SD card file listing and download
src/app/page.tsx
src/app/api/server/route.ts
src/lib/camera-manager.ts
src/lib/event-stream.ts
Try this in order:
- unplug the camera
- turn the camera off
- turn the camera back on
- reconnect USB
If it still fails:
- stop other camera apps that may hold the camera
- Imaging Edge Desktop
- Creators’ App
- stop any other running camera servers
- restart the computer
Check whether another server is already running on 8080. The route will usually adopt it, but stale dev processes can interfere during reloads.
Useful checks:
lsof -nP -iTCP:3000 -sTCP:LISTEN
lsof -nP -iTCP:8080 -sTCP:LISTENRestart the Next.js dev server. Route-module and lifecycle state can survive HMR in ways that do not match a clean startup.