🚚 A1 App Builders — Flagship Product

Delivery AppPlatform
Reference Guide

A complete, self-hosted delivery and service dispatch platform supporting 30+ business types. One codebase, full source code, zero monthly fees — deployed on your own server.

PHP + SQLite / MySQL 30+ Business Types Real-Time Tracking CSRF + Session Security One-Time $2,000
01

What It Does

The Delivery App Platform is a fully self-hosted, white-label dispatch and delivery management system. It ships as a complete PHP application covering the full order lifecycle — from customer booking through driver dispatch, real-time tracking, payment processing, ratings, and analytics — for any of 30+ configurable business verticals.

📊
Admin Dashboard
Central command for orders, drivers, customers, payouts, promo codes, and analytics. Full role-based access control with audit trails.
🚗
Driver App
Driver-facing portal for accepting/rejecting orders, GPS location updates, availability scheduling, earnings tracking, and route management.
👤
Customer Portal
Customer accounts, order history, real-time tracking, ratings & reviews, promo code redemption, and support ticket submission.
💳
Payment Processing
Secure payment gateway integration with multiple payment methods, refund management, and driver payout tracking.
🔒
Enterprise Security
Session timeout enforcement, CSRF token protection on every form, HSTS, CSP headers, password hashing, SQL injection prevention, and full audit logging.
📈
Analytics & Reporting
Order stats, revenue tracking, driver performance, user activity logs, login history, and business intelligence dashboards.
02

30+ Supported Business Types

The platform is configurable at the business-type level — one codebase powers all verticals. Switch between types via admin settings without code changes.

🍕
Food Delivery
Restaurants, meal kits, fine dining
🛒
Grocery
Fresh produce, pantry, household
📦
Package Courier
Parcels, documents, multi-stop
💊
Pharmacy
Rx verification, temp control
🍷
Alcohol Delivery
Age verification, ID checking
🔧
Home Services
Plumbing, HVAC, cleaning, handyman
🚑
Healthcare
Medical transport, home nursing
🎓
Professional
Tutoring, training, photography
🚗
Ride & Rental
Taxi, limo, equipment rental
Same-Day Logistics
Last-mile, fulfillment centers
🎉
Event Services
Staffing, party supply, catering
🎯
B2B Distribution
Office, restaurant, retail supply
🐾
Pet Services
Grooming, vet transport, supply
🌿
Landscaping
Lawn care, gardening, snow removal
🧹
Cleaning
Residential, commercial, deep clean
🔌
Electrical
Residential, commercial installs
💡
Business type customization is handled through the admin settings panel — no code changes needed for core vertical switching. Custom verticals can be added by modifying the service category configuration tables.
03

User Roles

Three distinct user roles with separate portals, session namespaces, and access controls. No role can access another's panel.

Admin

Full Control

Manages all orders, drivers, customers, payouts, promos, analytics, and system settings. Session key: admin_logged_in

Driver

Dispatch Portal

Accepts/rejects orders, updates GPS, sets availability, tracks earnings, views schedule. Session key: driver_id

Customer

Self-Service Portal

Places orders, tracks delivery in real time, submits ratings, redeems promos, contacts support. Session key: customer_id

Session Keys by Role

$_SESSION['admin_logged_in']bool — admin auth flag
$_SESSION['driver_id']int — driver primary key
$_SESSION['customer_id']int — customer primary key
$_SESSION['last_activity']int — Unix timestamp for timeout
$_SESSION['csrf_token']string — 64-char hex token
$_SESSION['demo_views']int — page view counter
04

Pricing & Market Value

A complete delivery platform from scratch costs $50,000–$200,000 to build. SaaS alternatives lock you into monthly fees and take a cut of every transaction. The Delivery App Platform is a one-time purchase — you own it forever.

Option Cost You Own It Monthly Fees Customizable
A1 App Builders $2,000 one-time ✓ Yes $0 ✓ Full source
Custom Dev Agency $50,000–$200,000 ✓ Yes Maintenance ✓ Custom
SaaS Competitor A $5,000 + fees ✗ No $300–$1,000/mo ✗ Limited
SaaS Competitor B $4,500 + fees ✗ No $200–$800/mo ✗ Limited
💡
At $2,000 one-time, the platform pays for itself vs. SaaS alternatives in 2–7 months. Agencies can white-label and resell for $5,000–$20,000 per client deployment, making cost recovery instant.
05

File Structure

The platform is organized into three portal directories sharing a common includes layer and a single SQLite database file. No Composer, no npm, no build step required.

lastcallforalcoholdelivery/ (root — rename per client) ├── admin/ │ ├── index.php # Admin dashboard — orders, stats, activity │ ├── drivers.php # Driver management │ ├── customers.php # Customer management │ ├── orders.php # Full order history & management │ ├── payouts.php # Driver earnings & payout tracking │ ├── promos.php # Promo code CRUD │ ├── settings.php # System config, business type, branding │ ├── support.php # Support ticket management │ ├── analytics.php # Revenue, order, user analytics │ └── includes/ │ ├── config.php # DB class, auth helpers, CSRF, session │ ├── header.php # Admin sidebar layout │ └── footer.php ├── driver/ │ ├── dashboard.php # Driver home — pending orders, status │ ├── orders.php # Accept/reject, update delivery status │ ├── earnings.php # Earnings history & payout requests │ ├── schedule.php # Availability & hours management │ ├── profile.php # Driver profile, vehicle info │ └── login.php # Driver authentication ├── customer/ │ ├── index.php # Customer home — place order, track │ ├── order.php # Order placement & checkout │ ├── tracking.php # Real-time order tracking │ ├── history.php # Past orders, reorder, receipts │ ├── profile.php # Account settings, saved addresses │ ├── support.php # Submit & view support tickets │ └── login.php # Customer auth & registration ├── includes/ │ ├── config.php # Shared DB, sanitize, CSRF, session │ └── logout.php ├── assets/ │ ├── css/ # Stylesheets per portal │ ├── js/ # Tracking, maps, real-time polling │ └── uploads/ # Product images, driver photos, logos └── database/ ├── schema.sql # Full SQLite schema + seed data └── app.db # SQLite database file
FileMethodPurpose
admin/index.php GET Admin dashboard — live stats: total orders, active drivers, revenue, pending support tickets
admin/orders.php GET POST View, search, filter, reassign, and update status on all orders. Trigger refunds.
driver/orders.php POST Driver accepts/rejects dispatched orders; updates delivery status (picked up, on way, delivered)
customer/order.php POST Order placement — service selection, address, payment, promo code application
customer/tracking.php GET Real-time order tracking — polls driver GPS, shows estimated arrival, live status updates
includes/config.php PHP Database class, session init, CSRF helpers, sanitize(), auth guards, mailer, security headers
database/schema.sql SQL Full SQLite schema — 12+ tables with seed data for all business type configurations
06

Database Schema

SQLite3 by default — zero server setup, portable, fast. An optional MySQL/MariaDB migration path is available for high-volume deployments. WAL mode and foreign keys are enabled on every connection.

orders— Core order records
idINTEGER PKAuto-incrementing primary key
customer_idINTEGER FKReferences customers.id
driver_idINTEGER FKAssigned driver; NULL until dispatched
service_typeTEXT NOT NULLBusiness vertical (food, grocery, courier, etc.)
pickup_addressTEXT NOT NULLPickup/restaurant/warehouse address
delivery_addressTEXT NOT NULLCustomer delivery address
order_totalREAL NOT NULLTotal charge to customer
driver_payoutREALDriver's cut of the order
promo_codeTEXTApplied promo code (if any)
discount_amountREALCalculated discount from promo
statusTEXTpending | dispatched | picked_up | on_the_way | delivered | cancelled
payment_statusTEXTunpaid | paid | refunded
notesTEXTCustomer delivery instructions
created_atTEXTAuto-set to datetime('now')
delivered_atTEXTTimestamp set when status → delivered
drivers— Driver accounts and profile
idINTEGER PKAuto-incrementing primary key
nameTEXT NOT NULLDriver full name
emailTEXT UNIQUELogin credential
phoneTEXTContact number
password_hashTEXT NOT NULLbcrypt-hashed password
vehicle_typeTEXTcar | motorcycle | bicycle | van | truck
vehicle_plateTEXTLicense plate number
latREALLast known GPS latitude
lngREALLast known GPS longitude
is_availableINTEGER1 = accepting orders, 0 = offline
statusTEXTactive | suspended | pending_review
ratingREALAverage customer rating (1.0–5.0)
total_earningsREALLifetime driver earnings
created_atTEXTAccount creation timestamp
customers— Customer accounts
idINTEGER PKAuto-incrementing primary key
nameTEXT NOT NULLCustomer full name
emailTEXT UNIQUELogin credential and notification recipient
phoneTEXTContact number for delivery updates
password_hashTEXT NOT NULLbcrypt-hashed password
saved_addressesTEXTJSON array of saved delivery addresses
total_ordersINTEGERLifetime order count
statusTEXTactive | suspended | unverified
created_atTEXTAccount creation timestamp
promo_codes— Discount & marketing codes
idINTEGER PKAuto-incrementing primary key
codeTEXT UNIQUEThe promo code string (e.g. SAVE20)
discount_typeTEXTpercent | fixed
discount_valueREALAmount or percentage to discount
max_usesINTEGERGlobal usage limit; NULL = unlimited
uses_countINTEGERTimes this code has been redeemed
expires_atTEXTExpiry datetime; NULL = never expires
activeINTEGER1 = redeemable, 0 = disabled
support_tickets— Customer support system
idINTEGER PKAuto-incrementing primary key
customer_idINTEGER FKReferences customers.id
order_idINTEGER FKOptional — ticket linked to a specific order
subjectTEXT NOT NULLTicket subject line
messageTEXT NOT NULLCustomer's issue description
admin_replyTEXTAdmin response text
statusTEXTopen | replied | closed
created_atTEXTTicket creation timestamp
activity_log / login_log— Audit & compliance tables
idINTEGER PKAuto-incrementing primary key
actor_typeTEXTadmin | driver | customer
actor_idINTEGERID of the user who performed the action
actionTEXT NOT NULLHuman-readable description of the action
ip_addressTEXTClient IP at time of action
created_atTEXTAction timestamp
07

Security Model

Enterprise-grade security applied at every layer — from HTTP headers down to individual SQL parameters.

⚠️
Change all default passwords before going live. Default admin credentials are set during setup. All passwords are bcrypt-hashed at rest — never stored in plain text.
LayerImplementation
Session Hardeninguse_strict_mode, use_only_cookies, cookie_httponly, cookie_samesite=Strict, cookie_secure — all enabled at session start
Session Timeout30-minute inactivity timeout enforced server-side via $_SESSION['last_activity']. Cookie lifetime = 0 (dies on browser close). JS warning banner fires 60 s before expiry.
CSRF Tokens64-character hex token generated via random_bytes(32). Embedded in every POST form as a hidden field. Verified before any mutation executes.
HTTP Security HeadersX-Content-Type-Options: nosniff, X-Frame-Options: DENY, X-XSS-Protection, Strict-Transport-Security, Content-Security-Policy, Referrer-Policy, Permissions-Policy
Password HashingAll passwords stored as bcrypt hashes. password_verify() used for authentication. Plain-text passwords never logged or stored.
Prepared StatementsAll DB queries use prepare() + bindValue(). String interpolation into SQL is forbidden throughout the codebase.
Output SanitizationEvery database value rendered to HTML passes through sanitize() — an htmlspecialchars() wrapper — to prevent XSS.
Auth GuardsEvery protected page calls a role-specific guard at the top. Admin, driver, and customer guards redirect to their respective login pages if session is invalid.
Audit LoggingAll significant actions written to activity_log. All login attempts (success + failure) written to login_log with IP and user agent.

Security Headers Set on Every Request

header("X-Content-Type-Options: nosniff"); header("X-Frame-Options: DENY"); header("X-XSS-Protection: 1; mode=block"); header("Strict-Transport-Security: max-age=31536000; includeSubDomains"); header("Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';"); header("Referrer-Policy: strict-origin-when-cross-origin"); header("Permissions-Policy: geolocation=(), microphone=(), camera=()");
08

Session Management

Sessions use a two-layer timeout strategy: a server-side timestamp check and a JavaScript countdown with a user-visible warning banner.

// Server-side — checks every page load if (isset($_SESSION['last_activity'])) { if ((time() - $_SESSION['last_activity']) > $session_timeout) { session_unset(); session_destroy(); setcookie(session_name(), '', time() - 3600, '/'); session_start(); // fresh session } } $_SESSION['last_activity'] = time();
ParameterValueNotes
Timeout1800 seconds (30 min)Defined as $session_timeout
Cookie Lifetime0 (browser session)Cookie deleted on browser close
Warning Trigger60 s before expiryJS banner shown; "Stay logged in" pings ?ping=1
Ping HandlerGET ?ping=1Refreshes last_activity without full page reload; returns {"ok":true}
LogoutGET ?logout=1Destroys session, clears cookie, redirects to current URL (stripping query string)
Activity Resetmousemove, keydown, click, scroll, touchstartAny user activity resets the JS timer and calls the server ping
09

Built-In Features

Everything in the table below is included out of the box — no plugins, no add-ons, no extra cost.

FeatureDetailsPortal
Real-Time GPS TrackingDriver updates lat/lng; customer tracking page polls for live position. Map integration ready.Customer Driver
Order Lifecycle6-stage status pipeline: pending → dispatched → picked_up → on_the_way → delivered → cancelledAll
Promo Code EnginePercent or fixed discount, max uses, expiry date, active toggle. Applied at checkout with live preview.Customer Admin
Ratings & Reviews5-star customer rating per delivery. Driver average rating updated on each submission. Admin can review all.Customer Admin
Driver EarningsPer-order driver payout tracked. Earnings history, payout request, admin approval pipeline.Driver Admin
Support TicketingCustomer submits tickets (optionally linked to an order). Admin replies from support panel. Status: open → replied → closed.Customer Admin
Analytics DashboardRevenue by period, orders by status, top drivers, repeat customers, popular service types.Admin
Demo View Counter$_SESSION['demo_views'] increments per page load for demo analytics tracking.Admin
Notification SystemEmail alerts on order placement, status changes, and payout processing. Multi-channel ready.All
Mobile ResponsiveAll three portals work on phone, tablet, and desktop. Optimized for driver mobile use.All
10

Admin Panel

The admin panel is a full-featured operations center. Every table is searchable and filterable; every action is logged to the audit trail.

📊

Dashboard (index.php)

Live stat cards: active orders, available drivers, today's revenue, open support tickets. Recent activity feed from the audit log. Quick links to each module.

📦

Order Management (orders.php)

Full order history with search and status filter tabs. Reassign drivers, update status, initiate refunds, view full order detail including customer notes and GPS history.

🚗

Driver Management (drivers.php)

Approve, suspend, or reactivate drivers. View rating history, total earnings, active orders, and vehicle info. Inline commission rate editing.

👥

Customer Management (customers.php)

View all customer accounts, order history per customer, support ticket history. Suspend or reactivate accounts. Export customer data.

🎟️

Promo Codes (promos.php)

Create percent or fixed discount codes with optional max-use limits and expiry dates. View usage counts and disable active codes instantly.

⚙️

Settings (settings.php)

Business type, site name, branding colors, payment gateway keys, SMTP credentials, commission rates, service area radius — all from one panel.

11

Driver System

The driver portal is optimized for mobile use — large tap targets, minimal navigation, and live order alerts.

1
Driver logs inAuthenticates via email + password. Session key driver_id set. GPS location reporting begins.
2
Sets availabilityToggles is_available = 1 to start receiving dispatch. Visible to admin in real time.
3
Order dispatchedAdmin assigns order — driver sees notification. Status: dispatched.
4
Driver acceptsClicks Accept. Status updates to picked_up when driver reaches pickup location.
5
En routeDriver updates status to on_the_way. GPS position visible to customer on tracking page.
6
Delivery confirmedDriver marks delivered. delivered_at timestamp set. Earnings credited. Customer rating prompt appears.
12

Customer Portal

The customer-facing portal handles the full self-service lifecycle from registration through delivery confirmation and support.

PagePathPurpose
Home / Ordercustomer/index.phpService type selection, address entry, order placement entry point
Checkoutcustomer/order.phpItem selection, promo code, payment method, order confirmation
Live Trackingcustomer/tracking.phpReal-time driver GPS, estimated arrival, status timeline
Order Historycustomer/history.phpPast orders with status, receipt, reorder button, rate driver prompt
Profilecustomer/profile.phpEdit name, email, phone, saved addresses, change password
Supportcustomer/support.phpSubmit tickets, view admin replies, close resolved tickets
Login / Registercustomer/login.phpEmail + password auth, new account registration with email verification
13

Order Status Flow

Orders move through a 6-stage pipeline. Each stage transition is logged, timestamped, and can trigger email notifications.

StatusSet ByMeaningTriggers
pendingCustomerOrder placed, awaiting driver assignmentCustomer confirmation email
dispatchedAdminDriver assigned and notifiedDriver notification; tracking page activated
picked_upDriverDriver collected the order from pickupCustomer SMS/email update
on_the_wayDriverEn route to delivery addressLive GPS tracking begins for customer
deliveredDriverDelivery completed successfullydelivered_at set; earnings credited; rating prompt sent
cancelledAdmin / CustomerOrder cancelled before deliveryRefund initiated if payment was captured
14

Payments

Payment gateway integration is configurable from the admin settings panel. The platform supports multiple payment methods and a driver payout pipeline.

FeatureDetails
Payment CaptureCharge at order placement or on delivery confirmation — configurable in settings
Promo DiscountsApplied before charge calculation. discount_amount stored on order record for audit.
Driver Payoutdriver_payout per order tracked separately. Admin approves payout batches. History per driver.
RefundsAdmin-initiated from order detail. payment_status updated to refunded. Logged to audit trail.
Payment Statusunpaidpaidrefunded — tracked on every order record
💳
Payment gateway credentials (API keys, webhook secrets) are stored in the settings table and managed from admin/settings.php. Never hardcoded in source files.
15

Notifications

The platform sends automated notifications at key lifecycle events. All email goes through a configurable SMTP mailer. Push and SMS channels are architecture-ready.

TriggerRecipientChannel
Order PlacedCustomerEmail — order confirmation with summary
Order DispatchedDriver + CustomerEmail — driver assigned; tracking link sent to customer
Order Picked UpCustomerEmail / SMS — order is on the way
Order DeliveredCustomerEmail — delivery confirmed + rating request
Order CancelledCustomerEmail — cancellation notice + refund status
Support ReplyCustomerEmail — admin has replied to your ticket
Payout ProcessedDriverEmail — payout summary and amount
New RegistrationAdminEmail — new driver or customer registration notice
16

Installation

The platform is designed to go live in a single session. No Composer. No npm. No build tools.

01

Upload Files

Upload the platform directory to your PHP web host. Rename the root folder to match your brand (e.g. mydelivery/). Accessible at /mydelivery/.

02

Run Database Setup

Visit /admin/database/setup.php?key=lastcall_setup_2024 once to create all tables and seed default data. Delete or rename setup.php after running.

03

Set Admin Password

Log into /admin/login.php with the default credentials, then immediately update the password from the Settings panel. Default credentials are documented in the setup guide.

04

Configure Settings

From /admin/settings.php: set your business type, site name, SMTP credentials, payment gateway keys, commission rates, and branding colors.

05

Add Drivers & Go Live

Create driver accounts from the admin panel. Share the customer-facing URL. Your platform is live and ready to take orders.

📋
Requirements: PHP 7.4+ with SQLite3 extension (standard on most shared hosts). For high-volume deployments, a MySQL 5.7+ or MariaDB 10.3+ migration path is available. No other server dependencies.
🔒
Security checklist before going live: (1) Delete or restrict setup.php. (2) Change all default passwords. (3) Confirm HTTPS is active — HSTS header requires it. (4) Set Content-Security-Policy to your domain. (5) Verify uploads/ is not web-accessible for PHP execution.