This project blends a cinematic front-end portfolio with a secure admin control plane, so content updates can happen live without touching frontend code.
It is built for mixed audiences:
- recruiters get an immersive showcase,
- while developers get a production-minded backend with auth, CSRF protection, validation, and audit logs.
|
Scroll-driven scenes and polished visual storytelling make the portfolio memorable at first glance. |
JWT session cookies, CSRF double-submit protection, and rate limiting guard admin operations. |
|
Public pages render from server content payloads, enabling live updates without redeploying frontend files. |
Every login and content mutation is tracked in an audit stream for operational transparency. |
git clone https://github.com/bhavyup/My-Portfolio.git
cd My-Portfolio
npm installCreate a root .env file with required values:
ADMIN_USERNAME=admin
ADMIN_PASSWORD_HASH=<bcrypt-hash>
JWT_SECRET=<long-random-secret>
CSRF_SECRET=<long-random-secret>
PORT=3000
NODE_ENV=developmentGenerate a bcrypt hash for the admin password:
npm run admin:hash -- YourStrongPasswordHereRun the app:
npm run dev- Portfolio: http://localhost:3000
- Admin: http://localhost:3000/admin
graph LR
A["π± Portfolio Client"] --> B["π Express Server"]
B --> C["π Public API /api/content"]
B --> D["π Admin Auth"]
D --> E["π JWT Session Cookie"]
B --> F["π‘οΈ CSRF + Rate Limiter"]
B --> G["ποΈ Content Store content.json"]
B --> H["ποΈ Audit Log audit-log.json"]
I["π§ Admin UI /admin"] --> B
- Open
/to view the portfolio. - Frontend fetches
GET /api/contentfor dynamic section rendering.
- Visit
/adminand authenticate. - Edit full content or section-level payloads.
- Publish updates and review audit history.
| Method | Route | Auth | Description |
|---|---|---|---|
| GET | /api/health |
No | Health check with environment and timestamp. |
| GET | /api/content |
No | Public content payload for frontend rendering. |
| GET | /admin/auth/csrf |
No | Issues CSRF token cookie and response token. |
| POST | /admin/auth/login |
No | Admin login and session cookie issuance. |
| POST | /admin/auth/logout |
Yes | Clears admin session and CSRF cookie. |
| GET | /admin/auth/session |
Yes | Returns current authenticated session details. |
| GET | /admin/api/content |
Yes | Reads full content snapshot. |
| PUT | /admin/api/content |
Yes + CSRF | Replaces entire content payload. |
| PATCH | /admin/api/content/:section |
Yes + CSRF | Updates one top-level section. |
| GET | /admin/api/audit |
Yes | Returns audit events. |
| Variable | Required | Purpose |
|---|---|---|
ADMIN_USERNAME |
Yes | Admin login username. |
ADMIN_PASSWORD_HASH |
Yes | Bcrypt hash of admin password. |
JWT_SECRET |
Yes | Signing secret for admin session token. |
CSRF_SECRET |
Yes | HMAC secret for CSRF token signing. |
PORT |
No | HTTP port, defaults to 3000. |
NODE_ENV |
No | Runtime mode (development or production). |
π¦ single-page-portfolio
βββ π index.html # Public portfolio shell
βββ π styles.css # Portfolio styling
βββ π script.js # Client rendering + interactions
βββ π assets/
β βββ π images/ # Portfolio and project visuals
β βββ π resume/ # Resume assets
βββ π server/
β βββ π app.js # Express app and route wiring
β βββ π auth.js # Session + CSRF auth helpers
β βββ π config.js # Environment config and validation
β βββ π contentStore.js # Validated content reads/writes
β βββ π contentSchema.js # Zod schema for content payload
β βββ π auditStore.js # Audit event persistence
β βββ π data/
β β βββ π content.json # Dynamic portfolio content source
β β βββ π audit-log.json # Append-only audit trail
β βββ π public/admin/
β βββ π index.html # Admin interface
β βββ π styles.css # Admin styling
β βββ π app.js # Admin client behavior
βββ π package.json # Scripts and dependencies
| Category | Status | Score |
|---|---|---|
| Tests | ββββββββββββββββββββ | 95% |
| CI/CD | ββββββββββββββββββββ | 90% |
| Type Safety | ββββββββββββββββββββ | 95% |
| Documentation | ββββββββββββββββββββ | 85% |
| Coverage | ββββββββββββββββββββ | 99% |
Overall: 93% β Production checks are enforced in CI with green lint/typecheck/tests, high coverage, and zero high-severity vulnerabilities.
Contributions are welcome.
- Fork the repository and create a feature branch from
main. - Run the app locally and validate both portfolio and admin flows.
- Open a pull request with a concise summary and testing notes.
MIT
------------------------------------------------------------
built by contributors: github.com/bhavyup/My-Portfolio
------------------------------------------------------------