Skip to content
Lab-Member-0010Public

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jayesh Sharma — Full Stack Engineer

A bold, editorial developer portfolio — with its own admin portal.

React TypeScript Vite FastAPI SQLAlchemy JWT Vercel Neon

Quickstart · Features · Screenshots · Architecture · Admin · API · Deploy


✦ What's inside

🖥️ The portfolio

  • Oversized editorial typography, outlined name, rotating stamp, scrolling marquee
  • Live network canvas that reacts to your cursor
  • Expandable project rows, count-up stats, scroll-progress bar, reveal-on-scroll
  • Credentials with viewable certificate PDFs
  • Working contact form (honeypot + rate limit)
  • Fully responsive, respects prefers-reduced-motion

🔐 The admin portal — /admin

  • JWT login, password change
  • Edit every word on the site, no redeploy
  • Create · edit · hide · delete · reorder projects, facts, timeline, skills, certifications, life cards
  • Upload résumé and certificate PDFs
  • Inbox for contact-form messages
  • Lazy-loaded — zero cost to public visitors

📸 A look around

Hero Mobile
Mobile
Projects
🔎 More of the public site — credentials, beyond the screen
Credentials Beyond the screen
Credentials Beyond the screen
🛠️ Peek inside the admin portal — login, dashboard, lists, editor
Login Dashboard
Admin login Admin dashboard
Collections Editor
Admin projects list Admin edit modal

⚡ Quickstart

You need: Python 3.10+ and Node 20+.

1 · Start the API

cd backend
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env          # ← change JWT_SECRET and ADMIN_PASSWORD
uvicorn app.main:app --reload --port 8000

2 · Start the site (new terminal)

cd frontend
npm install
npm run dev

3 · Open it

URL
🌐 Portfolio http://localhost:5173
🔐 Admin http://localhost:5173/admin — admin@example.com / ChangeMe123! (from .env)
📚 API docs (Swagger) http://localhost:8000/docs
🪟 On Windows?
cd backend
py -m venv .venv; .venv\Scripts\Activate.ps1
pip install -r requirements.txt
copy .env.example .env
uvicorn app.main:app --reload --port 8000
🤔 What happens on first start?
  1. portfolio.db (SQLite) is created next to the backend.
  2. All content is seeded from the résumé — projects, experience, skills, certifications, life cards.
  3. An admin user is created from ADMIN_EMAIL / ADMIN_PASSWORD.
  4. Upgrading an older database? Restart and services/migrations.py applies content fixes — only to values you haven't edited in the admin.

🧭 How it works

flowchart LR
    V([👤 Visitor]) -->|"/"| R
    A([🔐 You]) -->|"/admin"| R
    subgraph FE["frontend · React + Vite"]
        R[React Router] --> P[Portfolio page]
        R -.lazy.-> AD[Admin app]
    end
    P -->|GET /api/portfolio| API
    P -->|POST /api/messages| API
    AD -->|Bearer JWT| API
    subgraph BE["backend · FastAPI"]
        API[Routers] --> S[Services]
        S --> DB[(SQLite / Neon Postgres)]
        S --> F[/PDFs · disk or Vercel Blob/]
    end
Loading
🔁 What happens when you hit “Save” in the admin?
sequenceDiagram
    autonumber
    actor You
    participant Admin as Admin UI
    participant API as FastAPI
    participant DB as Database
    actor Visitor
    You->>Admin: Edit project → Save
    Admin->>API: PUT /api/admin/projects/3 (Bearer token)
    API->>API: Verify JWT · validate with Pydantic
    API->>DB: UPDATE projects
    API-->>Admin: 200 + updated project
    Admin-->>You: ✅ toast “Project saved”
    Visitor->>API: GET /api/portfolio
    API->>DB: published items, ordered
    API-->>Visitor: fresh content — no redeploy
Loading
🗃️ Content model
erDiagram
    SITE_SECTIONS {
        string key PK "hero, about, contact..."
        json data "editable copy"
    }
    PROJECTS {
        int id PK
        string title
        string category
        text summary
        json tags
    }
    FACTS {
        int id PK
        string value
        string suffix
        string label
    }
    TIMELINE_ITEMS {
        int id PK
        string title
        text body
    }
    SKILLS {
        int id PK
        string title
        string glyph
        text items
    }
    CERTIFICATIONS {
        int id PK
        string kind "certification or training"
        string title
        string issuer
        string credential_id
        string file_name
    }
    LIFE_CARDS {
        int id PK
        string variant "chess, travel, japan, plain"
        string title
    }
    MESSAGES {
        int id PK
        string name
        string email
        text body
        bool is_read
    }
    ADMIN_USERS {
        int id PK
        string email
        string password_hash
    }
Loading

Every list table also has sort_order and is_published.

📁 Project structure
Portfolio/
├── backend/                          FastAPI
│   ├── app/
│   │   ├── main.py                   app, CORS, routers, serves frontend/dist in prod
│   │   ├── core/                     settings (.env) · bcrypt + JWT
│   │   ├── db/session.py             engine · session · Base
│   │   ├── models/                   SQLAlchemy tables
│   │   ├── schemas/                  Pydantic request/response models
│   │   ├── services/                 defaults · seed · migrations · storage (disk / Vercel Blob) · rate limits
│   │   ├── cli.py                    python -m app.cli init | check
│   │   └── api/routes/               public · auth · admin_content · admin_misc
│   ├── api/index.py                  Vercel entrypoint (+ vercel.json)
│   ├── tests/test_api.py             pytest, end-to-end through the API
│   ├── uploads/                      résumé + certificate PDFs
│   └── requirements.txt
├── frontend/                         React + Vite + TypeScript
│   └── src/
│       ├── api/                      typed fetch client + types
│       ├── components/portfolio/     Hero · Projects · Experience · Arsenal · Credentials · Contact …
│       ├── components/admin/         generic field renderer + field configs
│       ├── pages/                    PortfolioPage · admin/*
│       ├── context/ hooks/ lib/      auth · toasts · in-view · scroll progress · *rich text*
│       └── styles/                   portfolio.css · admin.css
├── docs/                             banner + screenshots for this README
└── index.html                        original static design (reference)

🔐 The admin portal

Page What you can do
Dashboard Counts at a glance — projects, certifications, unread messages, résumé status
Page copy Hero, section headings, manifesto, experience header, contact text, marquee, social links, SEO
Projects · Quick facts · Experience · Skills · Certifications · Beyond code Add, edit, delete, hide/publish, reorder with ↑ ↓
Certifications Plus Upload PDF per item → visitors get a “View certificate” button
Messages Contact-form inbox — read/unread, reply by email, delete
Résumé Drag-and-drop the PDF behind every “Download résumé” button
Account Change your password

Tip

In any title or statement, wrap words in *asterisks* to get the signature lime/serif highlight. Wide enough to ship. *Deep enough to own.* → Wide enough to ship. Deep enough to own.


📡 API reference

50 endpoints. Nothing runs on a timer — every call is triggered by a visitor or by you in the admin. Full interactive docs live at /docs once the backend is running.

🌍 Public — 5 endpoints (no login)
Method Endpoint Triggered when…
GET /api/portfolio anyone opens the homepage — all published content in one payload
GET /api/resume a visitor clicks Download résumé
GET /api/certifications/{id}/file a visitor clicks View certificate
POST /api/messages a visitor submits the contact form (5 per 10 min per IP + honeypot)
GET /api/health uptime checks / load balancers
🔑 Auth — 3 endpoints
Method Endpoint Triggered when…
POST /api/auth/login you sign in at /admin/login
GET /api/auth/me any admin page loads (validates the saved token)
POST /api/auth/change-password you submit the Account page
🛠️ Admin — 42 endpoints (Bearer token)

Page copy

Method Endpoint Triggered when…
GET /api/admin/sections Page copy screen opens
GET /api/admin/sections/{key} reading a single block
PUT /api/admin/sections/{key} Save on a block

Collections — the same 5 endpoints for each of projects, facts, timeline, skills, life-cards, certifications (= 30)

Method Endpoint Triggered when…
GET /api/admin/{collection} the list page opens
POST /api/admin/{collection} + Add → Save
PUT /api/admin/{collection}/{id} Edit → Save, or the Published/Hidden toggle
DELETE /api/admin/{collection}/{id} Delete → Confirm
POST /api/admin/{collection}/reorder the ↑ / ↓ arrows

Files, messages, stats

Method Endpoint Triggered when…
POST /api/admin/certifications/{id}/file Upload / Replace PDF on a certification
DELETE /api/admin/certifications/{id}/file ✕ PDF
GET /api/admin/messages inbox opens
PATCH /api/admin/messages/{id} a message is opened, or Mark read/unread
DELETE /api/admin/messages/{id} Delete on a message
GET /api/admin/resume Résumé page opens
POST /api/admin/resume a PDF is dropped/chosen
DELETE /api/admin/resume Delete → Confirm
GET /api/admin/stats Dashboard opens

⚙️ Configuration

backend/.env (local) · Vercel → backend project → Environment Variables (production)
Variable Default Purpose
DATABASE_URL sqlite:///./portfolio.db SQLite locally · Neon pooled URL in production (postgres:// / postgresql:// accepted as-is)
JWT_SECRET change-me… Change this. Signs admin tokens
JWT_EXPIRE_MINUTES 720 Admin session length
ADMIN_EMAIL / ADMIN_PASSWORD admin@example.com / ChangeMe123! First admin user (created once)
CORS_ORIGINS http://localhost:5173,… Comma-separated, exact frontend origins
MAX_RESUME_MB 10 PDF upload limit — use 4 on Vercel
BLOB_READ_WRITE_TOKEN (unset) Added by Vercel when a Blob store is connected → PDFs stored in Vercel Blob
UPLOAD_DIR ./uploads Local PDF storage (when Blob isn't configured)
FRONTEND_DIST ../frontend/dist Built React app to serve from FastAPI (single-server mode)
TRUST_PROXY_HEADERS false Read visitor IPs from X-Forwarded-For (automatic on Vercel)
frontend/.env · Vercel → frontend project → Environment Variables
Variable Default Purpose
VITE_API_URL (empty) Backend URL without /api — e.g. https://my-api.vercel.app. Empty = same origin
VITE_PROXY_TARGET http://127.0.0.1:8000 Dev server only: where /api is proxied

🚀 Deploying

▲ Vercel (free, no card) — recommended

flowchart LR
    U([Visitor]) --> FE["▲ Vercel<br/>frontend project<br/><i>React build</i>"]
    FE -->|"VITE_API_URL"| BE["▲ Vercel<br/>backend project<br/><i>FastAPI function</i>"]
    BE --> N[("Neon<br/>Postgres")]
    BE --> B[/"Vercel Blob<br/>PDFs"/]
Loading

Two Vercel projects from this one repo:

Backend project Frontend project
Root Directory backend frontend
Framework Preset Other Vite (auto)
Config backend/vercel.json → all routes to api/index.py frontend/vercel.json → SPA fallback for /admin/*
Storage Neon (DATABASE_URL) + Blob (BLOB_READ_WRITE_TOKEN) —
Env vars DATABASE_URL JWT_SECRET ADMIN_EMAIL ADMIN_PASSWORD CORS_ORIGINS MAX_RESUME_MB=4 VITE_API_URL
📋 Step by step
  1. Neon — create a project, copy the pooled connection string.
  2. Vercel → Storage → Blob — create a public store.
  3. Backend project — Add New → Project, import the repo, Root Directory backend, add the env vars, Deploy.
  4. Blob store → Connect to Project → pick the backend project, then Redeploy it.
  5. Open https://<backend>.vercel.app/api/health → {"status":"ok"}.
  6. Frontend project — import the same repo again, Root Directory frontend, set VITE_API_URL=https://<backend>.vercel.app, Deploy.
  7. Set the backend's CORS_ORIGINS=https://<frontend>.vercel.app and redeploy the backend.
  8. Visit /admin on the frontend, sign in, change the password.

The first request creates the tables, seeds the content and uploads the bundled PDFs to Blob. To do it ahead of time from your machine:

cd backend
DATABASE_URL="postgresql://…" BLOB_READ_WRITE_TOKEN="vercel_blob_rw_…" python -m app.cli init

🖥️ Single server (VPS)

FastAPI serves the API and the built site (with SPA fallback for /admin/*):

cd frontend && npm ci && npm run build      # → frontend/dist
cd ../backend && pip install -r requirements.txt
uvicorn app.main:app --host 127.0.0.1 --port 8000 --workers 2 --proxy-headers
🌐 nginx + HTTPS in front
server {
    server_name jayesh.dev;                     # your domain
    client_max_body_size 12m;                   # PDF uploads

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
# then: sudo certbot --nginx -d jayesh.dev
✅ Pre-launch checklist
  • Set a long random JWT_SECRET — python3 -c "import secrets; print(secrets.token_urlsafe(64))"
  • Change ADMIN_EMAIL / ADMIN_PASSWORD (or change the password in Admin → Account)
  • Set CORS_ORIGINS to your real frontend URL
  • Upload the latest résumé and certificate PDFs
  • Fill in email / LinkedIn / GitHub under Admin → Page copy → Site
  • Add a free uptime monitor on /api/health

🧪 Testing

cd backend && source .venv/bin/activate
pip install -r requirements-dev.txt
pytest -q        # auth, CRUD, publish/hide, reorder, messages, uploads, Blob, rate limits, migrations

# same suite against Postgres
TEST_DATABASE_URL=postgresql://user:pass@localhost:5432/portfolio_test pytest -q
cd frontend
npx tsc -b && npm run build     # type-check + production build

🛡️ Security notes

  • Passwords hashed with bcrypt; admin routes require a signed JWT
  • Every request body validated by Pydantic; unknown section keys are dropped
  • Uploads must be real PDFs (magic-byte check) and are size-limited
  • Contact form: hidden honeypot field + per-visitor rate limit (5 / 10 min)
  • Admin login: locked for 15 min after 10 failed attempts from the same IP
  • Rate limits live in the database, so they hold across serverless instances
  • .env, databases and uploaded files are git-ignored

Designed for curiosity · Engineered for impact

Built with React, FastAPI and a lot of lime. © 2026 Jayesh Sharma

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages