A lightweight student artwork archive. The existing Next.js site remains available at /; the plain HTML, CSS, and JavaScript pages are /index.html, /upload.html, /artwork.html, and /admin.html. Uploads are compressed in the browser, stored as hosted image URLs, and recorded as metadata in Postgres.
pnpm install
pnpm devThe app uses the production artwork backend by default. To override it locally or in Vercel, set ART_BACKEND_URL to either the backend base URL or the full artwork endpoint:
ART_BACKEND_URL=https://gapim.onrender.comThe app adds /api/artworks when only a backend base URL is provided. In Vercel, add an override under Project Settings → Environment Variables only if needed, then redeploy. Keep it server-only: do not rename it to NEXT_PUBLIC_ART_BACKEND_URL. Both the Next.js pages and the plain HTML pages call the same-origin /api/artworks route; that route proxies reads, QR ID lookups, uploads, and updates to Express. This avoids browser-to-Render CORS configuration and keeps the backend URL out of browser code. Locally, restart pnpm dev after changing .env.local.
Open /admin (or /admin.html) and sign in with the server-only ADMIN_PASSWORD environment variable. Set a long, unique password in .env.local for local work and in Vercel's environment settings for production. The password is never sent to the artwork backend; a signed, HTTP-only, same-site session cookie protects admin listing and update routes, including the legacy update endpoint. Admins can inspect every field returned for an artwork and update its title, description, or image. Image replacement still uses the backend's Cloudinary upload. The backend itself should also require admin authorization for direct update requests.
The current artwork API returns at most 200 newest records. The dashboard can only show records the backend returns; older records require pagination support from the backend. Deletion is not exposed because the documented backend API has no delete operation. The light/dark mode preference is shared across the app and static pages.
The camera scanner uses the browser's native BarcodeDetector when available and falls back to ZXing for QR and linear barcodes. Browsers require camera access over HTTPS or localhost; scanned image frames are not uploaded.
The Express service at ART_BACKEND_URL owns database writes and Cloudinary uploads. Configure DATABASE_URL and either CLOUDINARY_URL or CLOUDINARY_CLOUD_NAME, CLOUDINARY_API_KEY, and CLOUDINARY_API_SECRET in the backend host's environment (Render for this deployment). Optionally configure CLOUDINARY_FOLDER. Never put these credentials in Vercel variables or frontend code.
A ready-to-copy Express/TypeScript backend starter with the Postgres schema, Cloudinary uploads, admin update authorization, and Render setup steps is in backend-template/README.md. Set the same random ADMIN_API_TOKEN on the backend and ART_BACKEND_ADMIN_TOKEN on the frontend so the admin proxy can authenticate updates.
The backend should accept GET /api/artworks for a list, GET /api/artworks?id=<barcode_id> (or ?barcode_id=...) for one record, POST /api/artworks as multipart fields title, description, and image, and PUT /api/artworks?id=<barcode_id> to update metadata and optionally replace image. Return JSON records with barcode_id (or legacy qr_id), title, description, and image_url. The backend uploads image bytes to Cloudinary and returns its hosted image_url; the browser displays that URL, while the database stores metadata and image references. The frontend compresses images before sending them through the Next.js proxy, so Cloudinary secrets never reach the user’s browser.
The QR label points to this site's /artwork.html?id=<barcode_id> page, not to the Render API. A label generated locally will use the local site origin; generate production labels from the deployed site so they open for users.
The feed returns up to 200 newest records as an array. GET /api/artworks?id=<barcode_id> (or ?barcode_id=<barcode_id>) returns one record; the legacy qr_id is also accepted. POST /api/artworks accepts multipart fields title, description, and image, then returns the saved row with its generated barcode_id and legacy qr_id. PUT /api/artworks?id=<barcode_id> updates any supplied title and/or description field using JSON or multipart data, and optionally replaces the image with an image file. It returns 404 for an unknown ID and 400 for invalid or empty updates. When replacing an image, the previous Cloudinary file is removed after the database update succeeds.
Each artwork has a database-generated UUID barcode_id. The printed Code 128 barcode contains this text:
ARTWORK:<barcode_id>
For example:
ARTWORK:7d3b6b89-9d6d-4c28-9c52-6f74c9151d32
The scanner removes the ARTWORK: prefix and requests GET /api/artworks?id=7d3b6b89-9d6d-4c28-9c52-6f74c9151d32. The QR code on the same label encodes the viewer URL, https://<your-site>/artwork.html?id=<barcode_id>, so a phone's built-in QR scanner can open the artwork directly. The browser camera scanner supports Code 128 with its native detector or ZXing fallback.
Image bytes go to Cloudinary; only image_url, its Cloudinary public ID, and artwork metadata are stored in Postgres. Never expose database or Cloudinary secrets in frontend code.
The upload page downsizes images to at most 1800 pixels and JPEG quality 0.82 before sending them. QR and Code 128 labels are generated in the browser using qrcodejs and JsBarcode from public CDNs; both can be printed, and each code can be downloaded.