Skip to main content

Prerequisites

Before installing NutriFit, ensure your development environment meets these requirements:

Required Software

PHP 8.2+

Modern PHP version with required extensions

Composer 2.x

PHP dependency manager

Node.js 18+

JavaScript runtime for asset compilation

Git

Version control system

Required PHP Extensions

Verify you have these PHP extensions enabled:
php -m | grep -E '(pdo|mbstring|tokenizer|xml|ctype|json|bcmath|fileinfo)'
Required extensions:
  • pdo_sqlite (or pdo_mysql for production)
  • mbstring
  • tokenizer
  • xml
  • ctype
  • json
  • bcmath
  • fileinfo
If any required extensions are missing, install them via your system’s package manager before proceeding.

Optional Software

  • MySQL 8.0+: For production database (SQLite used in development)
  • Docker: For Laravel Sail containerized environment
  • Mailtrap Account: For testing email notifications (free)

Installation

The fastest way to get NutriFit running:
1

Clone the Repository

git clone https://github.com/Rubenpro19/NutriFit.git
cd Nutrifit
2

Run Automated Setup

composer run setup
This single command handles:
  • ✅ PHP dependency installation
  • ✅ Environment configuration
  • ✅ Application key generation
  • ✅ Database creation and migration
  • ✅ Node.js dependency installation
  • ✅ Frontend asset compilation
The setup script is defined in composer.json:47-53 and automates the entire installation process.
3

Seed the Database

php artisan db:seed
This step is required to create the administrator account. Without seeding, you won’t be able to log in.
4

Start the Application

composer run dev
This starts all required services in parallel:
  • 🟦 Laravel server on http://localhost:8000
  • 🟪 Queue worker for email notifications
  • 🟧 Vite dev server with hot module replacement
See composer.json:55-58 for the dev script configuration.
Your application is now running at http://localhost:8000

Manual Installation (Step-by-Step)

If you prefer granular control over the installation process:
1

Clone Repository

git clone https://github.com/Rubenpro19/NutriFit.git
cd Nutrifit
2

Install PHP Dependencies

composer install
This installs Laravel 12, Livewire 3, Fortify, DomPDF, and all backend dependencies (see composer.json:11-20).
3

Configure Environment

cp .env.example .env
This creates your environment configuration file from the template.
4

Generate Application Key

php artisan key:generate
Laravel requires a unique encryption key for security.
5

Create Database

For SQLite (development):
touch database/database.sqlite
For MySQL (production), create the database manually:
mysql -u root -p -e "CREATE DATABASE nutrifit;"
6

Run Database Migrations

php artisan migrate
This creates all necessary database tables.
7

Seed Administrator Account

php artisan db:seed
Critical: This creates the administrator account needed for first login.
8

Install Node Dependencies

npm install
Installs Vite, Tailwind CSS 4, and frontend dependencies (see package.json:8-16).
9

Compile Frontend Assets

For development:
npm run dev
For production:
npm run build

Environment Configuration

Edit your .env file to customize the application:

Basic Configuration

APP_NAME="NutriFit"
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost:8000
APP_LOCALE=es
APP_FALLBACK_LOCALE=es
The application is built for Spanish-speaking markets. Change APP_LOCALE if needed.

Database Configuration

SQLite (Development - Default)

DB_CONNECTION=sqlite
SQLite requires no additional configuration and is perfect for development.

MySQL (Production)

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=nutrifit
DB_USERNAME=root
DB_PASSWORD=your_secure_password

Queue Configuration

QUEUE_CONNECTION=database
NutriFit uses database-driven queues for email notifications. The queue worker must be running to send emails.

Email Configuration

Development (Mailtrap)

For testing without sending real emails:
MAIL_MAILER=smtp
MAIL_HOST=sandbox.smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=your_mailtrap_username
MAIL_PASSWORD=your_mailtrap_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
Sign up for a free Mailtrap account to test email notifications safely.

Production (Real SMTP)

MAIL_MAILER=smtp
MAIL_HOST=smtp.your-provider.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

Admin Password Configuration

ADMIN_PASSWORD=your_custom_password
If not set, the default password is NutriAdmin123.

Running the Application

Development Mode (All Services)

The easiest way to run all required services:
composer run dev
This command starts three processes in parallel (see composer.json:55-58):

Web Server

Laravel on port 8000

Queue Worker

Processes email notifications

Vite Server

Hot module replacement for frontend

Manual Multi-Terminal Setup

If you prefer separate terminal windows for each service:
php artisan serve
Access at: http://localhost:8000

Production Mode

For production deployment:
1

Build Assets

npm run build
Compiles and optimizes frontend assets
2

Optimize Application

composer install --optimize-autoloader --no-dev
php artisan config:cache
php artisan route:cache
php artisan view:cache
3

Start Server

php artisan serve
Or configure Nginx/Apache as your web server
4

Run Queue Worker as Service

Configure Supervisor to keep queue worker running:
[program:nutrifit-worker]
command=php /path/to/nutrifit/artisan queue:work --timeout=120
autostart=true
autorestart=true
user=www-data
redirect_stderr=true
stdout_logfile=/var/log/nutrifit-worker.log

First Login

Administrator Access

After seeding the database, log in with the administrator account:

Administrator Credentials

Email: [email protected]
Password: NutriAdmin123 (or your custom ADMIN_PASSWORD from .env)
1

Navigate to Login

Open http://localhost:8000 and click “Login”
2

Enter Admin Credentials

Use the email and password shown above
3

Access Admin Dashboard

You’ll be redirected to /administrador/dashboard
4

Create Additional Users

Navigate to “Users” → “Create User” to add nutritionists and patients

Creating Test Users

From the admin dashboard, create test users for each role:
  1. Go to /administrador/users/create
  2. Fill in user details
  3. Select role: Nutricionista
  4. Set initial password
  5. User receives welcome email

Role-Based Dashboards

Each role has a dedicated dashboard:
RoleDashboard URLFeatures
Administrator/administrador/dashboardUser management, system oversight, analytics
Nutritionist/nutricionista/dashboardSchedule management, patient records, appointments
Patient/paciente/dashboardAppointment booking, history viewing, profile management

Verification & Testing

Verify Installation

1

Check Web Server

Visit http://localhost:8000 - you should see the landing page
2

Test Login

Log in with administrator credentials - should redirect to /administrador/dashboard
3

Check Queue Worker

Look for “Processing: …” messages in the queue worker terminal
4

Test Notifications

Create a test user - check Mailtrap for welcome email

Run Test Suite

NutriFit includes Pest tests (composer.json:28):
# Run all tests
composer test

# Run with coverage report
php artisan test --coverage

# Run specific test file
php artisan test --filter=UserTest

Common Issues

Problem: Can’t connect to databaseSolutions:
  • For SQLite: Ensure database/database.sqlite file exists and is writable
  • For MySQL: Verify credentials in .env and database exists
  • Run: php artisan config:clear to clear cached config
Problem: Emails not sendingSolutions:
  • Ensure queue worker is running: php artisan queue:work
  • Check QUEUE_CONNECTION=database in .env
  • View failed jobs: php artisan queue:failed
  • Retry failed jobs: php artisan queue:retry all
Problem: Styles or JavaScript not workingSolutions:
  • Ensure Vite dev server is running: npm run dev
  • For production: Run npm run build first
  • Clear browser cache
  • Check public/build directory exists and contains files
Problem: Login/register routes give 404Solutions:
  • Clear route cache: php artisan route:clear
  • Verify Fortify is installed: composer show laravel/fortify
  • Check config/fortify.php exists
  • Run: php artisan optimize:clear

Next Steps

Now that NutriFit is running:

Explore Features

Learn about all available capabilities

Configure Schedules

Set up nutritionist availability schedules

Customize Settings

Configure system settings and branding

Deploy to Production

See deployment guides for going live

Development Workflow

Daily Development

Your typical development session:
# Start all services
composer run dev

# Make changes to code
# Browser automatically reloads via Vite HMR

# Run tests before committing
composer test

# Fix code style
./vendor/bin/pint

Adding Features

1

Create Migration

php artisan make:migration create_your_table
php artisan migrate
2

Create Model

php artisan make:model YourModel
3

Create Livewire Component

php artisan make:livewire YourComponent
4

Add Routes

Edit routes/web.php to add your routes
5

Write Tests

php artisan make:test YourFeatureTest
composer test

Scheduled Tasks

NutriFit includes a command for appointment reminders:
# Send 24-hour reminders manually
php artisan appointments:send-reminders
To automate, add to crontab:
* * * * * cd /path/to/nutrifit && php artisan schedule:run >> /dev/null 2>&1
The scheduler automatically runs the reminder command daily at the configured time.

Additional Resources

Laravel Documentation

Official Laravel 12 documentation

Livewire Documentation

Learn about Livewire components

Tailwind CSS

Tailwind CSS utility reference

Fortify Documentation

Authentication features
Need Help? Check the project’s GitHub repository for issues and discussions: NutriFit on GitHub

Build docs developers (and LLMs) love