Skip to content
RWC

Project

Paw5: The Laravel API and Admin Panel Behind a Pet Care Marketplace

Paw5 helps pet owners find boarding, day care, dog walking, training and grooming near them. I built its Laravel back end: the JSON API for the website and app, distance search, priced service extras, boarding prices and the admin panel.

By Rohit Pippal9 min readComments

Paw5, also written Pawfive, is a marketplace for pet care. Its promise is in the first line of its homepage design: find trusted pet hostels, day care and more near you. Pet owners search for boarding, day care, dog walking, training, grooming and home visits, compare the providers around them, and talk to the one they choose. Providers list their services, prices, opening hours and qualifications.

I built the Laravel back end of the platform: the JSON API that the website and the phone app talk to, and the admin panel the team uses to run the marketplace. The website's screens were designed as HTML pages first, and the API had to give each of those screens what it needed.

This write-up explains how Paw5 works for each kind of user, and the parts of the back end that took the most thought.

What I built

  • The API: sign-up with email verification, sign-in with email or a social account, profiles, pets, provider services, search, order messages, ratings and help messages, all as JSON with token sign-in.
  • Provider listings: services by category with a price for every extra, pet sizes, capacity, photo and video galleries, working hours for each day, skills and certificates.
  • Search near you: by service, by keyword and by distance from the person's location, with ratings and opening hours in every result.
  • Boarding rooms: rooms per category with a base price, plus date ranges with a price of their own for busy days.
  • Messages and help: a conversation for each order, and help requests the team answers by email from the admin panel.
  • Admin panel: categories, pet types, providers, users, coupons, banners, FAQ, ratings, orders, admin accounts, roles and permissions, and site settings.

How Paw5 works

Three groups use the platform. Each one sees a different side of the same data.

Pet owners

A pet owner signs up with a name, email address, phone number, city and pin code. The platform sends a verification link that works for 10 minutes, and an account cannot sign in until its email address is verified. A username is made automatically from the first name and a number, and the platform keeps trying until it finds one that nobody else has.

Owners can also sign in with Facebook or Google. The app sends the social account's details, and the API matches it to an existing account first by the social ID, then by email address, so the same person does not end up with two accounts.

Under My Pets, an owner adds each pet with a photo, its name, its type (dog, cat and the other types the team adds), breed, birthday, weight and height. Each owner only ever sees and changes their own pets.

Then comes the search. An owner picks a service, types a word or shares their location, and gets a list of providers. Each result shows the store name, an "assured" badge that the team can give a provider, the address, the average rating with the number of ratings, and the opening hours for each day. The provider's own page adds the logo, the photo gallery, the "about us" text, the extras on offer and the reviews.

Once an order exists, the owner and the provider talk in a message thread that belongs to that order. Afterwards the owner can rate the service and write a review. For anything else there is a help form that goes straight to the team.

Service providers

A provider is a normal account with a store profile attached. The profile holds:

  • the store name, an "about us" text, the address and its map coordinates
  • a logo and a photo gallery
  • skills and qualifications, chosen from a list the platform provides
  • certificate pictures
  • the supervision level: shared pet care or dedicated pet care
  • working hours for all seven days, each day open with its times or marked closed

On top of the profile come the services. A provider adds one service per main category, such as boarding or day care, and for each one sets the pet sizes they accept (1–5 kg up to 20 kg and more), how many pets they can take, photos, and a price for every extra in that category. Extras come in two kinds, essential and premium, so a provider can price a weekly bath separately from the basic stay.

Every account says which side it belongs to: pet owner, provider or both. A provider signs in at the same place as a pet owner, and the sign-in answer already carries the store profile and working hours, so the app can open the provider's side straight away.

The admin team

The admin panel is where the team runs the marketplace:

  • service categories and their extras, each with an image and an essential or premium flag
  • pet types
  • users
  • provider profiles, their services, galleries and working hours
  • boarding rooms and their date prices
  • orders and the messages inside them
  • ratings, with an active or inactive status for each
  • help messages, filtered by pet owners or providers, with replies
  • coupons, home page banners and the FAQ
  • admin accounts, roles and permissions
  • site settings

Search by distance

The most important question on a pet care site is "who is near me?". A dog walker 40 km away is no use, however good the reviews.

Each provider is stored with the latitude and longitude of their address. When the app sends the person's location, the database works out the distance to every provider with the haversine formula, which measures distance over the curve of the earth, keeps the ones within 50 km and sorts them nearest first. The calculation runs inside the database query, so the platform never loads every provider into memory just to measure them.

The same query brings each provider's average rating, their number of ratings and their working hours in one go. A list of twenty results does not turn into twenty extra trips to the database.

Keyword search has a rule of its own. When someone types "groom", the suggestions only include categories and extras that at least one provider actually offers. A search never suggests a service that nobody on the platform sells.

There is also a small random selection of providers with their services and ratings, so a home page can show different providers on each visit.

Services with a price for every extra

Pet care is rarely one fixed price. A boarding stay might come with walks, a weekly bath or training sessions, and every provider charges differently for them.

So the data has four layers:

LayerWhat it holds
Main categoryBoarding, day care, dog walking, training, grooming, home visits
ExtraThe options inside a category, each essential or premium
Provider serviceOne provider's offer in one category: pet sizes, capacity, photos, videos, status
Provider priceThat provider's price for one extra

When a provider edits a service, the API updates the prices that already exist, adds the new extras and removes the ones the provider took out, in one request. The provider's page then shows exactly the extras that provider sells, with their pictures and the premium mark.

Boarding rooms and prices for busy days

Boarding has a problem the other services do not: prices change on holidays and long weekends. Rooms are set up per category with their number and a base price. Then the team can add date ranges with a price of their own, for example a festival week.

The rules keep those ranges sensible. A range cannot start in the past, it cannot end before it starts, and it is refused when its start or end date falls inside a range already set for those rooms. The team gets a clear message instead of two prices fighting over the same night.

Pictures from a phone

Most pictures on Paw5 come from a phone: a pet's photo, a provider's gallery, a certificate. The app sends them as base64 text inside the JSON request, which keeps the API simple for the app developers.

On the server, the API decodes each picture, saves it under a new file name with Intervention Image at a lower quality, and deletes the old file when a picture is replaced. Logos are resized to 400 × 300 pixels so every listing looks the same. In the admin panel, galleries are limited to four pictures, and the upload of service photos and videos (up to 20 MB) shows its progress while it runs.

Settings without a code change

The team can change the running site from the admin panel instead of asking a developer:

  • the app name, its address, the logo and the favicon
  • the mail server the platform sends its emails through
  • a maintenance mode switch
  • the page's search engine fields: title, meta title, keywords and description
  • the keys for Facebook and Google sign-in, Google Maps and the PayUmoney payment gateway

The API serves the name, the logo and the search engine fields, so a change in the admin panel can show on the website without a new release.

Admin accounts and permissions

Admins are kept apart from pet owners and providers. They have their own table, their own sign-in page and their own session, so a member's sign-in never opens the admin panel.

Inside the panel, roles and permissions decide who can do what. The permissions cover roles, admin accounts and users, each with list, create, edit and delete. The admin accounts and roles screens check them on the server, so only someone with the right role can create another admin or change what a role may do.

What I took from this project

A marketplace is two products sharing one database. Pet owners want a short list of nearby, trusted people; providers want to describe their business in detail, down to the price of a bath. Most of the design work was finding a data model that served both without making either side fill in fields they did not care about, and then making the API answer each screen in one request.

Tools used

AreaTools
BackendLaravel, PHP, MySQL
APIJSON endpoints with Laravel Sanctum tokens
Admin panelBlade templates, Bootstrap, jQuery, DataTables
AccessSeparate admin guard, roles and permissions
ImagesIntervention Image
SearchHaversine distance in SQL
EmailLaravel Mail with templates

Planning a marketplace where customers book local providers? Tell me about it.

Comments

No ratings yet

Log in to comment

Only members can comment and rate posts. It is free and takes a minute.

No comments yet. Be the first to share your thoughts.

All projects
  • Project

    Online Stores

    BNB Arts: Photo Licensing Platform with a Laravel API and Admin Panel

    BNB Arts licenses photographers' work to publishers and businesses. I built its Laravel API and admin panel: photo uploads that read EXIF and IPTC data, one licence price list the server adds up, gallery search, accounts and PayPal orders.

    9 min read
  • Project

    Service Marketplaces

    Bid Learn Grow: A Booking Engine Where Clients Bid for a Coach's Time

    Bid Learn Grow is a Laravel booking engine where clients bid for a coach's time slots. I built the booking and bidding rules, the outbid and winner emails, Google Calendar and Outlook sync, and a booking widget coaches paste into their own websites.

    7 min read
  • Project

    Service Marketplaces

    Pluckit: Looking After an Australian Tradie Recommendation Platform

    Pluckit helps Australians find tradies through recommendations from people they know. I look after this Laravel platform: Google review integration, sitemaps for thousands of pages, cleaner answers for search engines and new tools for tradies.

    9 min read