https://github.com/supravatm/laravel-v12-api-starter
Laravel 12.x dokerize Rest Api Application with Sanctum Authentication
https://github.com/supravatm/laravel-v12-api-starter
docker-compose docker-container laravel-api- laravel-api-access-token laravel-with-san laravel12-api laravel12-sanctum laravel12x postman rest-api restfull-api sanctum sanctum-authen sanctum-authentication
Last synced: about 2 months ago
JSON representation
Laravel 12.x dokerize Rest Api Application with Sanctum Authentication
- Host: GitHub
- URL: https://github.com/supravatm/laravel-v12-api-starter
- Owner: supravatm
- License: mit
- Created: 2025-08-23T07:37:42.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-09-02T14:50:55.000Z (10 months ago)
- Last Synced: 2025-09-24T11:51:18.383Z (9 months ago)
- Topics: docker-compose, docker-container, laravel-api-, laravel-api-access-token, laravel-with-san, laravel12-api, laravel12-sanctum, laravel12x, postman, rest-api, restfull-api, sanctum, sanctum-authen, sanctum-authentication
- Language: PHP
- Homepage:
- Size: 429 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Laravel 12.x Rest API Starter Kit with Docker

A Laravel & Docker Development Setup
## Features
- **Laravel 12** REST API starter, ready for develop and customization.
- **Dockerized environment**: PHP-FPM , Nginx, MySQL, phpMyAdmin, and Mailhog.
- **Easy setup** with Docker Compose.
- **Postman** API documentation link for quick reference.
## Services Overview (`docker-compose.yaml`)
| Service | Description | Ports | Healthcheck |
|--------------|-----------------------------------------------|---------------|------------------|
| **app** | PHP-FPM container for Laravel | - | Yes (depends on DB) |
| **nginx** | Web server serving the application | 80:80 | - |
| **database** | MySQL 8.0 database | 3306:3306 | Yes |
| **phpmyadmin** | Database management UI | 8888:80 | Yes (depends on DB) |
| **mailpit** | Email testing tool (SMTP + web UI) | 1025:1025, 8025:8025 | Yes |
---
## Quick Start
### 1. Clone the Repository
```sh
git clone git@github.com:supravatm/laravel-v12-api-starter.git
cd laravel-v12-api-starter
```
### 2. Install Dependencies
```sh
docker run --rm -v "$(pwd)":/app composer install
```
### 3. Configure Environment Variables
Update your `.env` file for database credential:
```env
DB_CONNECTION=mysql
DB_HOST=database
DB_PORT=3306
DB_DATABASE=database
DB_USERNAME=user
DB_PASSWORD=password
```
### 4. Start Containers
```sh
docker-compose up -d
```
> **Note:** Some containers wait for the database service to be healthy before starting.
### 5. Laravel Setup
Run the following initialization commands:
```sh
docker-compose exec app php artisan key:generate
docker-compose exec app php artisan optimize
docker-compose exec app php artisan session:table
docker-compose exec app php artisan migrate
docker-compose exec app php artisan cache:clear
```
## Accessing Services
- **App (Nginx):** [http://localhost](http://localhost)
- **phpMyAdmin:** [http://localhost:8888](http://localhost:8888)
- Use DB credentials from your `.env` file.
- **Mailpit UI:** [http://localhost:8025](http://localhost:8025)
- SMTP: `localhost:1025` (for development email delivery)
---
## Email Testing
Mailpit is use for email testing. It stores messages and provides a web interface to view sent emails.
No extra configuration needed for Laravel; just set the following in your `.env`:
```env
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
```
---
## API Testing

Complete REST API Documentation can be found here
## Troubleshooting
- Ensure Docker Desktop (or Docker Engine) is running.
- If containers fail to start, use `docker-compose logs` for details.
- Database and phpMyAdmin may take a moment to become healthy.
---
## License
[MIT](https://opensource.org/licenses/MIT)