Skip to content

A Dedicated Software Development Company Based in Pakistan Official Website.

Notifications You must be signed in to change notification settings

uxlabspk/codehunts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

189 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CodeHunts - Professional Web Platform

A modern, high-performance full-stack website with React frontend and PHP backend, optimized for Hostinger hosting.

πŸš€ Features

Frontend

  • 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

Backend (NEW!)

  • 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()

πŸ“‹ Prerequisites

Frontend

  • Node.js 18+
  • npm 9+ or yarn 1.22+

Backend

  • PHP 7.4+ (included with Hostinger)
  • MySQL/MariaDB (included with Hostinger)
  • Composer (optional, for PHPMailer)
  • Hostinger hosting account

πŸ› οΈ Installation

Frontend Setup

  1. Clone the repository:
git clone https://github.com/uxlabspk/codehunts.git
cd codehunts
  1. Install dependencies:
npm install
  1. Copy environment variables:
cp .env.example .env
  1. Update .env with your configuration

Backend Setup

See QUICK-START.md for the fastest setup or BACKEND-SETUP.md for complete guide.

Quick version:

  1. Upload api/ folder to Hostinger: public_html/api/
  2. Create MySQL database and import api/database/schema.sql
  3. Create email account in hPanel: contact@yourdomain.com
  4. Copy and configure: cp api/.env.example api/.env
  5. Install PHPMailer: cd api && composer install
  6. Test: Visit https://yourdomain.com/api/projects.php

Email not working? See api/EMAIL-TROUBLESHOOTING.md for solutions.

πŸ’» Development

Start the development server:

npm run dev

The app will be available at http://localhost:5173

πŸ—οΈ Build

Create a production build:

npm run build

Preview the production build:

npm run preview

πŸ§ͺ Code Quality

Type Checking

npm run type-check

Linting

npm run lint          # Check for issues
npm run lint:fix      # Auto-fix issues

Formatting

npm run format        # Format all files
npm run format:check  # Check formatting

Validate All

Run all checks at once:

npm run validate

πŸ“ Project Structure

src/
β”œβ”€β”€ 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

🎨 Component Guidelines

Creating New Components

  1. Use TypeScript and define prop interfaces
  2. Export components as named exports
  3. Include proper TypeScript types
  4. 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
}

Styling

  • Use Tailwind CSS utility classes
  • Extract repeated patterns to component variants
  • Use cn() utility for conditional classes

πŸ”§ Configuration Files

  • vite.config.ts: Vite configuration
  • tsconfig.json: TypeScript configuration
  • eslint.config.js: ESLint rules
  • .prettierrc: Prettier formatting rules

🌐 Environment Variables

Frontend (.env)

See .env.example for all available variables:

  • VITE_APP_NAME: Application name
  • VITE_APP_URL: Your domain URL
  • VITE_CONTACT_EMAIL: Contact email address
  • VITE_CONTACT_PHONE: Contact phone number

Backend (api/.env)

See api/.env.example for all available variables:

Database:

  • DB_HOST: Database host (usually localhost)
  • DB_NAME: Database name
  • DB_USER: Database username
  • DB_PASS: Database password

Email (Hostinger SMTP):

  • SMTP_HOST: smtp.hostinger.com
  • SMTP_PORT: 587 (or 465 for SSL)
  • SMTP_USERNAME: Your email (e.g., contact@yourdomain.com)
  • SMTP_PASSWORD: Email password
  • SMTP_FROM_EMAIL: From email address
  • ADMIN_EMAIL: Where contact forms are sent

Security:

  • API_SECRET_KEY: Generate strong key for protected endpoints
  • ALLOWED_ORIGINS: Comma-separated allowed domains for CORS

πŸ“š Documentation

πŸ”Œ API Endpoints

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.

πŸ§ͺ Testing

Frontend Tests

npm run validate    # Run all checks
npm run type-check  # TypeScript
npm run lint        # ESLint
npm run format      # Prettier

Backend Tests

./test-api.sh       # Test all API endpoints
php api/test-phpmailer.php   # Test email sending

πŸ“¦ Key Dependencies

Frontend

  • 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

Backend

  • PHP 7.4+: Server-side language
  • PHPMailer 6.8: Email sending with SMTP
  • MySQL/MariaDB: Database
  • PDO: Secure database connections

πŸš€ Deployment

Frontend Deployment (Hostinger)

npm run build
# Upload dist/ contents to public_html/

Backend Deployment

./deploy-api.sh    # Run deployment helper
# Follow the instructions

See DEPLOYMENT.md for detailed instructions.

🀝 Contributing

  1. Create a feature branch: git checkout -b feature/your-feature
  2. Make your changes
  3. Run validation: npm run validate
  4. Commit changes: git commit -m "feat: your feature"
  5. Push to branch: git push origin feature/your-feature
  6. Create a Pull Request

Commit Convention

Follow Conventional Commits:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • style: Code style changes (formatting)
  • refactor: Code refactoring
  • test: Adding tests
  • chore: Build process or auxiliary tool changes

πŸ“ License

Copyright Β© 2024 CodeHunts. All rights reserved.

πŸ“§ Contact

πŸ™ Acknowledgments

Built with modern web technologies and best practices.


πŸ“ Project Structure

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?

About

A Dedicated Software Development Company Based in Pakistan Official Website.

Topics

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published