Skip to content

Latest commit

Β 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Investron - Laravel + Livewire + Alpine.js + React/Inertia + TailwindCSS + MySQL (Dockerized)

Laravel PHP MySQL Docker React Livewire License Status

A modern investment platform demo built with Laravel 11, showcasing two distinct frontends:

  • πŸ’Ό Guest Interface: React + Inertia.js + TailwindCSS
  • 🧭 User/Admin Dashboard: Laravel Livewire + Alpine.js

Fully containerized with Docker for production-grade reliability, complete with automatic migrations, caching, and optimized builds.

🧠 Designed to demonstrate a professional, multi-stack Laravel architecture ready for portfolio or real-world deployment.


🧩 Features

βœ… Laravel 11 + PHP 8.3 (FPM)
βœ… React + Inertia.js (guest interface)
βœ… Livewire 3 + Alpine.js (admin & user dashboards)
βœ… TailwindCSS + Vite asset pipeline
βœ… MySQL 8 database container
βœ… Nginx web server optimized for Laravel βœ… adminer database GUI container for viewing application's stored data βœ… One-command build via Docker Compose


βš™οΈ Quick Start

Clone the repository

git clone https://github.com/Chukwusombiri/Investron.git cd investron


local development

cp .env.example .env 

composer install

php artisan key:generate && php artisan migrate --force

npm install && npm run dev

# open separate terminal in the same directory and start php server
php artisan serve 

Build and run with Docker

Multi-Stage Docker Build

1️⃣ Frontend Stage (Node 18) β†’ React/Vite/Tailwind build 2️⃣ Backend Stage (PHP 8.3 FPM) β†’ Laravel application 3️⃣ Webserver Stage (Nginx) β†’ Serves the application

text

Service Containers

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Nginx β”‚ β”‚ Laravel β”‚ β”‚ MySQL β”‚ β”‚ Adminer β”‚ β”‚ (Webserver)│◄──►│ (PHP-FPM) │◄──►│ (Database) │◄──►│ (DB GUI) β”‚ β”‚ :5000 β”‚ β”‚ :9000 β”‚ β”‚ :3307 β”‚ β”‚ :8080 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

text

Prerequisites

  • Docker & Docker Compose
  • git

Environment Configuration

# Copy environment file
cp .env.example .env.docker

The application will automatically generate Laravel key on first build

Build and Launch

# Build and start all services in detached mode
docker compose up -d --build
docker compose exec app php artisan migrate

Access the Application

Service URL Purpose
Main Application http://localhost:5000 Laravel application
Database Admin http://localhost:8080 Adminer (DB management)

πŸ› οΈ Development Commands

Docker Management

# Start services
docker compose up -d

# Stop services
docker compose down

# Stop and remove volumes (fresh start)
docker compose down -v

# View logs
docker compose logs -f

# Rebuild specific service
docker compose build app

Application Commands (Run inside container)

# Access app container
docker exec -it investron-app bash

# Run migrations
docker exec -it investron-app php artisan migrate

# Generate Laravel key
docker exec -it investron-app php artisan key:generate

# Install composer dependencies
docker exec -it investron-app composer install

# Run tests
docker exec -it investron-app php artisan test

πŸ—„οΈ Database Configuration

  • Connection Details

    Property Value
    Host db (container name) or 127.0.0.1
    Port 3307 (external) / 3306 (internal)
    Database investron_db
    Username investron_user
    Password secret_password
    Root Password root
  • Accessing MySQL

    # Direct access via MySQL client
    mysql -h 127.0.0.1 -P 3307 -u investron_user -p investron_db
    
    # Viewing Database Content After logging into MySQL    
    SHOW TABLES;
    SELECT * FROM users LIMIT 10;
    

    Or use Adminer web interface at http://localhost:8080

🐳 Docker Services Overview

Services Breakdown

| Service	       | Container Name	        | Ports	                   | Description                  |
| ---------------- | ---------------------- | ------------------------ | ---------------------------- |
| app	           | investron-app	        | 9000	                   | Laravel PHP-FPM application  |
| nginx	           | investron-web	        | 5000:80	               | Nginx web server             |
| db	           | investron-db	        | 3307:3306	               | MySQL 8.0 database           |
| adminer	       | investron-adminer      | 8080:8080	               | Database management GUI      |

Development Features

Hot-reload: File changes are synchronized automatically

Persistent data: MySQL data persists in Docker volume

Optimized builds: Multi-stage Dockerfile for production readiness


πŸ“ Project Structure

text investron/ β”œβ”€β”€ docker/ β”‚ └── nginx/ β”‚ └── default.conf # Nginx configuration β”œβ”€β”€ resources/ β”‚ β”œβ”€β”€ js/ # React/Inertia components β”‚ β”œβ”€β”€ views/ # Blade templates β”‚ └── css/ # Tailwind styles β”œβ”€β”€ public/ β”‚ └── build/ # Compiled assets (from Docker build) β”œβ”€β”€ Dockerfile # Multi-stage build configuration β”œβ”€β”€ compose.yaml # Docker Compose services β”œβ”€β”€ .env.docker # Docker environment variables β”œβ”€β”€ vite.config.js # Vite configuration └── tailwind.config.js # TailwindCSS configuration


πŸ”§ Configuration Files

Docker Compose Services

  • app: Laravel backend with PHP 8.3, auto-reload on file changes

  • nginx: Optimized Laravel server configuration

  • db: MySQL 8.0 with persistent volume

  • adminer: Web-based database management

Nginx Configuration

  • Optimized for Laravel applications

  • PHP-FPM integration with app container

  • Security headers enabled

  • Proper error handling and logging

πŸ›‘οΈ Security Notes

Default passwords should be changed in production

.env.docker contains development credentials

Security headers are configured in Nginx

X-Powered-By header is hidden

CSRF protection enabled via Laravel

πŸ”„ Development Workflow

Making Changes

  • Code changes are automatically synced to the container

  • Composer dependencies trigger rebuild on composer.json changes

  • Frontend assets can be rebuilt inside container or locally

Database Changes

# Create new migration
docker exec -it investron-app php artisan make:migration create_users_table

# Run migrations
docker exec -it investron-app php artisan migrate

# Rollback migrations
docker exec -it investron-app php artisan migrate:rollback

πŸ› Troubleshooting

Common Issues

  • Port already in use Change ports in compose.yaml if 5000, 3307, or 8080 are occupied

  • Docker build fails

# Clear Docker cache
docker compose build --no-cache
  • Database connection issues
# Check if MySQL container is running
docker ps | grep investron-db

# View database logs
docker logs investron-db
  • Permission issues
# Fix Laravel storage permissions
docker exec -it investron-app chown -R www-data:www-data storage bootstrap/cache

🀝 Contributing

  • Fork the repository

  • Create a feature branch: git checkout -b feature/amazing-feature

  • Commit changes: git commit -m 'Add amazing feature'

  • Push to branch: git push origin feature/amazing-feature

  • Open a Pull Request

Development Guidelines

  • Follow Laravel coding standards

  • Include tests for new features

  • Update documentation accordingly

  • Ensure Docker setup remains functional

πŸ“„ License

This project is open-sourced under the MIT License.

πŸ™ Acknowledgments

Laravel Community - For the excellent framework

Docker Team - Containerization platform

CORIENT - Platform adaptation for educational purposes

Disclaimer: This project is for educational and portfolio purposes only.

πŸ‘¨β€πŸ’» Maintainer

Bounty Tech - https://github.com/Chukwusombiri

"Code as if the next person to maintain it is a future version of you."

About

Investment services demo app

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages