A production-ready personal portfolio web application built with React, TypeScript, and Tailwind CSS. This project follows modern best practices and is structured for both learning and scalability.
- Modern Tech Stack: React 18, TypeScript, Vite, Tailwind CSS
- Feature-based Architecture: Organized, scalable folder structure
- Dark/Light Theme: System preference detection with manual toggle
- Responsive Design: Mobile-first approach with fluid layouts
- Accessible: WCAG compliant with proper ARIA attributes
- Animations: Smooth animations with Framer Motion
- Code Quality: ESLint, Prettier, Husky pre-commit hooks
- Lazy Loading: Route-based code splitting for performance
Located in src/hooks/:
useTheme- Theme management with localStorage syncuseMediaQuery- Responsive behavior in JavaScriptuseLocalStorage- State persistence with localStorageuseScrollPosition- Track scroll for sticky headersuseForm- Form state and validation management
Located in src/context/:
ThemeContext- Global theme state avoiding prop drilling
Located in src/components/common/ErrorBoundary.tsx:
- Class component for catching render errors
- Graceful fallback UI
Implemented in src/App.tsx:
- React.lazy() for route-based code splitting
- Suspense for loading states
Demonstrated in src/pages/Contact/Contact.tsx:
- Form inputs managed by React state
- Custom useForm hook for validation
Throughout the codebase:
- Interfaces for data structures
- Generic types for reusability
- Strict type checking enabled
src/
βββ assets/ # Static assets (images, fonts)
βββ components/
β βββ common/ # Shared components (ErrorBoundary)
β βββ layout/ # Layout components (Header, Footer)
β βββ ui/ # Reusable UI components (Button, Card, Input)
βββ constants/ # Application constants and configuration
βββ context/ # React Context providers
βββ hooks/ # Custom React hooks
βββ pages/ # Page components (feature-based)
β βββ Home/
β βββ About/
β βββ Projects/
β βββ Blog/
β βββ Contact/
β βββ NotFound/
βββ services/ # Data services and API layer
β βββ data/ # Mock data (would be API calls in production)
βββ styles/ # Global styles and Tailwind configuration
βββ types/ # TypeScript type definitions
βββ utils/ # Utility functions
βββ App.tsx # Root component with routing
βββ main.tsx # Application entry point
- Node.js 18+
- npm or yarn
# Clone the repository
git clone <repository-url>
cd Portfolio
# Install dependencies
npm install
# Start development server
npm run devThe app will be available at http://localhost:5173
# Development
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
# Code Quality
npm run lint # Run ESLint
npm run lint:fix # Fix ESLint issues
npm run format # Format with Prettier
npm run format:check # Check formatting
npm run type-check # TypeScript type checkingEdit src/constants/index.ts:
export const SITE_CONFIG = {
name: 'Portfolio',
title: 'Full Stack Developer',
author: 'Your Name',
email: 'your@email.com',
location: 'Your Location',
};Edit tailwind.config.js to customize the color palette:
colors: {
primary: { /* your primary colors */ },
accent: { /* your accent colors */ },
}Add entries to src/services/data/projects.ts:
{
id: 'unique-id',
title: 'Project Title',
slug: 'project-slug',
description: 'Short description',
technologies: [{ name: 'React' }],
// ... other fields
}Add entries to src/services/data/blog.ts:
{
id: 'unique-id',
slug: 'post-slug',
title: 'Post Title',
content: 'Your content here...',
// ... other fields
}- Create a new folder in
src/pages/:
src/pages/NewPage/
βββ NewPage.tsx
βββ index.ts
βββ components/ # Page-specific components
- Add the route in
src/App.tsx:
const NewPage = lazy(() =>
import('@/pages/NewPage').then((m) => ({ default: m.NewPage }))
);
// In router configuration:
{
path: 'new-page',
element: (
<Suspense fallback={<PageLoading />}>
<NewPage />
</Suspense>
),
}- Add navigation link in
src/constants/index.ts:
export const NAV_LINKS = [
// ... existing links
{ label: 'New Page', path: '/new-page' },
];- Create the hook in
src/hooks/:
// src/hooks/useMyHook.ts
export function useMyHook() {
// Hook implementation
}- Export from
src/hooks/index.ts:
export { useMyHook } from './useMyHook';Replace mock data in src/services/ with actual API calls:
// src/services/api/projects.ts
export async function getAllProjects(): Promise<Project[]> {
const response = await fetch('/api/projects');
return response.json();
}| Category | Technology |
|---|---|
| Framework | React 18 |
| Build Tool | Vite |
| Language | TypeScript |
| Routing | React Router 7 |
| Styling | Tailwind CSS |
| Animations | Framer Motion |
| Linting | ESLint |
| Formatting | Prettier |
| Git Hooks | Husky + lint-staged |
Following Tailwind CSS defaults:
sm: 640pxmd: 768pxlg: 1024pxxl: 1280px2xl: 1536px
This project follows WCAG 2.1 guidelines:
- Semantic HTML structure
- Proper heading hierarchy
- ARIA labels and roles
- Keyboard navigation support
- Focus management
- Color contrast ratios
- Skip to main content link
- Reduced motion support
Create a .env file for environment-specific configuration:
# API Configuration (when connecting to backend)
VITE_API_URL=http://localhost:3000/api
# Analytics (optional)
VITE_GA_TRACKING_ID=UA-XXXXXXXXX-X- Components: PascalCase (
Button.tsx) - Hooks: camelCase with
useprefix (useTheme.ts) - Utils: camelCase (
formatDate.ts) - Constants: SCREAMING_SNAKE_CASE for values
- Types: PascalCase interfaces/types
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is open source and available under the MIT License.
Built with β€οΈ using React, TypeScript, and Tailwind CSS