diff --git a/.env.example b/.env.example index 213bd66..9c87058 100644 --- a/.env.example +++ b/.env.example @@ -16,3 +16,10 @@ GITHUB_TOKEN= # Exact origin(s) allowed to call /api/* (your deployed domain). ALLOWED_ORIGIN=https://mudabbir.co.uk PORT=3001 + +# Encryption in transit. Pick ONE: +# a) Terminate TLS in this server: paths to PEM files (e.g. Let's Encrypt). +# TLS_CERT=/etc/letsencrypt/live/example.com/fullchain.pem +# TLS_KEY=/etc/letsencrypt/live/example.com/privkey.pem +# b) Behind a TLS reverse proxy: redirect any plain-HTTP request to HTTPS. +# FORCE_HTTPS=true diff --git a/.gitignore b/.gitignore index f16da9a..43ce681 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,8 @@ public/CV/* # Local env / editor cruft *.local .DS_Store + +# Local scratch +.claude/ +.gh-*.json +scripts/diff-tracker.mjs diff --git a/DEPLOY.md b/DEPLOY.md new file mode 100644 index 0000000..61933b8 --- /dev/null +++ b/DEPLOY.md @@ -0,0 +1,20 @@ +# Deploying + +## Adding project images +1. Copy the files into `public/images/projects/`. +2. Add the filenames under the project's id in `src/project-images.json`. + Several filenames = carousel. + +## First-time server setup +1. `git clone` the repo, then create `secrets/.env` from `.env.example` + (set `VITE_*` values, `GITHUB_TOKEN` (read-only PAT), `ALLOWED_ORIGIN`, and + either `TLS_CERT`/`TLS_KEY` or `FORCE_HTTPS=true` behind a TLS proxy). +2. Put your CV at `public/CV/` (gitignored, so copy it over manually). +3. `npm run deploy` — installs, builds, and starts the server (default port 3001). + +## Updating +``` +git pull && npm run setup && npm run build +``` +then restart the process (systemd/pm2). The token lives only in `secrets/.env` +and is only ever used by `server/index.js`; the browser never sees it. diff --git a/package.json b/package.json index 80e45d8..9a842cb 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,10 @@ "scripts": { "dev": "vite", "build": "vite build", - "preview": "vite preview" + "preview": "vite preview", + "setup": "npm ci && npm ci --prefix server", + "start": "node server/index.js", + "deploy": "npm run setup && npm run build && npm start" }, "dependencies": { "@tailwindcss/vite": "^4.3.3", diff --git a/public/images/projects/README.txt b/public/images/projects/README.txt new file mode 100644 index 0000000..57c673a --- /dev/null +++ b/public/images/projects/README.txt @@ -0,0 +1,6 @@ +Drop project screenshots here, then list the filenames in src/project-images.json: + + "mass": ["mass-1.png", "mass-2.png", "mass-3.png"] + +One filename = a single picture. Two or more = a carousel (arrows, dots, keyboard +left/right). Leave the list empty to keep the default artwork. diff --git a/server/index.js b/server/index.js index cff61c6..47a80c6 100644 --- a/server/index.js +++ b/server/index.js @@ -14,6 +14,9 @@ import express from "express"; import cors from "cors"; import helmet from "helmet"; import rateLimit from "express-rate-limit"; +import fs from "node:fs"; +import http from "node:http"; +import https from "node:https"; import path from "node:path"; import { fileURLToPath } from "node:url"; import dotenv from "dotenv"; @@ -24,6 +27,13 @@ dotenv.config({ path: path.resolve(__dirname, "../secrets/.env") }); const TOKEN = process.env.GITHUB_TOKEN || ""; const ALLOWED_ORIGIN = process.env.ALLOWED_ORIGIN || "http://localhost:5173"; const PORT = Number(process.env.PORT) || 3001; +// Encryption in transit. Either terminate TLS here (TLS_CERT + TLS_KEY paths to +// PEM files) or sit behind a TLS proxy and set FORCE_HTTPS=true so plain-HTTP +// requests are redirected. Either way the GitHub token stays server-side and +// the upstream call to api.github.com is always HTTPS. +const TLS_CERT = process.env.TLS_CERT || ""; +const TLS_KEY = process.env.TLS_KEY || ""; +const FORCE_HTTPS = process.env.FORCE_HTTPS === "true"; const WEEKS = 53; const CACHE_TTL_MS = 10 * 60 * 1000; // one shared cache entry; this is a single-user site @@ -125,8 +135,14 @@ async function fetchContributions() { const app = express(); app.set("trust proxy", 1); // behind Nginx Proxy Manager, needed for correct rate-limit IPs +if (FORCE_HTTPS) { + app.use((req, res, next) => + req.secure ? next() : res.redirect(308, `https://${req.headers.host}${req.originalUrl}`) + ); +} app.use( helmet({ + hsts: { maxAge: 63072000, includeSubDomains: true, preload: true }, contentSecurityPolicy: { directives: { defaultSrc: ["'self'"], @@ -165,7 +181,12 @@ const distPath = path.resolve(__dirname, "../dist"); app.use(express.static(distPath)); app.get(/^(?!\/api).*/, (req, res) => res.sendFile(path.join(distPath, "index.html"))); -app.listen(PORT, () => { - console.log(`portfolio server listening on :${PORT}`); +const server = + TLS_CERT && TLS_KEY + ? https.createServer({ cert: fs.readFileSync(TLS_CERT), key: fs.readFileSync(TLS_KEY) }, app) + : http.createServer(app); + +server.listen(PORT, () => { + console.log(`portfolio server listening on :${PORT} (${TLS_CERT && TLS_KEY ? "HTTPS" : "HTTP"})`); if (!TOKEN) console.warn("GITHUB_TOKEN not set, /api/contributions will return 501"); }); diff --git a/src/components/ImageCarousel.jsx b/src/components/ImageCarousel.jsx new file mode 100644 index 0000000..92800b4 --- /dev/null +++ b/src/components/ImageCarousel.jsx @@ -0,0 +1,39 @@ +import { useState } from "react"; + +// Single image renders as a plain picture; several render as a carousel with +// arrows, dots, and scroll-snap swiping. +export default function ImageCarousel({ images }) { + const [i, setI] = useState(0); + if (images.length === 1) return ; + const go = (n) => setI((n + images.length) % images.length); + return ( +
{ + if (e.key === "ArrowLeft") go(i - 1); + if (e.key === "ArrowRight") go(i + 1); + }} + > +
+ {images.map((src, n) => ( + + ))} +
+ + +
+ {images.map((src, n) => ( +
+
+ ); +} diff --git a/src/components/Projects.jsx b/src/components/Projects.jsx index 45fe04c..a7846fb 100644 --- a/src/components/Projects.jsx +++ b/src/components/Projects.jsx @@ -1,6 +1,15 @@ import { useEffect, useRef, useState } from "react"; import { AnimatePresence, motion, useReducedMotion } from "motion/react"; import { projects } from "../content.js"; +import ImageCarousel from "./ImageCarousel.jsx"; +import projectImages from "../project-images.json"; + +// Images listed in src/project-images.json (files live in public/images/projects/); +// falls back to the project's default artwork. +function imagesFor(p) { + const list = (projectImages[p.id] || []).map((f) => `/images/projects/${f}`); + return list.length ? list : [p.image]; +} function Tag({ children, variant }) { return {children}; @@ -124,7 +133,7 @@ export default function Projects() { - +

{selected.title}

diff --git a/src/content.js b/src/content.js index b6f1e36..3704148 100644 --- a/src/content.js +++ b/src/content.js @@ -35,7 +35,7 @@ export const profile = { about: [ "I'm a recent graduate software engineer based in London. I studied Computer Science at first-class level, and spent my degree building real systems: a media aggregation & sorting system for my final-year project, mobile apps with React Native, and coursework that pushed me to think like an engineer, not just a coder.", - "Outside of work I run a home lab: a Proxmox host carrying a stack of self-hosted services, three cloud VPS instances, and a growing interest in running local AI models on my own hardware. If it can be self-hosted, I've probably tried to.", + "Outside of my studies, I run a home lab: a Proxmox host carrying a stack of self-hosted services, three cloud VPS instances, and a growing interest in running local AI models on my own hardware. If it can be self-hosted, I've probably tried to.", ], }; @@ -115,6 +115,7 @@ export const interests = [ // the long-form write-up for the expanded view; `image` is its art. export const projects = [ { + id: "mass", title: "MASS: Media Aggregation & Sorting System", year: "2026", role: "Final-year project · Solo", @@ -134,6 +135,7 @@ export const projects = [ highlight: true, }, { + id: "radar", title: "Hardware Tinkering: 240 GHz Doppler Radar", role: "Hardware project · ESP32", description: @@ -150,6 +152,7 @@ export const projects = [ stack: ["ESP32", "Arduino"], }, { + id: "qr-hunt", title: "QR Code Treasure Hunt", year: "2024", role: "Group project · Year 2 final coursework", @@ -167,6 +170,7 @@ export const projects = [ repo: `https://github.com/${GITHUB_USER}/Treasure-Hunt-App`, }, { + id: "crudl", title: "CRUDL: React Native Demo", year: "2024", role: "University project", @@ -184,6 +188,7 @@ export const projects = [ repo: `https://github.com/${GITHUB_USER}/Project-MAD-crudler`, }, { + id: "routines", title: "Routines App", year: "2024", role: "Personal project · Android", @@ -201,6 +206,7 @@ export const projects = [ repo: `https://github.com/${GITHUB_USER}/Kotlin-TB2P1`, }, { + id: "geo-hunt", title: "Location-Based Treasure Hunt App", year: "2024", role: "University project · Mobile Development", @@ -218,6 +224,7 @@ export const projects = [ repo: `https://github.com/${GITHUB_USER}/MAD-Treasure-Hunt`, }, { + id: "ai-bot", title: "AI Discord Bot", year: "2025", role: "Personal project · Self-hosted", @@ -235,6 +242,7 @@ export const projects = [ tags: ["Private-Repo"], }, { + id: "cv-builder", title: "CV Builder", year: "2024/2025", role: "Personal project · Desktop", @@ -354,7 +362,7 @@ export const skills = { export const homelab = [ { name: "Proxmox", detail: "Single-node hypervisor running the whole stack" }, - { name: "Jellyfin + own media server", detail: "Self-hosted streaming (media server WIP)" }, + { name: "Own Media Server", detail: "Self-hosted streaming (WIP)" }, { name: "SearXNG", detail: "Private metasearch engine" }, { name: "Dockhand", detail: "Container management UI" }, { name: "Nginx", detail: "Reverse proxy for the house network" }, @@ -373,20 +381,20 @@ export const homelab = [ export const localAI = { heading: "Local AI, on my own hardware", body: [ - "I run self-hosted language models on hardware I own, currently a custom flavour of Qwen 3.8 27B served through LM Studio and OpenWebUI, as a way to learn how LLMs actually work under the hood: inference, context, and serving.", - "It's not just theory: my Discord bot pairs a Cloud Gemma 4 31B-IT model for text chat and voice with a local Gemma 4 E4B QAT fallback.", + "I run my own self-hosted language models on my own hardware. Currently running a custom flavour of a quantised Qwen 3.8 27B Model served through BeeLLama over to my OpenWebUI instance running on my HomeLab, as a way to learn on how to deploy and utilise LLMs in the modern day world and also help me study how they work in a more fundamental sense, when it comes down to their inference, context management and serving it.", + "It's not just Local Models I utilise, I make use of a mix of both Local and Cloud hosted models in my own applications such as an AI Model Powered Discord Chat Bot, a discord bot capable of interacting with users both in Text format and also in Voice Calls, with the goal of acting like a regular human user. This pushes me towards building and writing code that works with both small and larger models which would react to certain prompts differently.", ], }; // Self-assessed working proficiency, not a byte share: weighted by how many // projects were built in each language and current fluency, not raw lines. -// Java leads; C++/Go mid-band; Python eased down (fewer recent projects); +// Java leads; C++ ahead of Python; Go mid-band; // JS/CSS raised on project count; TypeScript low, known via JavaScript only. export const languageStats = [ { name: "Java", pct: 56 }, { name: "JavaScript", pct: 48 }, - { name: "Python", pct: 28 }, - { name: "C++", pct: 22 }, + { name: "C++", pct: 28 }, + { name: "Python", pct: 22 }, { name: "Go", pct: 18 }, { name: "CSS", pct: 16 }, { name: "TypeScript", pct: 14 }, diff --git a/src/index.css b/src/index.css index 9e1b812..335af1c 100644 --- a/src/index.css +++ b/src/index.css @@ -1407,3 +1407,60 @@ html.has-custom-cursor * { animation: none; } } + +/* Project image carousel */ +.pm-carousel { + position: relative; + overflow: hidden; + border-bottom: 1px solid var(--hairline); +} +.pm-carousel-track { + display: flex; + transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1); +} +.pm-carousel-track .pm-image { + flex: 0 0 100%; + border-bottom: 0; +} +.pm-arrow { + position: absolute; + top: 50%; + transform: translateY(-50%); + width: 38px; + height: 38px; + border-radius: 999px; + border: 1px solid var(--hairline-strong); + background: var(--surface); + color: var(--ink); + font-size: 22px; + line-height: 1; + cursor: pointer; +} +.pm-arrow--prev { left: 12px; } +.pm-arrow--next { right: 12px; } +.pm-dots { + position: absolute; + bottom: 10px; + left: 0; + right: 0; + display: flex; + justify-content: center; + gap: 8px; +} +.pm-dot { + width: 9px; + height: 9px; + padding: 0; + border-radius: 999px; + border: 1px solid var(--surface); + background: rgba(19, 17, 24, 0.45); + cursor: pointer; +} +.pm-dot--on { background: var(--accent); } +.pm-arrow:focus-visible, .pm-dot:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 2px; +} +@media (prefers-reduced-motion: reduce) { + .pm-carousel-track { transition: none; } +} diff --git a/src/project-images.json b/src/project-images.json new file mode 100644 index 0000000..08c64a4 --- /dev/null +++ b/src/project-images.json @@ -0,0 +1,11 @@ +{ + "_help": "Drop image files into public/images/projects/ then list their filenames under the project id. One image = static picture; several = a swipeable carousel. Projects not listed (or with an empty list) fall back to their default artwork.", + "mass": [], + "radar": [], + "qr-hunt": [], + "crudl": [], + "routines": [], + "geo-hunt": [], + "ai-bot": [], + "cv-builder": [] +}