How debarun23/my-portfolio works
Project type and purpose
• This is a front-end React SPA boilerplate built with Vite and TypeScript.
• It includes a custom UI component library under src/components/ui, demo pages in src/components (e.g., IDCard.tsx, TerminalInterface.tsx, PortfolioContent.tsx), utility functions (src/lib/utils.ts), and Storybook-style “stories” (src/stories) for interactive component previews.
• It is intended as a starting point for a production React application or component library, with hot-module reloading (HMR), TailwindCSS styling, and optional Supabase integration (via types in src/types).
File structure
• Top-level:
• package.json / package-lock.json – dependencies, scripts (dev/build).
• vite.config.ts – Vite build/dev server config with plugin-react or plugin-react-swc.
• postcss.config.js & tailwind.config.js – CSS pipeline.
• README.md – usage, ESLint recommendations.
• Public assets: public/index.html
• Source: src/
• main.tsx – app entry point referenced by index.html.
• App.tsx – root React component.
• components/… – page-level components and UI library subfolder.
• lib/utils.ts – shared helpers.
• stories/… – Storybook-style files demonstrating each UI component.
• types/ – custom TypeScript definitions (e.g. Supabase).
• Config: tsconfig.json / tsconfig.node.json (TypeScript setup), tempo.config.json (if used for CI/CD), components.json (custom metadata).
Insights from README
• Primary stack: React + TypeScript + Vite.
• ESLint enhancements suggested for production.
• Two Vite plugins for React Fast Refresh (Babel vs. SWC).
a. Main components
• Developer Machine – runs:
– Node.js + npm/yarn
– Vite Dev Server (with plugin-react or plugin-react-swc)
– ESLint/PostCSS Tailwind pipeline
• Client Browser – loads index.html → downloads bundled JS/CSS → renders React SPA
• React SPA Layers:
– Root (App.tsx)
– Page Components (IDCard, PortfolioContent, TerminalInterface)
– UI Library (accordion, alert-dialog, button, etc.)
– Utility Module (utils.ts)
• Build Output – Vite bundles into dist/ for production hosting
• External Services (optional) – Supabase (authentication, database)
• Storybook-like Preview – runs on Vite using src/stories for isolated component testing
b. Relationships and data flows
1. Developer Machine triggers “npm run dev” → Vite Dev Server
2. Vite serves index.html and on-the-fly bundles TSX files
3. Browser ↔ Dev Server (HMR WebSocket) for live updates
4. Browser loads React app → components import UI library and utils → render UI
5. React components call external APIs (e.g. Supabase) via fetch/sdk
6. Build pipeline (npm run build) → Vite outputs optimized static assets
7. Storybook runs via Vite config, serves stories for each UI component
c. Architectural patterns / design principles
• Component-based architecture (React functional components)
• Modular UI library (single purpose, reusable UI primitives under src/components/ui)
• Separation of concerns:
– Presentation (UI components)
– Container/page components (compose UI primitives)
– Utilities (common logic in src/lib)
– Environment configuration (Vite, Tailwind, ESLint)
d. Key technologies / frameworks / libraries
• React (17+) with JSX/TSX
• Vite (fast bundler with dev server)
• TypeScript for type safety
• TailwindCSS + PostCSS for styling
• ESLint + optional type-aware linting
• Storybook-style previews via Vite
• Supabase SDK types