Add Next.js web dashboard foundation - #44
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07404f5b69
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| services: | ||
| api: | ||
| build: . | ||
| command: uvicorn detlab.api:app --host 0.0.0.0 --port 8000 |
There was a problem hiding this comment.
Run uvicorn outside the CLI entrypoint
When the documented Docker Compose stack is used, this service builds the existing root Dockerfile, whose ENTRYPOINT is ['detlab'] and whose install step does not include requirements-api.txt. The Compose command is therefore passed as arguments to the detlab CLI instead of replacing the entrypoint, so the API container starts as detlab uvicorn ... and exits before /health is available. Use an API-specific image/install path and override entrypoint (or change the Dockerfile entrypoint) before relying on this stack.
Useful? React with 👍 / 👎.
| - '8000:8000' | ||
|
|
||
| web: | ||
| build: ./web |
There was a problem hiding this comment.
Add a Dockerfile for the web build context
With the documented docker compose up --build flow, build: ./web makes web/ the build context and Compose expects a Dockerfile there unless one is specified. I checked the new web tree and it only contains package.json and app/page.tsx, so the web service build fails before the dashboard can start. Add web/Dockerfile, point dockerfile: at an existing file, or use a prebuilt image.
Useful? React with 👍 / 👎.
| @@ -0,0 +1,39 @@ | |||
| async function getHealth() { | |||
| try { | |||
| const response = await fetch('http://localhost:8000/health', { | |||
There was a problem hiding this comment.
Point the server-side fetch at the Compose service
In the Compose deployment, this page is rendered on the Next.js server inside the web container, so localhost:8000 refers to the web container rather than the api service. Once the containers build, the dashboard will still report the API as offline under the documented Docker Compose stack even while the API container is healthy. Use the Compose service name such as http://api:8000 or an environment-configured base URL for server-side fetches.
Useful? React with 👍 / 👎.
| } | ||
| } | ||
|
|
||
| export default async function HomePage() { |
There was a problem hiding this comment.
Provide the required App Router root layout
This adds an App Router page under web/app, but the app has no web/app/layout.tsx. Next.js 14 requires a root layout in the app directory that defines the document shell, so npm run dev/npm run build for the new dashboard fails before serving this page. Add a minimal root layout with <html> and <body> around children.
Useful? React with 👍 / 👎.
Summary
Implements a modern Next.js dashboard foundation for DetLab.
Changes
Example