Skip to content
Proyek

nixrajput/portfolio-nextjs

Lihat di GitHub

Tentang

This repository contains the source code for a portfolio website built using Next.js, TypeScript, Sass, Tailwind, and Aceternity UI.

Data dan analisis

Cara angka ini diukur

Pertumbuhan bintang terukur

dalam 24 jam
0
dalam 7 hari
0
dalam 15 hari
Mengumpulkan riwayat
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli
Nikhil Rajput

Nikhil Rajput · Portfolio

A portfolio that is edited, not redeployed.


CI Lighthouse Stars Contributors License: MIT Last commit Issues PRs

Every section DB-driven · GitHub OAuth admin · light / dark / system · five brand palettes · ISR with on-demand revalidation
There is no benchmark here, and a portfolio site does not deserve one. What is checkable instead: 283 unit tests across 44 files plus 10 Playwright end-to-end tests; a route check that asserts every page serves the right content rather than a 200, which is the only way to test an admin route that is protected and returns 200; per-route JS payload and TTFB budgets measured against a production build, which refuse to measure a dev server because unminified bundles read several times heavier; and Lighthouse gating accessibility, best practices and SEO at ≥ 0.90 on every pull request. See the runs.


Live site · Stack · Local setup · Admin panel · Deployment

AI agents / LLMs: the site is machine-readable at llms.txt, or as one blob at llms-full.txt. Repo conventions and pitfalls live in AGENTS.md.


Table of Contents


Stack

Layer Technology
Framework Next.js 16 (App Router, Turbopack)
UI library React 19
Language TypeScript
Styling Tailwind CSS v4, Geist font
Animation Framer Motion
Icons Lucide React
Database PostgreSQL via postgres-js
ORM Drizzle ORM
Auth Auth.js v5 - GitHub OAuth
File storage Vercel Blob
Email Resend
Analytics Vercel Analytics + Google Analytics
Package manager Bun
Unit tests Vitest + Testing Library
E2E tests Playwright
Deployment Vercel

Architecture overview

  • DB-driven content - profile, projects, experiences, skills, services, social links, taglines, and FAQs are stored in PostgreSQL and seeded via bun run db:seed. The admin panel allows live CRUD editing. The profile drives the hero (name, editable role marquee, "Currently" tagline, avatar) and the About section.
  • Image uploads - the profile avatar, skill icons and project media (cover image plus up to six quick-view screenshots) are uploaded from the admin panel to Vercel Blob and served from the CDN. Icons fit inside a 128px box with SVG stored raw; project media fits inside 1600×1000, since a screenshot squeezed into an icon box is unreadable. Every field also accepts a plain URL, and existing static asset paths keep working.
  • GitHub cache - stars, forks, languages, descriptions and a README excerpt per repo, plus account-level followers/stars/repo counts, are cached in Postgres with a 24-hour TTL and served from the last-known-good row so they never flash blank. A GitHub outage or rate limit falls back to the stale row rather than erroring. Only repos listed in the database are enriched.
  • Theming and brand palette - light/dark/system plus five selectable brand palettes (Iris by default), chosen from the appearance menu in the nav and remembered in localStorage. src/lib/brand.ts is the build-time source of truth for the default; globals.css mirrors it as CSS variables and src/app/globals.theme.test.ts fails if the two drift. Server-rendered artifacts that cannot be per-visitor (Open Graph image, PWA manifest, notification emails) always use the default.
  • Testimonials - visitors submit testimonials through a validated form (inline per-field errors) with an optional cropped avatar uploaded to Vercel Blob. Submissions land in a moderation queue; the admin approves or rejects them before they appear publicly. Resend emails the admin on new submissions.
  • Admin panel - protected by GitHub OAuth (AUTH_GITHUB_ID / AUTH_GITHUB_SECRET). Access is restricted to the GitHub user id set in ADMIN_GITHUB_ID (10887215 for nixrajput). The panel exposes CRUD tabs for all content types plus the testimonial moderation queue.
  • SEO / GEO - structured metadata, Open Graph, Twitter cards, Google verification, and robots.txt are generated from the database profile row and site config.

Prerequisites

  • Bun ≥ 1.1 - the only supported package manager and runtime.
  • PostgreSQL ≥ 14 - running locally or via a managed service (Neon, Supabase, etc.).
  • A GitHub OAuth App for admin login (Settings → Developer settings → OAuth Apps).

Local setup

1. Clone and install

git clone https://github.com/nixrajput/portfolio-nextjs.git
cd portfolio-nextjs
bun install

2. Environment variables

Copy .env.example to .env.local and fill in the values:

cp .env.example .env.local
Variable Required Description
DATABASE_URL Yes PostgreSQL connection string, e.g. postgres://user:pass@localhost:5432/portfolio
AUTH_SECRET Yes Random secret for Auth.js session encryption (openssl rand -base64 32)
AUTH_GITHUB_ID Yes GitHub OAuth App client ID
AUTH_GITHUB_SECRET Yes GitHub OAuth App client secret
ADMIN_GITHUB_ID Yes Numeric GitHub user id allowed into the admin panel (10887215 for nixrajput). Find yours with gh api users/<login> --jq .id
GITHUB_TOKEN Recommended GitHub personal access token for project metadata fetching (higher rate limits)
BLOB_READ_WRITE_TOKEN Yes (prod) Vercel Blob token for image uploads (avatar, skill icons, project media, testimonial avatars)
RESEND_API_KEY Yes (prod) Resend API key for admin notification emails
RESEND_FROM_EMAIL Yes (prod) From address for emails, e.g. Portfolio <[email protected]> (verified domain)
CONTACT_EMAIL Yes (prod) Email address to receive testimonial submission notifications
REVALIDATE_SECRET Yes (prod) Secret for the /api/revalidate on-demand revalidation endpoint
NEXT_PUBLIC_SITE_URL Yes Canonical site URL, e.g. https://nixrajput.com
NEXT_PUBLIC_GTAG_ID Optional Google Analytics measurement ID (e.g. G-XXXXXXXXXX)
NEXT_PUBLIC_GOOGLE_VERIFICATION_TOKEN Optional Google Search Console site verification token

The resume link is stored in the database (profile.resumeUrl) and managed from the admin panel - not via an environment variable.

3. Database setup

Run migrations to create the schema, then seed initial data:

bunx drizzle-kit migrate
bun run db:seed

4. Git hooks

Enable the pre-push lint + format gate once per clone:

git config core.hooksPath .githooks

This runs bun run lint and bun run format:check before every push. Bypass in an emergency with git push --no-verify.

5. Run the dev server

bun run dev

The site is available at http://localhost:4000.


Commands

Command Description
bun run dev Start dev server (Turbopack, port 4000)
bun run build Production build (webpack, see the note below)
bun run start Start production server (port 3000)
bun run lint Run ESLint
bun run lint:fix Run ESLint with auto-fix
bun run format Format source files with Prettier
bun run format:check Check formatting without writing
bun run check:spell Spell-check source, scripts and root markdown (cspell)
bun run typecheck Run tsc --noEmit
bun run test Run Vitest unit tests
bun run test:watch Run Vitest in watch mode
bun run test:e2e Run Playwright end-to-end tests
bun run check:routes Assert every route serves the right content (needs a server)
bun run check:vitals Per-route JS payload and TTFB budgets (needs a server)
bun run db:generate Generate a new Drizzle migration
bun run db:migrate Apply pending migrations
bun run db:push Push schema changes directly (dev only)
bun run db:studio Open Drizzle Studio
bun run db:seed Seed the database with initial data

The production build uses webpack, not Turbopack, on purpose. sharp is a native addon used server-side for image optimization, and Turbopack rewrites it into a hashed external module that Vercel cannot load at runtime. bun run dev still uses Turbopack.

check:routes and check:vitals run against a running server, so build and start first:

bun run build && bun run start
bun run check:routes    # BASE_URL=http://localhost:4000 to check a dev server instead
bun run check:vitals    # refuses a dev server: unminified bundles give meaningless numbers

Admin panel

The admin panel is at /admin and requires authentication via GitHub OAuth.

  • Only the GitHub account whose numeric user id is set in ADMIN_GITHUB_ID (10887215 for nixrajput) can sign in. The id is checked, not the login, because a renamed login can be claimed by someone else.
  • After signing in you have access to CRUD tabs for profile, projects, experiences, skills, services, social links, taglines, FAQs, and funding links.
  • The profile editor manages your name, bio, hero role marquee, "Currently" tagline, resume link, and avatar (upload or URL). Skill icons are uploaded or URL-pasted per skill.
  • The projects editor curates which repos appear and how: title, blurb, tags, order, featured/hidden flags, a cover image, and up to six screenshots for the quick view. order doubles as the showcase ranking - the leading featured rows get the large cells above the grid, and the rest keep a "Featured" badge inside it.
  • Settings controls per-section visibility. A hidden section runs no query and never loads its chunk, so hiding one also makes the page lighter.
  • Testimonial submissions appear in a moderation queue. Approve a testimonial to make it visible on the site; reject to discard it.

Image uploads (avatar, skill icons, project cover and screenshots) require BLOB_READ_WRITE_TOKEN to be set.

Years of experience is derived from the experience rows' start years, not from GitHub - so it increments on its own each January and counts professional work rather than how long the GitHub account has existed.


Deployment

The site is deployed on Vercel. The main branch deploys automatically.

  1. Import the repository in Vercel.
  2. Add all required environment variables in the Vercel project settings.
  3. Provision a PostgreSQL database (Vercel Postgres / Neon) and set DATABASE_URL to its pooled connection string.
  4. Seed the production database once by hand against the production DATABASE_URL: DATABASE_URL=<prod> bun run db:seed. The seed is guarded (seed-if-empty), so it inserts the initial content only when the database is empty and never overwrites later edits.
  5. Push to master - Vercel runs the vercel-build script, which applies pending migrations and then builds. It does not seed; data seeding is the one-time manual step above, and further content changes are made in the admin panel.

The local DATABASE_URL stays pointed at your local Postgres for development; only the Vercel environment uses the production database.

Upgrading to 2.5.0: set ADMIN_GITHUB_ID=10887215 in the Vercel project (Production and Preview) before you merge. 2.5.0 checks the GitHub user id instead of ADMIN_GITHUB_LOGIN, so without it nobody can sign in to /admin. ADMIN_GITHUB_LOGIN can be removed afterwards.


Contributing

Contributions are welcome. Fork, branch, and open a PR - see CONTRIBUTING.md for the checks a PR has to pass. Bugs and ideas go to Issues; vulnerabilities follow SECURITY.md.

Repo conventions, the local gate, and the pitfalls worth knowing before touching the design system live in AGENTS.md.

Contributors

Thanks to everyone who has contributed to this portfolio.

License

Licensed under the MIT license - see LICENSE.

Support the project

This portfolio is MIT licensed and free to fork, always. If it saved you building your own admin panel and content layer, sponsorship is welcome.


GitHub Sponsors Ko-fi Buy Me a Coffee

Connect

Nikhil Rajput

GitHub LinkedIn X Instagram Telegram Email

Jelajahi proyek terkait

Memuat…