This document outlines the migration from Supabase to Laravel for the WolvCapital investment platform.
The migration involves:
Next.js Frontend → Supabase Client → Supabase Database + Auth + RLS
Next.js Frontend → Laravel API Client → Laravel Backend → Database
# Install Laravel dependencies
npm run backend:install
# Create environment file
cp backend/.env.example backend/.env
# Generate application key
cd backend && php artisan key:generate
# Configure database in backend/.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=wolvcapital
DB_USERNAME=your_username
DB_PASSWORD=your_password
# Run migrations
npm run backend:migrate
# Start Laravel development server
npm run backend:serve
The following tables were migrated from Supabase to Laravel:
Supabase Table | Laravel Migration | Laravel Model |
---|---|---|
user_profiles |
create_user_profiles_table |
UserProfile |
investment_plans |
create_investment_plans_table |
InvestmentPlan |
transactions |
create_transactions_table |
Transaction |
user_investments |
create_user_investments_table |
UserInvestment |
admin_approvals |
create_admin_approvals_table |
AdminApproval |
Laravel API endpoints replace Supabase client calls:
Function | Supabase | Laravel API |
---|---|---|
Authentication | ||
Register | supabase.auth.signUp() |
POST /api/auth/register |
Login | supabase.auth.signInWithPassword() |
POST /api/auth/login |
Logout | supabase.auth.signOut() |
POST /api/auth/logout |
User Profile | ||
Get Profile | supabase.from('user_profiles').select() |
GET /api/profile |
Update Profile | supabase.from('user_profiles').update() |
PUT /api/profile |
Investment Summary | Custom query | GET /api/profile/investment-summary |
Investment Plans | ||
List Plans | supabase.from('investment_plans').select() |
GET /api/investment-plans |
Get Plan | supabase.from('investment_plans').select() |
GET /api/investment-plans/{id} |
Create Plan | supabase.from('investment_plans').insert() |
POST /api/investment-plans |
Transactions | ||
List Transactions | supabase.from('transactions').select() |
GET /api/transactions |
Create Investment | supabase.from('transactions').insert() |
POST /api/transactions/invest |
Create Withdrawal | supabase.from('transactions').insert() |
POST /api/transactions/withdraw |
# Update .env.local
NEXT_PUBLIC_LARAVEL_API_URL=http://localhost:8000/api
# Legacy Supabase vars can be commented out
# NEXT_PUBLIC_SUPABASE_URL=...
# NEXT_PUBLIC_SUPABASE_ANON_KEY=...
// Before (Supabase)
import { supabase } from '@/lib/supabase'
import { useAuth } from '@/hooks/useAuth'
// After (Laravel)
import { laravelApi } from '@/lib/laravel-api'
import { useAuth } from '@/hooks/useAuth-laravel'
// Before (Supabase)
const { data, error } = await supabase
.from('investment_plans')
.select('*')
.eq('status', 'active')
// After (Laravel)
const response = await laravelApi.getInvestmentPlans({
status: 'active'
})
const { plans } = response
# Frontend development
npm run dev
# Backend development
npm run backend:serve
# Database operations
npm run backend:migrate
npm run backend:fresh # Fresh migration with seeding
npm run backend:seed
# Build and deployment
npm run build
npm run backend:install
npm run dev # Frontend on :3000
npm run backend:serve # Laravel API on :8000
# Register a user
curl -X POST http://localhost:8000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","password":"password123"}'
# Get investment plans
curl http://localhost:8000/api/investment-plans
Phase | Duration | Status |
---|---|---|
Phase 1: Backend Setup | 2-3 days | ✅ Complete |
Phase 2: API Development | 3-4 days | ✅ Complete |
Phase 3: Frontend Integration | 2-3 days | 🔄 In Progress |
Phase 4: Testing & Debugging | 2-3 days | ⏳ Pending |
Phase 5: Deployment | 1-2 days | ⏳ Pending |
backend/storage/logs/laravel.log
APP_DEBUG=true
in backend/.envWolvCapital - Successfully migrated from Supabase to Laravel for enhanced control and performance.