A modern, high-performance full-stack website with React frontend and PHP backend, optimized for Hostinger hosting.
- Modern Stack: Built with React 19, TypeScript 5.8, and Vite 7
- Type-Safe: Full TypeScript coverage with strict typing
- Responsive Design: Mobile-first approach with Tailwind CSS 4
- Performance Optimized: Code splitting, lazy loading, and optimized assets
- Accessible: ARIA-compliant components following WCAG guidelines
- Form Validation: Robust client-side validation with helpful error messages
- Code Quality: ESLint, Prettier, and automated formatting
- PHP API: RESTful API for contact forms, projects, and team management
- Email System: PHPMailer with SMTP support + native PHP mail() fallback
- Database: MySQL with secure PDO connections
- Security: API key authentication, SQL injection protection, XSS prevention
- Hostinger Optimized: Ready for Hostinger PHP shared hosting
- Multiple Email Solutions: Works with Hostinger SMTP, SendGrid, Gmail, or native mail()
- Node.js 18+
- npm 9+ or yarn 1.22+
- PHP 7.4+ (included with Hostinger)
- MySQL/MariaDB (included with Hostinger)
- Composer (optional, for PHPMailer)
- Hostinger hosting account
- Clone the repository:
git clone https://github.com/uxlabspk/codehunts.git
cd codehunts- Install dependencies:
npm install- Copy environment variables:
cp .env.example .env- Update
.envwith your configuration
See QUICK-START.md for the fastest setup or BACKEND-SETUP.md for complete guide.
Quick version:
- Upload
api/folder to Hostinger:public_html/api/ - Create MySQL database and import
api/database/schema.sql - Create email account in hPanel:
contact@yourdomain.com - Copy and configure:
cp api/.env.example api/.env - Install PHPMailer:
cd api && composer install - Test: Visit
https://yourdomain.com/api/projects.php
Email not working? See api/EMAIL-TROUBLESHOOTING.md for solutions.
Start the development server:
npm run devThe app will be available at http://localhost:5173
Create a production build:
npm run buildPreview the production build:
npm run previewnpm run type-checknpm run lint # Check for issues
npm run lint:fix # Auto-fix issuesnpm run format # Format all files
npm run format:check # Check formattingRun all checks at once:
npm run validatesrc/
βββ assets/ # Static assets (images, icons)
βββ components/ # React components
β βββ common/ # Shared components
β βββ form/ # Form components
β βββ landing/ # Landing page sections
β βββ portfolio/ # Portfolio components
β βββ services/ # Service-related components
β βββ ui/ # Base UI components
βββ config/ # Configuration files
βββ constants/ # App constants and enums
βββ hooks/ # Custom React hooks
βββ lib/ # Utility functions
βββ pages/ # Page components
βββ services/ # API and external services
βββ types/ # TypeScript type definitions
- Use TypeScript and define prop interfaces
- Export components as named exports
- Include proper TypeScript types
- Add JSDoc comments for complex components
Example:
interface ButtonProps {
label: string;
onClick: () => void;
variant?: "primary" | "secondary";
}
/**
* Reusable button component
*/
export function Button({ label, onClick, variant = "primary" }: ButtonProps) {
// Component logic
}- Use Tailwind CSS utility classes
- Extract repeated patterns to component variants
- Use
cn()utility for conditional classes
- vite.config.ts: Vite configuration
- tsconfig.json: TypeScript configuration
- eslint.config.js: ESLint rules
- .prettierrc: Prettier formatting rules
See .env.example for all available variables:
VITE_APP_NAME: Application nameVITE_APP_URL: Your domain URLVITE_CONTACT_EMAIL: Contact email addressVITE_CONTACT_PHONE: Contact phone number
See api/.env.example for all available variables:
Database:
DB_HOST: Database host (usuallylocalhost)DB_NAME: Database nameDB_USER: Database usernameDB_PASS: Database password
Email (Hostinger SMTP):
SMTP_HOST:smtp.hostinger.comSMTP_PORT:587(or465for SSL)SMTP_USERNAME: Your email (e.g.,contact@yourdomain.com)SMTP_PASSWORD: Email passwordSMTP_FROM_EMAIL: From email addressADMIN_EMAIL: Where contact forms are sent
Security:
API_SECRET_KEY: Generate strong key for protected endpointsALLOWED_ORIGINS: Comma-separated allowed domains for CORS
- QUICK-START.md - β‘ Fast setup guide (5 minutes)
- BACKEND-SETUP.md - π Complete backend guide
- api/README.md - π§ API documentation
- api/EMAIL-TROUBLESHOOTING.md - π§ Fix email issues
- ARCHITECTURE.md - ποΈ System architecture
- DEPLOYMENT.md - π Deployment guide
| Endpoint | Method | Auth | Description |
|---|---|---|---|
/api/contact.php |
POST | No | Submit contact form |
/api/projects.php |
GET | No | Get all projects |
/api/projects.php?id=1 |
GET | No | Get single project |
/api/projects.php |
POST/PUT/DELETE | Yes | Manage projects |
/api/team.php |
GET | No | Get team members |
/api/team.php?id=1 |
GET | No | Get single member |
/api/team.php |
POST/PUT/DELETE | Yes | Manage team |
Protected endpoints require X-API-Key header.
npm run validate # Run all checks
npm run type-check # TypeScript
npm run lint # ESLint
npm run format # Prettier./test-api.sh # Test all API endpoints
php api/test-phpmailer.php # Test email sending- React 19: UI library
- React Router 7: Client-side routing
- Tailwind CSS 4: Utility-first CSS framework
- Radix UI: Accessible component primitives
- Lucide React: Icon library
- TypeScript 5.8: Type safety
- PHP 7.4+: Server-side language
- PHPMailer 6.8: Email sending with SMTP
- MySQL/MariaDB: Database
- PDO: Secure database connections
npm run build
# Upload dist/ contents to public_html/./deploy-api.sh # Run deployment helper
# Follow the instructionsSee DEPLOYMENT.md for detailed instructions.
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Run validation:
npm run validate - Commit changes:
git commit -m "feat: your feature" - Push to branch:
git push origin feature/your-feature - Create a Pull Request
Follow Conventional Commits:
feat:New featurefix:Bug fixdocs:Documentation changesstyle:Code style changes (formatting)refactor:Code refactoringtest:Adding testschore:Build process or auxiliary tool changes
Copyright Β© 2024 CodeHunts. All rights reserved.
- Email: contact@codehuntspk.com
- Website: https://codehunts.com
- Location: I-10/2 Islamabad, Pakistan
Built with modern web technologies and best practices.
codehunts/
βββ api/ # Backend PHP API
β βββ config/ # Configuration files
β βββ database/ # Database schema
β βββ utils/ # Utilities (mailer)
β βββ contact.php # Contact form endpoint
β βββ projects.php # Projects CRUD
β βββ team.php # Team CRUD
β βββ .env.example # Environment template
β βββ README.md # API documentation
βββ src/ # Frontend source
β βββ components/ # React components
β βββ pages/ # Page components
β βββ config/ # Frontend config
β βββ lib/ # Utilities
β βββ types/ # TypeScript types
βββ public/ # Static assets
βββ QUICK-START.md # β‘ Fast setup guide
βββ BACKEND-SETUP.md # π Complete backend guide
βββ ARCHITECTURE.md # ποΈ System architecture
βββ README.md # This file
Need help?
- π§ Email issues? β api/EMAIL-TROUBLESHOOTING.md
- β‘ Quick setup? β QUICK-START.md
- π Full guide? β BACKEND-SETUP.md