How is-nao/portfolio-nuxt works
Project type and purpose
• This is a full-stack, edge-deployed Nuxt 3 application scaffolded for NuxtHub on Cloudflare (or any edge platform).
• Purpose:
• Frontend SPA/SSR using app/ (Nuxt 3’s app directory).
• Backend HTTP APIs and server middleware under server/ for images, messages, redirects.
• Integrates with NuxtHub storage primitives (hubBlob, hubDatabase, hubKV) and cachedEventHandler.
File structure
• Top-level directories:
• app/ – Vue single-file components (pages and reusable components).
• server/ – API handlers (server/api) and route handlers (server/routes), plus middleware.
• docker/ & compose.yaml – containerization.
• Key config files:
• nuxt.config.ts – NuxtHub and module config.
• .github/workflows – CI/CD for nuxthub deploy.
• docker/nuxt.Dockerfile & compose.yaml – local/container dev.
• Patterns:
• Nuxt 3 file-based routing (app/pages, server/api).
• Separation of concerns: UI, API, storage, caching.
Extract insights from README
• Uses hubBlob() for image uploads.
• Uses hubDatabase() for persisting chat messages.
• Uses hubKV() for storing redirect mappings.
• Uses cachedEventHandler() to cache arbitrary API responses.
• Deploys as edge functions on Cloudflare via nuxthub.
Main components
a. Frontend
• Nuxt 3 SSR entry point (app/pages/index.vue).
• Components: ImageGallery.vue, MessagesPanel.vue, RedirectsPanel.vue.
b. Backend/API layer
• server/api/images, server/api/messages, server/api/redirects endpoints.
• server/middleware/redirects.ts to intercept and redirect routes.
c. Storage services
• Blob store (hubBlob) for image binaries.
• Database (hubDatabase) for chat messages.
• Key-Value store (hubKV) for redirect rules.
• In-memory/cache layer via cachedEventHandler.
d. Deployment/runtime
• Edge runtime (Cloudflare Workers or similar).
• CDN/static assets (public/).
• Docker local dev environment.
Relationships and data flows
• Client browser ↔ Edge-deployed Nuxt 3 server (SSR + API).
• Frontend calls REST-ish APIs under /api:
• GET/POST /api/images → hubBlob
• GET/POST /api/messages → hubDatabase
• GET/PUT /api/redirects → hubKV
• server/middleware reads KV on every request to apply redirects.
• cachedEventHandler wraps selected API calls for in-edge caching.
Highlighted architectural patterns and principles
• File-based routing for pages and serverless functions.
• Single repo monorepo style: UI and backend in one codebase.
• Edge-first architecture: SSR and APIs run at CDN edge.
• Separation of concerns:
• UI components under app/
• API handlers under server/api/
• Domain logic for caching and middleware under server/.