Modern, fast, SEO-friendly marketing site for an Australian family GP practice. Built with Next.js 14 (App Router) + React 18 + Tailwind CSS.
- Modular components (
/components) — clean and reusable - Content-driven pages via plain JS data files (
/data) — easy to extend - Dynamic detail pages for Services (
/services/[slug]) and Doctors (/team/[slug]) - Admin dashboard at
/admin— log in to add or remove doctor profiles (with image upload) from the front end - Vacancies / Careers page at
/vacancies - SEO: per-page metadata, sitemap, robots, Open Graph + JSON-LD (MedicalClinic schema)
- Security: strict CSP + HSTS + security headers in
next.config.mjsand.htaccess - Accessibility: skip link, semantic landmarks, keyboard-friendly nav
- Deployable to cPanel → Setup Node.js App via
server.js
npm install
npm run devnpm run build
npm start # uses `next start` on $PORT (default 3000)
# or, for cPanel:
npm run start:cpanel # runs server.jsapp/
admin/ # /admin login + doctors management UI (auth-gated)
api/admin/ # JSON API: login, logout, doctors CRUD + image upload
team/ # /team list + /team/[slug] detail (reads from data/doctors.json)
vacancies/ # /vacancies careers page
...
components/ # Header, Footer, Hero, ServiceCard, DoctorCard, ...
data/
site.js # phone, email, address, hours, nav
services.js # services content (static)
doctors.json # doctor records (managed via /admin)
doctors.js # re-exports getDoctors / getDoctor for legacy imports
lib/
doctors.js # JSON read/write helpers for doctor records
auth.js # signed-cookie session for the admin UI
public/
uploads/ # admin-uploaded doctor portraits land here at runtime
logo/, favicon.ico, ...
server.js # cPanel Node.js entrypoint
next.config.mjs # security headers + image config
tailwind.config.js
- Visit
/admin/login, sign in with the admin credentials. - Open Manage Doctors.
- Fill out the form (name, role, credentials, languages, special interests, education, bio) and either upload a photo or paste an image URL.
- Click Add doctor — the new profile appears immediately on
/teamand at/team/<slug>. - To remove a doctor, click the trash icon next to their name in the list.
Records are persisted in data/doctors.json. Uploaded images are saved to public/uploads/.
Editing
data/doctors.jsonby hand still works if you prefer a code-based workflow.
Edit data/services.js. Each entry creates a detail page at /services/<slug>.
Static placeholders live under public/images/. Replace them with real, optimised JPG/WEBP photos while keeping the same file names (or update the image: field in the relevant data file).
Edit data/site.js — phone, email, address, opening hours, nav and social links all come from here.
- In cPanel open Setup Node.js App → Create Application.
- Node version: 18+ · Mode: Production · Application root: this folder (upload via File Manager or Git).
- Application startup file:
server.js. - Add the environment variables below (Setup Node.js App → Environment variables):
NODE_ENV=productionADMIN_USERNAME=admin(or whatever you want)ADMIN_PASSWORD=a long, random passwordADMIN_SESSION_SECRET=a long random string (32+ chars)
- Click Run NPM Install.
- Open the virtual environment terminal (button in cPanel) and run:
npm run build
- Make sure
data/andpublic/uploads/are writable by the Node user (cPanel usually sets this automatically; if not, set them to755). - Back on the Node.js App page, click Restart.
- cPanel proxies your domain to the Node process automatically.
Persistence note —
data/doctors.jsonandpublic/uploads/hold runtime data. When you re-upload the project, do not overwrite these or you will lose admin-managed doctors and uploaded photos. Use Git or copy them off the server before redeploying.
| Variable | Purpose | Default (insecure!) |
|---|---|---|
ADMIN_USERNAME |
Admin login username | admin |
ADMIN_PASSWORD |
Admin login password | change-me-please |
ADMIN_SESSION_SECRET |
Used to sign the session cookie | derived from ADMIN_PASSWORD |
PORT |
HTTP port — set by cPanel automatically | 3000 |
Always set a strong
ADMIN_PASSWORDandADMIN_SESSION_SECRETin production. The defaults are placeholders to allow local testing only.
- Semantic HTML + accessible landmarks
- Per-page
<title>+ description viametadataexport - Open Graph + Twitter cards
-
sitemap.xml(auto) +robots.txt(auto, blocks/adminand/api) - JSON-LD
MedicalClinicstructured data - Canonical URLs, correct language (
en-AU) - Optimised images via
next/image
- Strict-Transport-Security (HSTS)
- Content-Security-Policy
- X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy
-
poweredByHeader: false - Honeypot field in contact form
- HTTPS redirect in
.htaccess - Admin auth via signed HMAC cookie + httpOnly + secure in production
- Robots disallow on
/adminand/api
- Wire up
components/ContactForm.jsxto your SMTP / HubSpot / CRM endpoint. - Replace
site.url, phone, email and address indata/site.js. - Swap placeholder images in
public/images/. - Add real doctor profiles via the
/adminUI.