Skip to content
View mafnankhadim's full-sized avatar

Highlights

  • Pro

Block or report mafnankhadim

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Content in all repositories owned by your account will be closed.
Maximum 250 characters. Please don’t include any personal information such as legal names or email addresses. This note will only be visible to you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
mafnankhadim/README.md

Afnan Khadim, Portfolio (React + Vite)

Single-page portfolio for M Afnan Khadim, MERN Stack Web Developer. React 18 + Vite 5, plain JavaScript, no router or state library. A custom dark design system with a light theme toggle, a three.js hero scene, scroll reveals, filterable project grid, Web3Forms contact form and an AI chat assistant.

Commands

npm install      # install dependencies
npm run dev      # start dev server (http://localhost:5173)
npm run build    # production build into dist/
npm run preview  # serve the production build locally

npm run dev also runs the AI assistant's serverless function (see vite.config.js), so the chat widget works locally as soon as a .env with CHAT_API_KEY exists — no Vercel CLI needed. vercel dev also works if you want the full Vercel environment.

Structure

api/chat.js             # Vercel function behind the AI assistant
public/                 # images, fonts and Font Awesome (icon glyphs only)
src/
  main.jsx              # entry; imports styles/base.css before App
  App.jsx               # page composition
  components/           # one component per section, plus Tilt, Reveal,
                        # CountUp, HeroScene (three.js) and ThemeToggle
  data/
    content.js          # nav, services, skills, experience, contact, socials
    portfolio.js        # projects with GitHub / Play Store / site links
    chatbot.js          # assistant bio, greeting and prompt (shared with api/)
  styles/
    base.css            # design tokens, reset and shared primitives
    <section>.css       # one stylesheet per component, imported by it
  utils/                # scroll offset, theme switch effect

Notes

  • Theming: all colours are CSS custom properties in src/styles/base.css. The light theme is a single :root[data-theme="light"] override of those tokens; the nav toggle sets data-theme on <html>, saves the choice, and an inline script in index.html applies it before first paint (first visits follow the OS preference). Section stylesheets use tokens, never raw colours.
  • Content lives in src/data/; components only map over it.
  • Projects link to their GitHub repo, their Google Play listing, or the live site when the repo is private.
  • The Web3Forms access key in src/data/content.js is public by design (it is a client-side key).

AI assistant

The floating chat bubble (src/components/Chatbot.jsx) posts to /api/chat, a Vercel serverless function (api/chat.js) that adds the system prompt and the model API key before calling the provider. The key therefore never reaches the browser — unlike the Web3Forms key, it must stay secret.

The function's knowledge about Afnan lives in src/data/chatbot.js, and its project list is generated from src/data/portfolio.js, so the assistant can't describe a project that is no longer on the site. Edit the bio, greeting or suggestion chips there.

Configure the provider with environment variables — on Vercel under Settings → Environment Variables (or vercel env add), and locally in a .env (see .env.example):

Variable Required Default
CHAT_API_KEY yes —
CHAT_API_URL no Groq's OpenAI-compatible endpoint
CHAT_MODEL no openai/gpt-oss-120b

Any OpenAI-compatible chat-completions API works (Groq, OpenAI, OpenRouter, Together): set CHAT_API_URL and CHAT_MODEL to match the provider. Without a key the widget still renders and fails politely, pointing visitors at the contact form.

Locally the same function is served by a small Vite dev-server plugin in vite.config.js, which reads .env and mounts the handler at the same /api/chat path Vercel serves in production.

Popular repositories Loading

  1. Quiz-Game Quiz-Game Public

    Our Quiz Game project allows users to answer multiple-choice questions with feedback on their selections. Correct answers are highlighted in green, while incorrect answers are highlighted in red. A…

    JavaScript 1

  2. Weather Weather Public

    Dive into the challenge with a dynamic ! Input a city name, and watch as your webpage transforms to display real-time weather information. This project encapsulates the synergy of HTML for structur…

    JavaScript 1

  3. Cryptocurrency-Website Cryptocurrency-Website Public

    Our Cryptocurrency Website Header project adds value to your website by displaying live cryptocurrency prices. With JavaScript and jQuery, we'll fetch data from a free API and update the header sec…

    HTML 1

  4. Circular-Progress-Bar Circular-Progress-Bar Public

    Our Circular Progress Bar project elevates your website's design with a stylish and functional element. Using SVG circles and CSS gradients, we'll create a visually stunning progress bar that anima…

    JavaScript 1

  5. Music-Player Music-Player Public

    Our Interactive Music Player project enhances your website with a versatile music experience. Users can play multiple songs, control playback with play/pause, next, and back buttons, and view the s…

    JavaScript 1

  6. College-University-Website-Using-React.js College-University-Website-Using-React.js Public

    A modern, responsive college and university website built with React, covering programs, departments and admissions.

    JavaScript 1