Directory Tree
Key Directories
public/
Static assets that are served as-is without processing. These files are:
- Served from root: Files in
public/are available at/filename.ext - Not bundled: Vite serves them directly without importing
- Optimized for production: Images should be pre-optimized (WebP format)
src/
All application source code lives here. This directory is processed by Vite during build.
src/components/
React components following a co-located pattern:
- Easy to find: All files for a component are in one place
- Easy to delete: Remove an entire component by deleting its folder
- Scoped styles: CSS Modules prevent naming conflicts
- Self-documenting: Component structure is immediately clear
src/data/
Data files separate content from presentation:
projects.js: All project showcase data in a centralized array- Easy to update: Change project content without touching components
- Type-safe: Can be typed with JSDoc or TypeScript
src/data/projects.js
Core Files
index.html
The HTML entry point loaded by the browser:
index.html
Key elements explained
Key elements explained
<div id="root">: React mounting point<script type="module" src="/src/main.jsx">: Vite entry point- Space Grotesk font: Custom font loaded from Google Fonts
- Open Graph tags: Social media preview metadata
src/main.jsx
React application entry point:
src/main.jsx
- Imports global CSS (
index.css) - Mounts the
Appcomponent to the DOM - Uses React 19’s
createRootAPI
src/App.jsx
Main application component with routing:
src/App.jsx
- Routes: Home page (
/) and project detail pages (/project/:id) - Layout: Component composition for the home page
- Navigation: React Router integration
src/index.css
Global CSS variables, resets, and utility classes:
src/index.css (excerpt)
Configuration Files
vite.config.js
Vite build configuration:
vite.config.js
- Enables React Fast Refresh
- Sets up JSX transformation
- Configures HMR (hot module replacement)
package.json
Project metadata and dependencies:
package.json (excerpt)
eslint.config.js
ESLint configuration for code quality:
eslint.config.js
File Naming Conventions
The project follows consistent naming patterns:| File Type | Convention | Example |
|---|---|---|
| React components | PascalCase | Hero.jsx, ProjectDetail.jsx |
| CSS Modules | PascalCase.module.css | Hero.module.css |
| Data files | camelCase | projects.js |
| Config files | lowercase | vite.config.js |
| Global CSS | lowercase | index.css, App.css |
Where to Find Things
Where do I add a new component?
Where do I add a new component?
Create a new folder in
src/components/ with the component name (PascalCase). Add two files:ComponentName.jsx(component logic)ComponentName.module.css(component styles)
Where do I add project data?
Where do I add project data?
Edit
src/data/projects.js and add a new object to the projects array. See the Projects Data guide for the schema.Where do I change global colors?
Where do I change global colors?
Edit the CSS variables in
src/index.css under the :root selector. These variables are used throughout the application.Where do I add images?
Where do I add images?
Place images in the
public/ directory. Reference them with /filename.ext in your components. Use WebP format for best performance.Where do I configure routes?
Where do I configure routes?
Edit
src/App.jsx and add new <Route> components inside the <Routes> component. See the Routing guide for details.Where do I add fonts?
Where do I add fonts?
Link fonts in
index.html (for Google Fonts) or place font files in public/ and reference them in src/index.css with @font-face.Next Steps
Architecture
Learn about the React + Vite architecture
Routing
Understand React Router integration
Components
Explore individual components
Customization
Start customizing the portfolio