A full-stack web application built with Laravel as the backend API and Next.js as the frontend application.
The project follows a separated frontend/backend architecture, providing scalable API-driven communication between Laravel and Next.js.
- Laravel Backend: RESTful APIs, business logic, authentication, database management, and server-side processing.
- Next.js Frontend: Responsive UI, routing, server/client-side rendering, and API integration.
- Authentication & Authorization: Secure user authentication and role/permission-based access where applicable.
- Database Management: Laravel migrations, seeders, and Eloquent ORM.
- API Integration: Structured communication between the Next.js frontend and Laravel backend.
- Validation & Error Handling: Backend and frontend validation with standardized API responses.
- Testing: Automated backend and frontend test coverage.
- Scalable Architecture: Modular structure designed for future feature enhancements.
- PHP >= 8.2
- Laravel
- MySQL
- Composer
- Laravel Sanctum / Authentication (if applicable)
- Node.js >= 20
- Next.js
- React
- TypeScript
- npm
- Git
- GitHub
- Postman / API testing tool
- VS Code or equivalent IDE
project-root/
β
βββ backend/ # Laravel API
β βββ app/
β βββ bootstrap/
β βββ config/
β βββ database/
β βββ routes/
β βββ storage/
β βββ tests/
β βββ .env
β βββ composer.json
β
βββ frontend/ # Next.js application
β βββ app/ # or pages/
β βββ components/
β βββ public/
β βββ lib/
β βββ services/
β βββ tests/
β βββ .env.local
β βββ package.json
β
βββ README.md
βββ .gitignore
Follow the steps below to set up the project locally.
Make sure the following are installed:
- PHP >= 8.2
- Composer >= 2.x
- MySQL >= 8.x
- Node.js >= 20.x
- npm >= 10.x
- Git
Verify your installation:
php -v
composer -V
mysql --version
node -v
npm -v
git --versiongit clone <repository-url>
cd <project-name>cd backendcomposer installCopy the example environment file:
cp .env.example .envFor Windows:
copy .env.example .envUpdate the .env file with the required configuration:
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost:8000
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=root
DB_PASSWORD=php artisan key:generatephp artisan migrateIf seed data is required:
php artisan db:seedOr:
php artisan migrate --seedphp artisan storage:linkphp artisan serveThe backend will normally be available at:
http://localhost:8000
Open a new terminal.
cd frontendnpm installCreate .env.local:
NEXT_PUBLIC_API_URL=http://localhost:8000/apiAdd any additional environment variables required by the application.
npm run devThe frontend will normally be available at:
http://localhost:3000
The Next.js application communicates with Laravel through REST APIs.
Example:
Next.js
β
β HTTP Request
βΌ
Laravel API
β
βΌ
MySQL Database
Example API configuration:
NEXT_PUBLIC_API_URL=http://localhost:8000/apiExample API endpoint:
GET /api/users
POST /api/login
GET /api/products
The exact API endpoints should be documented based on the project's API specification.
cd backend
php artisan servecd frontend
npm run devFor production builds:
php artisan optimizenpm run build
npm run startcd backend
php artisan testOr:
./vendor/bin/phpunitcd frontend
npm run testIf the project uses a specific testing framework such as Jest or Playwright, use the corresponding project-defined command.
Before creating a Pull Request, ensure the code passes the project's configured linting and formatting checks.
npm run lintIf Laravel Pint is configured:
./vendor/bin/pintThe repository follows a feature-based Git workflow.
main
The main branch contains stable, production-ready code.
Create a separate branch for each feature or task:
git checkout -b feature/user-authenticationExamples:
feature/user-authentication
feature/dashboard
feature/payment-integration
fix/login-validation
fix/api-response
refactor/user-service
feature branch
β
βΌ
Development
β
βΌ
Testing
β
βΌ
Pull Request
β
βΌ
Code Review
β
βΌ
main
git add .
git commit -m "Add user authentication"git push origin feature/user-authenticationCreate a Pull Request targeting:
main
Do not commit sensitive environment variables or credentials.
The following files should generally remain outside Git:
.env
.env.local
.env.production
Never commit:
- Database passwords
- API keys
- Access tokens
- JWT secrets
- Third-party credentials
- Production credentials
Use .env.example to document required environment variables.
Before submitting a Pull Request:
- Code follows project coding standards.
- Feature/functionality has been tested locally.
- Backend API changes have been tested.
- Frontend integration has been tested.
- Database migrations are included where required.
- Environment variables are documented in
.env.example. - No sensitive credentials are committed.
- Tests are passing.
- Lint/formatting checks are passing.
- PR description clearly explains the changes.
- Create a feature/fix branch from
main.
git checkout main
git pull origin main
git checkout -b feature/your-feature-
Implement your changes.
-
Test the changes locally.
-
Commit your changes.
git add .
git commit -m "Add your change description"- Push your branch.
git push origin feature/your-feature-
Create a Pull Request targeting
main. -
Address review comments and merge after approval.
This project is licensed under the MIT License.
See the LICENSE file for details.
Project: Project Name
Repository: <GitHub Repository URL>
Maintained By: <Team / Organization Name>
For project-related issues or feature requests, create a GitHub Issue or contact the project maintainers.