{"id":19035568,"url":"https://github.com/training-yoyosan/example-backend","last_synced_at":"2025-10-18T18:37:31.734Z","repository":{"id":61039540,"uuid":"281706483","full_name":"training-yoyosan/example-backend","owner":"training-yoyosan","description":"Laravel 9 project to use with a Quasar app","archived":false,"fork":false,"pushed_at":"2022-10-08T13:17:04.000Z","size":1303,"stargazers_count":22,"open_issues_count":0,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-18T04:12:43.803Z","etag":null,"topics":["backend","laravel","laravel-fortify","postman","quasar-framework","sanctum","spa"],"latest_commit_sha":null,"homepage":"http://baex.mpalade.ro","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/training-yoyosan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-22T14:54:47.000Z","updated_at":"2023-10-04T08:16:34.000Z","dependencies_parsed_at":"2022-10-09T01:50:08.573Z","dependency_job_id":null,"html_url":"https://github.com/training-yoyosan/example-backend","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/training-yoyosan%2Fexample-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/training-yoyosan%2Fexample-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/training-yoyosan%2Fexample-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/training-yoyosan%2Fexample-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/training-yoyosan","download_url":"https://codeload.github.com/training-yoyosan/example-backend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250488571,"owners_count":21438809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","laravel","laravel-fortify","postman","quasar-framework","sanctum","spa"],"created_at":"2024-11-08T21:51:17.554Z","updated_at":"2025-10-18T18:37:26.698Z","avatar_url":"https://github.com/training-yoyosan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Quasar + Laravel = Love](https://baex.mpalade.ro/images/quasar_and_laravel_is_love.png)\n\n# Example Backend (example-backend)\n\nLaravel 9 skeleton API project to use with a Quasar/Nuxt.js or any other Vue related app.\nIt should also work with React related apps too.\n\nThe project uses:\n\n- Laravel Sanctum's SPA authentication\n- Laravel Fortify routes for login, registration, etc., without any views enabled.\n\n## Demo\n\nCheck out SPA live demo at http://frex.mpalade.ro. Use `admin@example.local` and password `test1234` to login.\n\nYou can access the Laravel demo at http://baex.mpalade.ro.\n\n## How to use\n\nJust clone this project into your desired new awesome project folder:\n\n```bash\ncd ~/Work\ngit clone git@github.com:training-yoyosan/example-backend.git your-next-awesome-project \n```\n\nand follow the instructions below to set it up for local or production.\n\nThen customize it to your heart's content.\n\n## Local setup\n\n### Install the dependencies\n\n```bash\ncomposer ins\nnpm install\n```\n\n### Setup `.env` file\n\n```bash\ncp .env.example .env\n##\n# adjust database settings to use sqlite or mysql\n##\nvim .env\n\n# to use sqlite, comment DB_DATABASE=laravel with a #\ntouch database/database.sqlite\n\n##\n# generate APP_KEY\n##\nphp artisan key:generate\n```\n\n### Run migrations + seeding\n\n```bash\nphp artisan migrate --seed\n```\n\n### Setup in webserver and `/etc/hosts`\n\n-   Add a VirtualHost for `example.local` in your Apache or nginx configuration.\n-   Add the mapping in `/etc/hosts` or `C:\\Windows\\System32\\drivers\\etc\\hosts`(in Windows).\n\n```\n127.0.0.1   example.local\n```\n\nAs an alternative, I've added sail to make it simpler to run the project locally.\n\nJust run:\n\n```bash\n./vendor/bin/sail up -d\n```\n\nand use `http://localhost` for your `quasar.config` proxy. \n\n### Almost there\n\nNext set up the Quasar app from [here](https://github.com/training-yoyosan/example-frontend).\n\nNow access the application at http://localhost:8080.\n\nUse `admin@example.local` and password `test1234` to login.\n\n### Debugging in Postman\n\nSince this project uses Sanctum's cookie authentication, you have to follow\n[this guide](https://blog.codecourse.com/laravel-sanctum-airlock-with-postman/) to be able to debug your API requests with Postman.\n\n## Deployment in production\n\n### Setup\n\n```bash\n# install dependencies\ncomposer ins\nyarn\n\n# setup env\ncp .env.production.sample .env.production\n##\n# Adjust the following:\n# - APP_URL\n# - SANCTUM_STATEFUL_DOMAINS\n# - SESSION_DOMAIN\n# - Database related vars\n##\nvim .env.production\nphp artisan key:generate\n\n# run migrations\nphp artisan migrate --seed\n```\n\n#### Notes\n\nThese are the values I use for my example instance so that it works with the SPA:\n\n```\nSANCTUM_STATEFUL_DOMAINS=frex.mpalade.ro\nSESSION_DOMAIN=.mpalade.ro\n```\n\n- `frex.mpalade.ro` is the subdomain of my SPA\n- I'm using ```.mpalade.ro``` for the session domain so that cookies are correctly set for all subdomains.\n- You can narrow the scope of the session domain if you have many nested domains, that is:\n    - You have the subdomain ```abc.xyz.spa.example.com```\n    - You can set the session domain to ```.spa.example.com```\n\n### Cache essentials\n\n```bash\ncomposer install --optimize-autoloader --no-dev\nphp artisan config:cache\nphp artisan route:cache\n```\n\n**Note**: You're going to use a subdomain for the backend.\n\nThat's it.\n\n## Upgrade Notes\n\n### Laravel Fortify\n\nI've recently switched to using [Laravel Fortify](https://laravel.com/docs/9.x/fortify) since it's more appropriate for the purpose of the repository.\nRun the following commands to install everything that's needed:\n\n```bash\n# for local environment\ncomposer install\nphp artisan migrate\n\n# for production environment\ncomposer install --optimize-autoloader --no-dev\nphp artisan migrate\nphp artisan config:cache\nphp artisan route:cache\n```\n\n## Resources\n\n-   https://laravel.com/docs/9.x/sanctum#spa-authentication\n-   https://laravel.com/docs/9.x/fortify\n-   https://laracasts.com/series/whats-new-in-laravel-7/episodes/6\n-   Quasar Discord #laravel channel\n-   https://blog.codecourse.com/laravel-sanctum-airlock-with-postman/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftraining-yoyosan%2Fexample-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftraining-yoyosan%2Fexample-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftraining-yoyosan%2Fexample-backend/lists"}