Skip to main content
This guide walks you through each installation step individually, giving you complete control over the setup process.
Use this method if you need to customize specific steps or prefer understanding what each command does.

Prerequisites

Ensure all system requirements are met before proceeding.

Installation Process

1

Clone the Repository

Download the NutriFit source code:
git clone https://github.com/Rubenpro19/NutriFit.git
cd NutriFit
Verify you’re in the correct directory:
pwd  # Should end with /NutriFit
ls   # Should show composer.json, package.json, etc.
2

Install PHP Dependencies

Install all backend dependencies using Composer:
composer install
This installs:
  • Laravel 12 framework
  • Livewire 3 and Flux UI components
  • Laravel Fortify (authentication)
  • DomPDF (PDF generation)
  • All required PHP packages
The installation may take 1-3 minutes. Composer will download packages from Packagist and configure autoloading.

Development vs Production

For production environments, use:
composer install --optimize-autoloader --no-dev
This excludes development dependencies like Pest (testing) and Laravel Pint (code styling).
3

Create Environment File

Copy the example environment file:
cp .env.example .env
This creates your local configuration file. The .env file contains sensitive settings and is not tracked by Git.
Never commit the .env file to version control. It contains secrets and environment-specific configuration.
4

Generate Application Key

Create a unique encryption key for your application:
php artisan key:generate
This generates a random APP_KEY in your .env file, used for:
  • Encrypting session data
  • Hashing passwords
  • Securing cookies
  • Signing URLs
Example output:
Application key set successfully.
5

Create Database

For SQLite (Default)

Create an empty SQLite database file:
touch database/database.sqlite
Verify the file was created:
ls -lh database/database.sqlite
Your .env should have:
DB_CONNECTION=sqlite

For MySQL

If using MySQL instead, create a database:
CREATE DATABASE nutrifit CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Update your .env:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=nutrifit
DB_USERNAME=root
DB_PASSWORD=your_password
6

Run Database Migrations

Create all database tables by running migrations:
php artisan migrate
This creates tables for:
  • Users and authentication
  • Appointments and scheduling
  • Medical records (attentions)
  • Personal data and profiles
  • Notifications and jobs queue
Example output:
Migrating: 2024_01_01_000000_create_users_table
Migrated:  2024_01_01_000000_create_users_table (15.32ms)
...
You’ll be asked to confirm in production environments. Use --force flag to skip confirmation.
7

Seed the Database

Populate the database with initial data:
php artisan db:seed
This creates:
  • Admin user with default credentials
  • Default roles and permissions
  • System configuration
The seeder is required. Without it, you won’t be able to log in to the system.

Default Admin Account

Email: [email protected]
Password: NutriAdmin123
You can customize the admin password by setting ADMIN_PASSWORD in your .env file before seeding.
8

Install Node.js Dependencies

Install frontend build tools and dependencies:
npm install
This installs:
  • Vite 7 - Build tool with hot module replacement
  • Tailwind CSS 4 - Utility-first CSS framework
  • Axios - HTTP client for API requests
  • Concurrently - Run multiple commands in parallel
Alternative package managers:
# Using Yarn
yarn install

# Using pnpm
pnpm install
9

Compile Frontend Assets

Build CSS and JavaScript files:

For Production

npm run build
This creates optimized, minified assets in public/build/.

For Development

npm run dev
This starts Vite’s development server with:
  • Hot module replacement (HMR)
  • Instant CSS updates
  • Source maps for debugging
  • Auto-reload on file changes
Keep npm run dev running in a separate terminal during development for the best experience.
10

Set Permissions (Linux/macOS)

Ensure Laravel can write to required directories:
chmod -R 775 storage
chmod -R 775 bootstrap/cache
If using a web server (Apache/Nginx), set ownership:
sudo chown -R www-data:www-data storage bootstrap/cache
Never set permissions to 777 in production. This is a security risk.
11

Start Development Servers

You have two options for running the application:Run all services in parallel:
composer run dev
This starts:
  • Laravel development server (port 8000)
  • Queue worker for background jobs
  • Vite dev server for assets

Option 2: Manual (Multiple Terminals)

Terminal 1: Web Server

php artisan serve

Terminal 2: Queue Worker

php artisan queue:work

Terminal 3: Vite Dev Server

npm run dev
The queue worker is essential for sending email notifications. Don’t skip this step.
12

Verify Installation

Check that everything is working:

1. Access the Application

Open your browser to:
http://localhost:8000

2. Check Database Connection

php artisan migrate:status
All migrations should show “Ran”.

3. Test Queue System

php artisan queue:failed
Should return “No failed jobs”.

4. Verify Assets

ls -la public/build/
Should contain manifest.json and asset files.

Post-Installation Tasks

Configure Email Service

For email notifications to work, configure mail settings in .env:
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="NutriFit"
See Configuration for details.

Set Up Scheduled Tasks (Optional)

For automatic appointment reminders, add to crontab:
* * * * * cd /path/to/nutrifit && php artisan schedule:run >> /dev/null 2>&1
This runs Laravel’s task scheduler every minute, which handles:
  • Sending appointment reminders 24 hours in advance
  • Cleaning up old notifications
  • Database maintenance tasks

Optimize for Development

Clear all cached configuration:
php artisan optimize:clear
This clears:
  • Configuration cache
  • Route cache
  • View cache
  • Application cache
Run this command after changing .env or config files to ensure changes take effect.

Troubleshooting

”Please provide a valid app key”

Run:
php artisan key:generate

“SQLSTATE[HY000]: General error: 1 no such table”

Run migrations:
php artisan migrate:fresh
php artisan db:seed

“Mix manifest does not exist”

Compile assets:
npm run build

“Class not found”

Regenerate autoload files:
composer dump-autoload

Permission Denied Errors

Fix storage permissions:
chmod -R 775 storage bootstrap/cache

Next Steps

Configuration

Customize environment settings, database, mail, and queue configuration

Getting Started

Learn about NutriFit’s features and start using the platform

Build docs developers (and LLMs) love