Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
To create a screenshot API in Nuxt, put the capture logic in a server route, validate the requested URL, and run the browser capture on a server runtime that supports it. NuxtHub’s browser-rendering guide demonstrates this approach in server/api/screenshot.ts: it accepts a URL and optional light or dark theme, sets a 1920 × 1080 viewport, navigates with a domcontentloaded wait condition, and returns a screenshot. That wait condition does not guarantee that every client-rendered element or delayed image is ready.
This guide shows the route’s responsibilities, the NuxtHub setup path, the decisions you must make before exposing it, and a hosted alternative when you do not want to provision browser infrastructure.
How a Nuxt screenshot API fits together
A screenshot endpoint is a server-side operation, not browser code that belongs in a component. Nuxt’s server endpoints run through Nitro, so a route under server/api/ can receive an HTTP request, validate its inputs, ask a browser runtime to visit the target, and return the captured image. Browser globals are not generally available in server rendering code, and placing automation in universal component setup risks running it in the wrong context.
Recommended Free Tools
The NuxtHub example uses a hosted browser helper called hubBrowser(). Its flow is:
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
- Read a
urlquery parameter and reject invalid input. - Read an optional
theme, allowinglightordark. - Acquire a browser session, configure a 1920 × 1080 viewport, and emulate the requested color scheme.
- Navigate to the target with
domcontentloadedas the navigation wait condition. - Capture the page and return the image from the server endpoint.
The specific browser helper’s import, response serialization, headers, and runtime requirements depend on the current NuxtHub implementation. Confirm those details in the current NuxtHub browser-rendering documentation before using helper-specific code in production; they are not established by the visible example description alone. The route shape below is an implementation checklist, not a claim that an invented helper signature is copy-and-paste ready.
Set up NuxtHub for the documented browser path
NuxtHub is one documented way to obtain the browser capability used by the example. It is not a universal requirement for every possible Nuxt screenshot service: you can also integrate a separate browser automation and runtime provider, subject to that provider’s compatibility with your deployment target.
- Add the module: from the project root, run
npx nuxi module add hub. The NuxtHub installation guide says this installs@nuxthub/coreand adds it to themodulessection innuxt.config. - Review configuration: check the generated module entry in
nuxt.config.tsand complete any project setup required by your chosen NuxtHub browser runtime. - Create the endpoint: add
server/api/screenshot.ts. Nitro treats files in the server directory as server functionality; use the current NuxtHub browser-rendering documentation for the exact helper import and return format. - Test on the target runtime: verify that the deployment preset and provider support the browser capability and any required configuration. Nuxt/Nitro support multiple deployment presets generally, but that does not mean every provider supports browser rendering in the same way.
Design the route’s inputs and response
Validate the URL before navigation
Never treat a caller-supplied URL as harmless just because it arrives in a query string. Parse it as a URL, allow only the schemes your application needs—typically https: and, if justified, http:—and reject malformed values before opening a browser page. In a public service, use an allowlist of permitted hosts where possible. If arbitrary public sites are necessary, block loopback, private, link-local, and other internal destinations, including redirects that resolve to them. This is important because an endpoint that visits a requested URL can otherwise become a way to probe services reachable from your server.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
Constrain theme and viewport choices
The documented example accepts theme=light or theme=dark and sets a 1920 × 1080 viewport. Keep theme values enumerated rather than passing arbitrary browser settings from callers. If you expose viewport dimensions, enforce sensible minimums and maximums so a request cannot ask the browser to allocate an unreasonable surface. Keep a fixed default when callers do not specify a size.
Choose an image response contract
Decide whether the endpoint returns image bytes directly or metadata plus a URL to a stored image. For a direct image response, set the content type to match the actual screenshot format and make sure the framework returns binary data rather than JSON-encoding it. Current NuxtHub browser-rendering documentation does not establish the helper’s exact serialization or content-type behavior, so verify it in the current documentation rather than guessing. If you store results, define retention, access control, and cache behavior separately.
Readiness: what domcontentloaded does and does not mean
The NuxtHub example navigates with domcontentloaded. Treat that as a navigation milestone, not a promise that the screenshot contains every visible asset. A page can continue fetching data, hydrating a client application, loading web fonts or images, and running animations after that event.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
Choose readiness based on the page you capture:
- For simple server-rendered pages, a DOM-ready capture may be enough.
- For client-rendered content, wait for a selector that appears when the important content is ready.
- For pages with delayed images or data, use a bounded additional wait or a page-specific readiness signal.
- For animated or personalized pages, consider disabling animation or capturing a stable state if your browser integration supports it.
A fixed delay is easy to understand but can waste time on fast pages and still fail on slow ones. Prefer an explicit readiness condition where available, and impose an overall timeout so a stuck target does not hold the request indefinitely.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallSecure and operate a public screenshot endpoint
The basic documented route validates the URL, but URL validation alone is not a complete production security policy. Before exposing a screenshot route beyond a trusted internal caller, add controls appropriate to your use case:
- Authentication: require an application credential or signed request so strangers cannot consume browser capacity.
- Rate limits and quotas: cap requests by identity and time period; also limit concurrent browser sessions.
- Destination policy: restrict hosts where possible, block internal address ranges, and re-check destinations after redirects.
- Timeouts: bound navigation, readiness waits, and total work per request.
- Input limits: cap URL length and allowed viewport dimensions, and reject unsupported output options.
- Resource controls: consider how many pages, browser sessions, and large images your selected runtime can handle.
- Abuse-resistant errors: return useful client errors for invalid input without exposing internal network details or secrets.
Browser provisioning, cold starts, concurrency ceilings, and latency vary by runtime and deployment provider. Nuxt documentation establishes the route pattern, not a universal performance figure or identical support across all hosting environments. Test the deployed configuration with realistic targets and load before depending on it for synchronous user-facing work.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Common problems and fixes
| Symptom | Likely cause | What to check |
|---|---|---|
| The route works locally but fails after deployment | The selected production runtime or provider may not support the browser capability or its required configuration. | Check the target provider’s browser-runtime requirements and deployment preset, then test the route in that environment. |
| The screenshot is blank or missing client-rendered content | Navigation reached domcontentloaded before the application finished rendering or fetching data. |
Wait for a meaningful selector or other page-specific readiness signal; keep an overall timeout. |
| An image response is corrupted or treated as JSON | The route may be serializing binary screenshot data incorrectly, or the content type may not match the bytes. | Verify the helper’s current response contract and return binary bytes with the appropriate image content type. |
| Some URLs fail while others work | The target may block automated traffic, redirect, load slowly, or require authentication. | Inspect navigation status and redirect behavior; use bounded timeouts and only send credentials to destinations you explicitly trust. |
| The endpoint can reach unexpected hosts | Input validation may accept internal addresses or fail to account for redirects. | Enforce destination policy before navigation and re-check redirect targets. Do not rely on a syntactically valid URL as a security boundary. |
| Requests pile up or become expensive | Unbounded concurrency, retries, or oversized captures can consume browser resources. | Add caller quotas, concurrency limits, timeouts, and viewport limits; measure behavior in your own runtime rather than assuming a fixed capacity. |
Or skip the browser setup: use ScreenshotNeo
If the goal is to get a screenshot from a Nuxt application without managing browser provisioning, call ScreenshotNeo’s HTTP API from server-side code. Keep the API key on the server; do not expose it in a Nuxt client bundle. The following cURL request saves a WebP screenshot of the requested page:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
For the Nuxt endpoint, make the request from server code and return the received bytes using the response handling appropriate to your Nuxt/Nitro version. The API returns a screenshot or PDF from one GET request. See the ScreenshotNeo API documentation for the request parameters and response details.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Equivalent Python and Node.js requests
Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo accepts a request URL and can return PNG, JPEG, WebP, or PDF. Cookie and consent banners, newsletter popups, and chat widgets can be removed before capture; each of those cleanup steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and whether the request was billed. The service also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI-agent clients.
ScreenshotNeo is available at screenshotneo.com. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for the free plan to try the API.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Frequently Asked Questions
Can I use the screenshot route from a Nuxt page component?
The capture should run in server code. Call your own protected server endpoint from the page if the browser needs to initiate a capture.
Does the NuxtHub example capture a full-page screenshot?
The NuxtHub example description establishes that it returns a screenshot, but does not specify whether the capture is full-page.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Can the endpoint return a PDF instead of an image?
That depends on the browser integration and response implementation you choose; the described NuxtHub example establishes an image screenshot, not its PDF support.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

