Skip to content

bhavyup/Single-Page-Portfolio

Repository files navigation

CI Coverage Tests Audit Version

Stars Forks Issues Last Commit

JavaScript Node.js Express Jest Zod Security

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.

Highlights

Cinematic Experience

Scroll-driven scenes and polished visual storytelling make the portfolio memorable at first glance.

Secure Admin Plane

JWT session cookies, CSRF double-submit protection, and rate limiting guard admin operations.

Dynamic Content API

Public pages render from server content payloads, enabling live updates without redeploying frontend files.

Auditable Publishing

Every login and content mutation is tracked in an audit stream for operational transparency.

Quick Start

git clone https://github.com/bhavyup/My-Portfolio.git
cd My-Portfolio
npm install

Create 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=development

Generate a bcrypt hash for the admin password:

npm run admin:hash -- YourStrongPasswordHere

Run the app:

npm run dev

Architecture

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
Loading

Usage

Public Mode

  • Open / to view the portfolio.
  • Frontend fetches GET /api/content for dynamic section rendering.

Admin Mode

  • Visit /admin and authenticate.
  • Edit full content or section-level payloads.
  • Publish updates and review audit history.

API Reference

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.

Configuration

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).

Project Structure

πŸ“¦ 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

Project Health

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.

Contributing

Contributions are welcome.

  1. Fork the repository and create a feature branch from main.
  2. Run the app locally and validate both portfolio and admin flows.
  3. Open a pull request with a concise summary and testing notes.

License

MIT

------------------------------------------------------------
 built by contributors: github.com/bhavyup/My-Portfolio
------------------------------------------------------------

About

My Portfoliio

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors