Skip to content

Repository files navigation

MealBuddy

Full stack: Next.js (frontend) + Laravel (API) + PostgreSQL (database).

Architecture

┌─────────────────┐ HTTP (API) ┌─────────────────┐
│ Next.js :3000 │ ──────────────────► │ Laravel :8000 │
│ frontend/ │ Sanctum + CORS │ backend/ │
└─────────────────┘ └────────┬────────┘
│ SQL
▼
┌─────────────────┐
│ PostgreSQL :5432 │
│ (Docker) │
└─────────────────┘

Structure

mealbuddy/
├── backend/ # Laravel 13 — REST API, Sanctum, Filament
├── frontend/ # Next.js 16 — React UI
├── docker-compose.yml # PostgreSQL for local dev
├── package.json # Root scripts
└── pnpm-workspace.yaml

Prerequisites

  • Docker (for PostgreSQL)
  • PHP 8.3+ with pdo_pgsql, Composer
  • Node 20+, pnpm

Install the PHP PostgreSQL extension if needed:

# macOS (Homebrew PHP)
pecl install pdo_pgsql
# or ensure php is built with pgsql

Setup

1. Start PostgreSQL

pnpm db:up

2. Install dependencies and migrate

pnpm setup
cp frontend/.env.example frontend/.env.local

pnpm setup starts Postgres, installs Node/PHP deps, copies backend/.env, generates an app key, and runs migrations.

3. Run the stack

pnpm dev
ServiceURL
Frontendhttp://localhost:3000
APIhttp://localhost:8000
PostgreSQLlocalhost:5432

Environment

Backend (backend/.env)

Defaults in .env.example match Docker Compose:

VariableDefault
DB_CONNECTIONpgsql
DB_HOST127.0.0.1
DB_PORT5432
DB_DATABASEmealbuddy
DB_USERNAMEmealbuddy
DB_PASSWORDsecret

Frontend (frontend/.env.local)

NEXT_PUBLIC_API_URL=http://localhost:8000/api

Useful commands

pnpm db:up # Start PostgreSQL
pnpm db:down # Stop PostgreSQL
pnpm db:reset # Wipe volume and recreate DB
pnpm dev # Laravel + Next.js
pnpm dev:backend # Laravel only
pnpm dev:frontend # Next.js only

Laravel (from backend/)

php artisan migrate
php artisan migrate:fresh --seed
php artisan tinker

Tests

PHPUnit uses in-memory SQLite (fast, no Docker required):

cd backend && composer test

Notes

  • CORS and Sanctum allow http://localhost:3000 (backend/config/cors.php, backend/config/sanctum.php).
  • Inertia pages under backend/resources/js are for Filament / legacy routes; the main app UI is in frontend/.
  • Change Postgres credentials in both root .env (Docker) and backend/.env (Laravel) if you customize them.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages