https://github.com/hfagerlund/quiz_app
Quiz app with custom GraphQL API (Laravel 10 backend) and Vue3 front-end
https://github.com/hfagerlund/quiz_app
docker-compose graphql laravel laravel10x php phpunit sail tailwindcss vite vue3
Last synced: 3 months ago
JSON representation
Quiz app with custom GraphQL API (Laravel 10 backend) and Vue3 front-end
- Host: GitHub
- URL: https://github.com/hfagerlund/quiz_app
- Owner: hfagerlund
- License: bsd-3-clause
- Created: 2023-04-16T02:14:20.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-01T16:16:24.000Z (about 1 year ago)
- Last Synced: 2024-12-27T00:11:10.982Z (5 months ago)
- Topics: docker-compose, graphql, laravel, laravel10x, php, phpunit, sail, tailwindcss, vite, vue3
- Language: PHP
- Homepage:
- Size: 444 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# quiz_app
Quiz API backend using [Laravel 10], Sail (docker-compose), [GraphQL] with [Vue 3] front-end.[](https://github.com/hfagerlund/quiz_app/actions) [](https://laravel.com/) [](https://getcomposer.org/) [](https://github.com/rebing/graphql-laravel) [](https://github.com/laravel/sail) [](https://php.net/) [](https://phpunit.de/) [](https://www.mysql.com/) [](https://vitejs.dev/) [](https://vuejs.org/) [](https://tailwindcss.com/)
## What's going on here?
* [Laravel] - v10.10.0
* [PHP] - v8.2.5
* [PHPUnit] - v10.1.2* [Node] - v18.16.0
* [npm] - v9.6.4(All copyrights for the above remain with their respective owners.)
## Quick start
```console
# clone this project
$ git clone https://github.com/hfagerlund/quiz_app.git
$ cd quiz_app
$ cp .env.example .env
# ...and create .env.testing, customize .env and /config/database.php for your db$ composer install --ignore-platform-reqs
# start Sail (leave this running in its own terminal tab)
$ ./vendor/bin/sail up# in a new terminal tab:
$ ./vendor/bin/sail npm install
$ ./vendor/bin/sail artisan key:generate
$ ./vendor/bin/sail artisan migrate:fresh --seed
$ ./vendor/bin/sail npm run dev
# browse to 0.0.0.0
```### Useful Tips
```console
# stop Sail
$ ./vendor/bin/sail down# check state of services
$ docker-compose ps
```Differences between .env and .env.testing [+]
| .env | .env.testing |
| ------------- | ------------- |
| APP_ENV=local | APP_ENV=testing |
| DB_CONNECTION=mysql | DB_CONNECTION=test1 (corresponds to `` in phpunit.xml) |
| DB_DATABASE=db_for_application | DB_DATABASE=db_for_testing (corresponds to ``, `` in phpunit.xml) |## Tests
```console
# run all tests (feature, unit, database etc.)
$ ./vendor/bin/sail artisan test
# run all tests (for front-end, Vue components)
$ ./vendor/bin/sail npm run test# run a specific test
$ ./vendor/bin/sail test --testsuite Feature --filter=DatabaseTest# generate (feature) test
$ ./vendor/bin/sail php artisan make:test HTTPResponseTest# generate (unit) test
$ ./vendor/bin/sail php artisan make:test MyUnitTest --unit# output code coverage stats to terminal
$ ./vendor/bin/sail php artisan test --coverage# install Dusk (end-to-end testing, browser automation)
$ ./vendor/bin/sail composer require --dev laravel/dusk
$ ./vendor/bin/sail php artisan dusk:install
```### Good to Know (miscellaneous commands)
Auto-generate code [+] models, migrations, factories, GraphQL schema
```console
# generate model, migration
$ ./vendor/bin/sail artisan make:model -m Question# generate model, migration, factory
$ ./vendor/bin/sail artisan make:model Question -m -f# generate GraphQL type
$ ./vendor/bin/sail artisan make:graphql:type QuestionType
```Installation [+] Laravel 10, libraries
```console
# install Laravel 10 app (including Sail, MySQL, Redis, Selenium)
$ curl -s https://laravel.build/new-sail-application | bash# install library for GraphQL
$ ./vendor/bin/sail composer require rebing/graphql-laravel
## publish config file (from /vendor dir to /config/graphql.php)
$ ./vendor/bin/sail php artisan vendor:publish --provider="Rebing\GraphQL\GraphQLServiceProvider"
```Configuration [+] caching configuration, switching environments
```console
# cache configuration
$ ./vendor/bin/sail php artisan config:cache --env=testing# clear configuration cache
$ ./vendor/bin/sail php artisan config:clear
```Database [+] running migrations, seeders, db schema, db client
```console
# run migrations
$ ./vendor/bin/sail artisan migrate# drop all tables, migrate, seed db
$ ./vendor/bin/sail artisan migrate:fresh --seed# dump database schema (ie. 'squash' migrations into a single SQL file)
$ ./vendor/bin/sail php artisan schema:dump# access MySQL command-line client
$ ./vendor/bin/sail mysql
```Front-end Vue app [+] running Node, npm, Vite dev server
```console
# Node, npm versions
$ ./vendor/bin/sail node -v
$ ./vendor/bin/sail npm -v# run Vite development server (provides Hot Module Replacement for Laravel application)
$ ./vendor/bin/sail npm run dev
```## License
Copyright © 2023 Heini Fagerlund. [License] applies to all parts of quiz_app that are not externally maintained libraries, frameworks.The [Laravel] framework is open-sourced software licensed under the [MIT license].
[GraphQL]: https://github.com/rebing/graphql-laravel
[Laravel]: https://laravel.com/
[Laravel 10]: https://laravel.com/
[License]: https://github.com/hfagerlund/quiz_app/blob/main/LICENSE
[MIT license]: https://opensource.org/licenses/MIT
[Node]: https://nodejs.org/
[npm]: https://www.npmjs.com/
[PHP]: https://www.php.net/
[PHPUnit]: https://phpunit.de/
[Vue 3]: https://vuejs.org/