Skip to content

codestcode/Hirfa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

91 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Hirfa Logo

Craftsmen Maintenance Marketplace - حِرفة (Hirfa)

A full-stack, mobile-first app, The all-in-one home services platform for the Arabic world. Browse verified craftsmen, compare prices, view before/after portfolios, book instantly, and track your orders , all from your phone.


Overview

Hirfa is a complete home maintenance platform built with Next.js 16 and Supabase. It serves three user types:

  • Clients β€” Browse craftsmen and organizations, book services, request emergency help, manage orders and wallet
  • Craftsmen (Workers) β€” Manage gallery with before/after photos, accept/reject orders, set services, manage schedule and payments
  • Organizations β€” Manage a team of craftsmen under one brand, handle org bookings, assign workers, manage services and portfolio

✨ Features

πŸ” Authentication & Onboarding

  • Phone-based login with OTP verification
  • Role selection (Client / Craftsman)
  • Multi-step onboarding flow with splash, welcome, intro carousel, and success animation

Client App

Feature Description
Home Category grid, featured craftsmen & organizations, nearby listings
Craftsman Profile Full profile with before/after gallery, services, reviews, booking CTA
Organization Profile Org profile with services catalog, portfolio gallery, workers, reviews
Gallery Modal Card-based photo viewer with navigation (before/after comparison)
Booking 4-step wizard with date picker, time slots, address, payment method
Emergency SOS Quick emergency booking with live tracking simulation
Orders Track orders β€” shows org name + worker name for org bookings
Invoice Final invoice with org branding for org bookings
Rating Rate workers or organizations after completion
Wallet Deposit, cards management, transaction history
Addresses Saved addresses with CRUD
Search Search craftsmen by name or profession
Notifications Real-time notifications
Profile Edit personal info, settings menu

πŸ”§ Craftsman (Worker) App

Feature Description
Home Availability toggle, new requests, appointments, quick links
Orders Accept/reject orders, update status, order cards with emergency badge
Gallery Add/delete before/after work photos with card modal
Services Manage offered services and pricing
Messages Chat with clients
Schedule Manage availability and appointments
Notifications In-app notifications
Profile Edit info, verification status, payment methods, help, terms
Wallet Earnings overview, withdrawals
Calendar View booked appointments
Org Rating Rating as part of an organization shown on profile

🏒 Organization App

Feature Description
Dashboard Real-time stats (bookings, revenue, pending/completed), recent orders, rating
Orders Management View all org bookings, accept/reject, assign workers, update tracking status
Worker Assignment Assign org workers to bookings, search linked accounts, send notifications
Workers Management Dedicated workers page β€” add, remove, search linked accounts, portfolio upload
Services Management Manage org services and pricing
Portfolio Gallery Upload/remove org portfolio photos (up to 5)
Organization Profile Create/edit org with name, category, city, logo, description
Plan System Free plan with worker limits, Pro plan for unlimited workers
Wallet Org wallet with earnings, withdrawals, transaction history
Messages Chat with clients
Settings Org settings and configuration

Admin Dashboard

  • User management, system rules, content moderation

🏒 Organization System

The platform supports a full organization management system where craftsmen can form organizations and manage teams.

How It Works

  1. Worker creates an organization via their profile β†’ becomes the owner
  2. Owner adds workers to the org (search by name/phone, link accounts)
  3. Clients browse organizations alongside individual craftsmen
  4. Client books an org β†’ order appears in the org's dashboard
  5. Owner assigns a worker to the booking
  6. Worker completes the job β†’ confirmation code flow
  7. Payment goes to the org owner's wallet (not the individual worker)
  8. Client rates β†’ rating goes to both the worker and the organization

Key Components

Component Description
Org Profile (Client) Services catalog, portfolio gallery (5 photos), workers list, reviews
Org Dashboard (Owner) Stats grid, recent orders, gallery management, quick actions
Org Orders Full order list with worker assignment, tracking updates, status badges
Org Workers Add/remove workers, search linked accounts, portfolio upload (4 photos)
Org Wallet Earnings from all org bookings, transaction history, withdrawals
Org Booking Flow Client selects org service β†’ default schedule β†’ org owner assigns worker

Database

  • organizations β€” org profile with name, category, city, logo, plan, rating
  • organization_workers β€” workers linked to an org (linked_user_id β†’ auth.users)
  • organization_worker_portfolio β€” portfolio photos per worker
  • organization_reviews β€” client reviews for the org (auto-updated via trigger)
  • organization_gallery β€” org portfolio photos
  • organization_services β€” services offered by the org
  • Bookings link to org via organization_id and assigned_worker_id

Rating System

  • Worker ratings: stored in reviews table, average on profiles.rating
  • Org ratings: stored in organization_reviews table, average on organizations.rating
  • Auto-propagation: when a worker review is inserted and the worker belongs to an org, a database trigger automatically inserts an org review β€” keeping org ratings in sync
  • Workers see "ΨͺΩ‚ΩŠΩŠΩ… ΩƒΨ¬Ψ²Ψ‘ Ω…Ω† Ψ§Ω„Ω…Ψ€Ψ³Ψ³Ψ©" (rating as part of organization) on their profile

Payment Flow

  • Direct bookings: money goes to the worker's wallet
  • Org bookings: money goes to the org owner's wallet
  • Commission rate determined by the recipient's subscription tier
  • Transactions logged with (Ω…Ψ€Ψ³Ψ³Ψ©) label for org bookings

Tech Stack

Layer Technology
Framework Next.js 16 (App Router, Turbopack)
Language TypeScript
Styling Tailwind CSS v4 + custom dark theme
Database Supabase (PostgreSQL with RLS)
Auth Supabase Auth (phone OTP)
Icons Lucide React
Maps Leaflet / Mapbox GL
Animations Framer Motion
Internationalization next-intl (Arabic RTL-first)
State React Hooks + TanStack Query
UI Primitives shadcn/ui + Base UI

πŸ“ Project Structure

Hirfa/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ (auth)/                   # Login, register, OTP, verification
β”‚   β”œβ”€β”€ (main)/                   # Worker pages (home, orders, gallery, etc.)
β”‚   β”œβ”€β”€ (onboarding)/             # Splash, welcome, intro, success
β”‚   β”œβ”€β”€ admin/                    # Admin dashboard
β”‚   β”œβ”€β”€ api/                      # Supabase API routes
β”‚   β”œβ”€β”€ client/                   # Client pages (craftsman, booking, wallet, etc.)
β”‚   β”‚   β”œβ”€β”€ organization/         # Org profile page (client view)
β”‚   β”‚   β”œβ”€β”€ craftsman/            # Worker profile page (client view)
β”‚   β”‚   β”œβ”€β”€ booking/              # Booking flow (individual & org)
β”‚   β”‚   β”œβ”€β”€ orders/               # Client orders list
β”‚   β”‚   β”œβ”€β”€ order/                # Order detail, invoice, success
β”‚   β”‚   β”œβ”€β”€ rate-review/          # Rating page (workers & orgs)
β”‚   β”‚   β”œβ”€β”€ services/             # Category services listing
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ organization/             # Org owner dashboard
β”‚   β”‚   β”œβ”€β”€ home/                 # Dashboard with stats, orders, gallery
β”‚   β”‚   β”œβ”€β”€ orders/               # Org orders with worker assignment
β”‚   β”‚   β”œβ”€β”€ workers/              # Workers management (add, search, portfolio)
β”‚   β”‚   β”œβ”€β”€ messages/             # Org messages
β”‚   β”‚   β”œβ”€β”€ wallet/               # Org wallet & earnings
β”‚   β”‚   └── settings/             # Org settings
β”‚   β”œβ”€β”€ globals.css               # Global styles + design tokens
β”‚   β”œβ”€β”€ layout.tsx                # Root layout with RTL and fonts
β”‚   └── page.tsx                  # Splash redirect
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ auth/                     # ProtectedRoute, Route guards
β”‚   β”œβ”€β”€ shared/                   # CraftsmanCard, CategoryCard, OTPInput
β”‚   └── ui/                       # BeforeAfterCard, ImageUploader, modals, etc.
β”‚       β”œβ”€β”€ orders/               # OrderCard, OrdersTabs (supports org bookings)
β”‚       β”œβ”€β”€ profile/              # StatCard, ReviewCard, MenuGroup, etc.
β”‚       └── wallet/               # WalletBalanceCard, TransactionCard
β”œβ”€β”€ contexts/                     # AuthContext
β”œβ”€β”€ hooks/                        # useGallery, useCraftsmanProfile, useOrganization, etc.
β”œβ”€β”€ lib/                          # Types, utils, Supabase client/server
β”‚   └── supabase/                 # booking-payments.ts (handles org payments)
β”œβ”€β”€ services/                     # Auth and profile services
β”œβ”€β”€ supabase/                     # Migrations, schema
└── public/                       # Static assets

Emergency SOS

One-tap emergency booking that auto-fills user address and creates an urgent order with real-time tracking simulation.


πŸš€ Getting Started

Prerequisites

  • Node.js (v18+)
  • pnpm (recommended) or npm/yarn
  • Supabase account & project

βš™οΈ Environment Variables

Create a .env or .env.local file in the root directory and add the following keys:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key

# SMTP Configuration for Emails
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=your_email@example.com
SMTP_PASS=your_email_password
SMTP_FROM=noreply@example.com

# Map Integrations
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your_google_maps_api_key

πŸ’» Installation & Local Development

  1. Clone the repository and install dependencies:
git clone https://github.com/your-username/Hirfa.git
cd Hirfa
pnpm install
  1. Start the development server:
pnpm run dev
  1. Open http://localhost:3000 in your browser.

πŸ—οΈ Build Commands

The project uses Next.js with specialized build commands for different targets:

  • pnpm run build:web β€” Standard Next.js production build for web hosting (Vercel, etc.).
  • pnpm run build:capacitor β€” Specialized static export build (output: 'export') that compiles the app for Capacitor, generating static HTML/JS files in the out directory.

πŸ“± Mobile App (Capacitor) & CI/CD

Hirfa is built as a mobile-first application and is compiled into a native Android APK using Capacitor.

GitHub Actions (Automated CI/CD)

The project is equipped with a robust GitHub Actions workflow (.github/workflows/build-apk.yml) that automatically builds the Android APK upon pushing to any branch.

  1. It builds the Next.js app using pnpm run build:capacitor.
  2. It safely configures Capacitor and runs npx cap sync android.
  3. It compiles the APK using Gradle (assembleDebug).
  4. The resulting app-debug.apk is available as a downloadable artifact directly from the Actions tab on GitHub.

Manual Local Build

If you want to build the APK locally on your machine:

  1. Build the web assets specifically for Capacitor:
pnpm run build:capacitor
  1. Sync the web assets with the Android project:
npx cap sync android
  1. Open the project in Android Studio (or build via CLI):
npx cap open android

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for detailed instructions on how to set up your environment, follow our coding standards, and submit pull requests.


πŸ“„ License

Hirfa Team β€” All rights reserved.


Built with ❀️ for the Arabic-speaking world
حِرفة β€” Ω„Ψ£Ω† حرفΨͺΩƒ ΨͺΨ³ΨͺΨ­Ω‚ الأفآل

About

A full-stack, mobile-first app, The all-in-one home services platform for the Arabic world. Browse verified craftsmen, compare prices, view before/after portfolios, book instantly, and track your orders , all from your phone.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors