- PHP: ^8.2
- Laravel: ^12.0
- MySQL: 5.7+ or 8.0+
- Composer: 2.0+
git clone https://github.com/Chisonm/Loyalty-Program
cd backend-api# Install PHP dependencies
composer install# Copy environment file
cp .env.example .env
# Generate application key
php artisan key:generateEdit your .env file with your database credentials:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=backend_api
DB_USERNAME=your_username
DB_PASSWORD=your_password# Run migrations
php artisan migrate
# Seed the database with sample data
php artisan db:seedThis will create:
- Badge tiers (Bronze, Silver, Gold, etc.)
- Sample achievements (First Purchase, Loyal Customer, etc.)
- Test users with progress data
This command starts:
- Laravel development server (http://localhost:8000)
# Laravel server
php artisan serve# Format code with Laravel Pint
./vendor/bin/pint# Run test
php artisan testPOST /api/login- User login- body: { "email": "test@example.com", "password": "password" }
GET /api/users/{user}/achievements- Get user achievements and progressGET /api/users- Get all usersGET /api/users/{user}- GET a user by ID
POST /api/checkout- Process a purchase (requires auth)- body: { "amount": 100 }
User- User model with authenticationUserStats- Tracks user purchase metricsBadge- Badge definitions with unlock requirementsAchievement- Achievement definitions with progress trackingPurchase- Purchase records with amount and user
PurchaseMade- Fired when user completes purchaseBadgeUnlocked- Fired when user unlocks new badge- Background listeners update achievements and badges automatically
- Node.js: ^21.7.3
- NPM: ^8.19.2
git clone https://github.com/Chisonm/Loyalty-Program
cd frontendnpm install# Copy environment file
cp .env.example .envnpm run dev- Visit
http://localhost:5173in your browser to access the frontend application.

