Skip to content

Repository files navigation

CodeHunts

Full-stack web development — sharp, fast, and ready to ship.

A modern full-stack web platform with a React frontend and PHP backend, optimized for Hostinger hosting.

CodeHunts delivers a polished, high-performance website for showcasing services, portfolio, and team — with a secure API for contact forms, project management, and team administration.

React TypeScript Tailwind CSS Vite PHP License


Why CodeHunts?

Most agency websites are slow, hard to maintain, and require expensive hosting. CodeHunts is different. It's a single, self-contained stack — React for a blazing-fast frontend, PHP for a backend that runs on any shared hosting. No Node servers, no Docker, no vendor lock-in.

"Ship fast. Stay lean. Own your stack."


Features

React 19 Frontend

Built with React 19, TypeScript 5.8, and Vite 7. Full type safety, code splitting, lazy loading, and optimized assets out of the box. Mobile-first responsive design powered by Tailwind CSS 4.

Accessible by Default

ARIA-compliant components built on Radix UI primitives. Follows WCAG guidelines so your site works for everyone, not just most people.

PHP REST API

A clean PHP backend with JWT authentication, PDO database connections, and PHPMailer for email. Contact forms, project CRUD, team management — all ready for Hostinger shared hosting.

Secure

API key authentication on protected endpoints, SQL injection protection via prepared statements, CORS configuration, and XSS prevention. Security isn't optional.

Admin Dashboard

Protected admin routes for managing projects, team members, and company info. Login with JWT tokens, role-based access, and a clean UI for content management.

And more

  • Framer Motion animations — smooth page transitions and micro-interactions
  • Form validation — robust client-side validation with helpful error messages
  • SEO optimized — meta tags, structured data, and semantic HTML
  • Code quality — ESLint, Prettier, and automated formatting checks
  • Image uploads — secure file upload handling for projects and team photos
  • Email system — SMTP via Hostinger, SendGrid, Gmail, or native mail()

Quick Start

Prerequisites

  • Node.js 18+
  • npm 9+ or yarn 1.22+
  • PHP 7.4+ (for backend)
  • MySQL/MariaDB (for backend)

Frontend

git clone https://github.com/uxlabspk/codehunts.git
cd codehunts
npm install
cp .env.example .env

Start the dev server:

npm run dev

The app runs at http://localhost:5173.

Backend

  1. Upload api/ to your Hostinger public_html/api/ directory
  2. Create a MySQL database and import api/database/schema.sql
  3. Create an email account in hPanel (e.g. contact@yourdomain.com)
  4. Configure: cp api/.env.example api/.env and fill in your credentials
  5. Install PHPMailer: cd api && composer install
  6. Test: visit https://yourdomain.com/api/projects/list.php

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


How it works

React (Vite)             SPA with client-side routing, lazy-loaded pages
    ↓
API Calls                Fetch/axios to PHP endpoints
    ↓
PHP API                  RESTful handlers with JWT auth, PDO, PHPMailer
    ↓
MySQL                    Projects, team, contact submissions, admin users
    ↓
Email                    SMTP or native mail() for contact form delivery

Request flow: Frontend hits /api/*.php → auth middleware validates JWT or API key → handler processes with prepared statements → JSON response → frontend updates state.

Admin flow: Login at /admin/login → JWT token stored → protected routes verify token via auth.php middleware → CRUD operations on projects/team/company.


Tech Stack

Layer Tech
UI React 19 + TypeScript 5.8 — type-safe, component-driven
Styling Tailwind CSS 4 — utility-first, responsive
Animation Framer Motion — page transitions, micro-interactions
Routing React Router 7 — client-side navigation
Components Radix UI — accessible primitives (select, label, nav)
Build Vite 7 — fast bundling, HMR
Backend PHP 7.4+ — REST API with JWT auth
Database MySQL/MariaDB via PDO — secure prepared statements
Email PHPMailer 6.8 — SMTP with fallback to mail()
Hosting Hostinger — optimized for shared PHP hosting

Project Structure

codehunts/
├── src/                         Frontend source
│   ├── components/
│   │   ├── common/             Header, footer, hero, team cards
│   │   ├── landing/            Landing page sections
│   │   ├── portfolio/          Project cards
│   │   ├── services/           Service overview, features, process
│   │   ├── form/               Demo request form
│   │   └── ui/                 Base UI (button, card, input, select)
│   ├── pages/                  Route components (landing, about, services, ...)
│   ├── data/                   Static data (projects, team)
│   ├── hooks/                  Custom hooks (useCountUp)
│   ├── lib/                    Utilities (cn, validation, SEO, scroll)
│   ├── config/                 Environment config
│   ├── constants/              Navigation, buttons, app constants
│   ├── contexts/               Admin auth context
│   ├── services/               API client (admin-api)
│   └── types/                  TypeScript definitions
├── api/                        Backend PHP API
│   ├── auth/                   login.php, me.php
│   ├── projects/               CRUD endpoints (list, create, update, delete)
│   ├── team/                   CRUD endpoints (list, create, update, delete)
│   ├── company/                get.php, update.php, public.php
│   ├── helpers/                auth.php, http.php, jwt.php
│   ├── config/                 database.php, env.php
│   ├── uploads/                Image upload handler
│   └── mail.php                Email sending
├── public/                     Static assets
├── vite.config.ts              Vite configuration
├── tsconfig.json               TypeScript config
├── eslint.config.js            Linting rules
└── package.json                Dependencies and scripts

Configuration

Frontend (.env)

Variable Description
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)

Variable Default Description
DB_HOST localhost Database host
DB_NAME Database name
DB_USER Database username
DB_PASS Database password
SMTP_HOST smtp.hostinger.com SMTP server
SMTP_PORT 587 SMTP port
SMTP_USERNAME Email address
SMTP_PASSWORD Email password
API_SECRET_KEY Strong key for protected endpoints
ALLOWED_ORIGINS Comma-separated CORS domains

API Endpoints

Endpoint Method Auth Description
/api/mail.php POST No Submit contact form
/api/projects/list.php GET No Get all projects
/api/projects/public.php GET No Public project listing
/api/projects/create.php POST Yes Create project
/api/projects/update.php PUT Yes Update project
/api/projects/delete.php DELETE Yes Delete project
/api/team/list.php GET No Get all team members
/api/team/public.php GET No Public team listing
/api/team/create.php POST Yes Create team member
/api/team/update.php PUT Yes Update team member
/api/team/delete.php DELETE Yes Delete team member
/api/auth/login.php POST No Admin login
/api/auth/me.php GET Yes Get current user

Protected endpoints require X-API-Key or Authorization: Bearer <JWT> header.


Development

Scripts

npm run dev            # Start Vite dev server
npm run build          # Production build
npm run preview        # Preview production build
npm run validate       # Run all checks (type + lint + format)
npm run type-check     # TypeScript type checking
npm run lint           # ESLint
npm run lint:fix       # Auto-fix lint issues
npm run format         # Format with Prettier
npm run format:check   # Check formatting

Code Quality

All checks at once:

npm run validate

Deployment

Frontend

npm run build
# Upload dist/ contents to Hostinger public_html/

Backend

# Upload api/ folder to Hostinger public_html/api/
# Follow BACKEND-SETUP.md for database and email setup

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: git commit -m "feat: your feature"
  5. Push: git push origin feature/your-feature
  6. Open a Pull Request

Follow Conventional Commits:

  • feat: — new feature
  • fix: — bug fix
  • docs: — documentation
  • style: — formatting
  • refactor: — code restructuring
  • test: — adding tests
  • chore: — build/tooling

License

Copyright © 2024 CodeHunts. All rights reserved.


Need help?


Built sharp. Shipped fast.

⭐ Star this repo

About

A Dedicated Software Development Company Based in Pakistan Official Website.

Topics

Resources

Contributing

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages