A simple React website that displays a single full-screen responsive image based on the device viewport size.
- Fully responsive - Serves different images based on device viewport
- Desktop view (≥ 1024px width) - Uses
desktop.webp - Tablet landscape (768px-1023px width) - Uses
tablet.webp(ordesktop.webpif not available) - Mobile/Tablet portrait (< 768px width or portrait orientation) - Uses
mobile.webp - Smooth resizing - Updates image when window is resized
- Full-screen display - Image covers entire viewport with
object-fit: cover
npm installPlace your WebP images in the public/ folder:
- desktop.webp - Image for desktop view (recommended: 1920x1080 or larger)
- tablet.webp - Image for tablet landscape view (recommended: 768x1024 or similar)
- mobile.webp - Image for mobile/tablet portrait view (recommended: 375x667 or similar)
Note: The placeholder images included are SVG files for demonstration purposes. Replace them with your actual WebP images.
npm run devThe website will be available at http://localhost:5173
npm run buildThe optimized files will be in the dist/ folder, ready to deploy.
The component automatically selects the appropriate image based on:
- Width >= 1024px → desktop.webp (desktop)
- 768px <= Width < 1024px
- Portrait (height > width) → mobile.webp (tablet portrait)
- Landscape → tablet.webp (tablet landscape)
- Width < 768px → mobile.webp (mobile)
For best results, use these dimensions:
| Device | Image | Recommended Size |
|---|---|---|
| Desktop | desktop.webp | 1920x1080 or larger |
| Tablet Landscape | tablet.webp | 1024x768 or 1366x768 |
| Mobile/Tablet Portrait | mobile.webp | 375x667 or 768x1024 |
The application can be easily deployed using Docker. A Docker container hosts the website on port 8024.
- Docker installed on your system
- Docker Compose (optional, for easier deployment)
# Build and start the container
docker-compose up -d
# The website will be available at http://localhost:8024
# Stop the container
docker-compose down
# View logs
docker-compose logs -f# Build the Docker image
docker build -t routeexit .
# Run the container on port 8024
docker run -d -p 8024:8024 --name routeexit-web routeexit
# The website will be available at http://localhost:8024
# Stop the container
docker stop routeexit-web
docker rm routeexit-web
# View logs
docker logs -f routeexit-web- Image: Multi-stage build using Node.js Alpine
- Port: 8024 (configurable in docker-compose.yml)
- Server:
servepackage for serving static files - Health Check: Enabled with 30-second intervals
The built site can be deployed to any static hosting service:
- Vercel
- Netlify
- GitHub Pages
- Any web server (AWS S3, Firebase, etc.)
Works in all modern browsers supporting:
- ES6+ JavaScript
- CSS3 (object-fit: cover)
- WebP images
To modify the breakpoints, edit src/App.jsx and adjust the pixel values in the getImageForViewport() function:
if (width >= 1024) {
// Adjust this value for desktop breakpoint
return '/desktop.webp'
}- React - UI framework
- Vite - Build tool
- CSS3 - Styling
Start the container with a single command:
docker compose up -dThe website will be accessible at http://localhost:8024
To stop the container:
docker compose downView logs:
docker compose logs -fBuild the image:
docker build -t routeexit .Run the container:
docker run -d -p 8024:8024 --name routeexit-web routeexitAccess at http://localhost:8024
Stop and remove:
docker stop routeexit-web
docker rm routeexit-web- Base Image: nginx:alpine (production-optimized)
- Build Stage: node:20-alpine (for building)
- Port: 8024
- Health Check: Enabled (30-second intervals)
- File Size: ~40MB (multi-stage build optimization)