A modern, responsive portfolio website built with React and Vite.
myself-react-app/
├── .github/
│ └── workflows/ # GitHub Actions workflow files
│ ├── deploy-preview.yml # PR preview deployment
│ └── deploy-production.yml # Production deployment
├── src/
│ ├── components/ # React components
│ │ ├── Header/ # Navigation header
│ │ │ ├── Header.jsx
│ │ │ ├── Header.css
│ │ │ └── Header.test.jsx
│ │ └── Profile/ # Profile section
│ │ ├── Profile.jsx
│ │ ├── Profile.css
│ │ └── Profile.test.jsx
│ ├── test/ # Test configuration
│ │ └── setup.js # Test setup and mocks
│ ├── App.jsx # Main App component
│ ├── App.css # Global styles
│ ├── App.test.jsx # App component tests
│ └── main.jsx # Application entry point
├── index.html # HTML template
├── vite.config.js # Vite configuration
└── package.json # Project dependencies and scripts
- Node.js (v20 or later recommended)
- npm (included with Node.js)
- Git
-
Clone the repository:
git clone https://github.com/yourusername/myself-react-app.git cd myself-react-app
-
Install dependencies:
npm install
The project supports three environments: Development, Staging, and Production. Each environment has its own configuration and can be run locally for testing.
Development mode is optimized for local development with hot reloading and debugging features.
# Start development server
npm run dev
# Access the app at
http://localhost:5173/
# Features
- Hot Module Replacement (HMR)
- Source maps
- Debug logging enabled
- Mock API enabled
# Environment variables (.env.development)
VITE_APP_ENV=development
VITE_APP_BASE_URL=http://localhost:5173
VITE_APP_API_URL=http://localhost:3000/api
VITE_APP_ENABLE_MOCK_API=true
VITE_APP_ENABLE_DEBUG=true
Staging mode mimics production but with additional debugging capabilities.
# Build for staging
npm run build:staging
# Preview staging build
npm run preview:staging
# Access the app at
http://localhost:4173/
# Features
- Production-like build
- Source maps included
- Debug logging enabled
- Real API endpoints
# Environment variables (.env.staging)
VITE_APP_ENV=staging
VITE_APP_BASE_URL=https://staging.yourdomain.com
VITE_APP_API_URL=https://api-staging.yourdomain.com/api
VITE_APP_ENABLE_MOCK_API=false
VITE_APP_ENABLE_DEBUG=true
Production mode is fully optimized for deployment.
# Build for production
npm run build
# Preview production build
npm run preview
# Access the app at
http://localhost:4173/
# Features
- Minified build
- No source maps
- Debug logging disabled
- Real API endpoints
- Optimized chunk splitting
# Environment variables (.env.production)
VITE_APP_ENV=production
VITE_APP_BASE_URL=https://yourdomain.com
VITE_APP_API_URL=https://api.yourdomain.com/api
VITE_APP_ENABLE_MOCK_API=false
VITE_APP_ENABLE_DEBUG=false
Development:
- No build output (serves directly from source)
- Instant updates via HMR
Staging:
- JS: ~144.5 KB (gzip: ~47 KB)
- CSS: ~1.75 KB (gzip: ~0.75 KB)
- Includes source maps
- Separate vendor chunks
Production:
- JS: ~144.4 KB (gzip: ~46.9 KB)
- CSS: ~1.75 KB (gzip: ~0.75 KB)
- No source maps
- Optimized chunk splitting
- Minified and compressed
-
Development:
npm run dev # Start development server npm run test # Run tests once npm run test:watch # Run tests in watch mode npm run test:coverage # Run tests with coverage
-
Staging:
npm run build:staging # Build for staging npm run preview:staging # Preview staging build
-
Production:
npm run build # Build for production npm run preview # Preview production build
-
Utility:
npm run clean # Remove dist folder npm run clean:all # Remove dist and node_modules npm run lint # Run ESLint
The project uses Vitest and React Testing Library for testing. Tests are located alongside their components with the .test.jsx
extension.
To run tests:
npm test
For test coverage:
npm run test:coverage
The project uses GitHub Actions for automated deployments:
- Production Deployment: Automatically triggered when changes are merged to the main branch
- Preview Deployment: Automatically created for pull requests
-
Configure Repository Permissions
- Go to Settings > Actions > General
- Under "Workflow permissions":
- Select "Read and write permissions"
- Check "Allow GitHub Actions to create and approve pull requests"
-
Set Up Environment Secrets
- Go to Settings > Secrets and variables > Actions
- Add environment-specific secrets for your deployment
-
Configure Environments
- Set up separate environments for production and staging
- Configure environment-specific variables and secrets
- Set up required reviewers and deployment rules as needed
-
Create a new branch for your feature:
git checkout -b feature/your-feature-name
-
Make your changes and commit them:
git add . git commit -m "Add your feature"
-
Push to your branch:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
MIT License - feel free to use this project as a template for your own portfolio.