-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
271 changed files
with
31,169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
APP_NAME="Recipe Box" | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_TIMEZONE=UTC | ||
APP_URL=http://localhost | ||
|
||
APP_LOCALE=en | ||
APP_FALLBACK_LOCALE=en | ||
APP_FAKER_LOCALE=en_US | ||
|
||
APP_MAINTENANCE_DRIVER=file | ||
APP_MAINTENANCE_STORE=database | ||
|
||
BCRYPT_ROUNDS=12 | ||
|
||
LOG_CHANNEL=stack | ||
LOG_STACK=single | ||
LOG_DEPRECATIONS_CHANNEL=null | ||
LOG_LEVEL=debug | ||
|
||
DB_CONNECTION=pgsql | ||
DB_HOST=pgsql | ||
DB_PORT=5432 | ||
DB_DATABASE=recipebox | ||
DB_USERNAME=root | ||
DB_PASSWORD=root | ||
|
||
SESSION_DRIVER=redis | ||
SESSION_LIFETIME=120 | ||
SESSION_ENCRYPT=false | ||
SESSION_PATH=/ | ||
SESSION_DOMAIN=null | ||
|
||
BROADCAST_CONNECTION=log | ||
FILESYSTEM_DISK=local | ||
QUEUE_CONNECTION=sync | ||
#QUEUE_DRIVER=redis | ||
#QUEUE_CONNECTION=redis | ||
|
||
CACHE_DRIVER=redis | ||
CACHE_STORE=database | ||
CACHE_PREFIX= | ||
|
||
MEMCACHED_HOST=127.0.0.1 | ||
|
||
REDIS_CLIENT=phpredis | ||
REDIS_HOST=redis | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_MAILER=smtp | ||
MAIL_HOST=mail | ||
MAIL_PORT=1025 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null | ||
MAIL_ENCRYPTION=null | ||
MAIL_FROM_ADDRESS="[email protected]" | ||
MAIL_FROM_NAME="${APP_NAME}" | ||
|
||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= | ||
AWS_DEFAULT_REGION=us-east-1 | ||
AWS_BUCKET= | ||
AWS_USE_PATH_STYLE_ENDPOINT=false | ||
|
||
VITE_APP_NAME="${APP_NAME}" | ||
SCOUT_DRIVER="database" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
* text=auto eol=lf | ||
|
||
*.blade.php diff=html | ||
*.css diff=css | ||
*.html diff=html | ||
*.md diff=markdown | ||
*.php diff=php | ||
|
||
/.github export-ignore | ||
CHANGELOG.md export-ignore | ||
.styleci.yml export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: "PHP Tests" | ||
|
||
on: | ||
push: | ||
branches: [ $default-branch ] | ||
paths: | ||
- ".github/workflows/php-push.yml" | ||
- "**/*.php" | ||
- "composer.lock" | ||
- "composer.json" | ||
pull_request: | ||
paths: | ||
- ".github/workflows/php-push.yml" | ||
- "**/*.php" | ||
- "composer.lock" | ||
- "composer.json" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-phptest: | ||
|
||
runs-on: ubuntu-22.04 | ||
|
||
services: | ||
postgres: | ||
image: postgres:16.2 | ||
env: | ||
POSTGRES_USER: 'root' | ||
POSTGRES_PASSWORD: 'root' | ||
POSTGRES_DB: 'recipebox_test' | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 5s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.2 | ||
extensions: imagick, mbstring, sqlite, pdo-sqlite, :php-psr | ||
coverage: pcov | ||
ini-values: memory_limit=-1 | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate --strict | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v4 | ||
if: ${{ !env.ACT }} | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php- | ||
- name: Install dependencies | ||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist | ||
env: | ||
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: PHP Lint | ||
run: composer run pint | ||
|
||
- uses: stefanzweifel/git-auto-commit-action@v5 | ||
if: ${{ !env.ACT }} | ||
with: | ||
commit_message: Apply pint changes | ||
|
||
- name: Set app key | ||
run: APP_ENV=testing php artisan key:generate | ||
|
||
- name: Tests | ||
run: php artisan test -p --coverage-clover=clover.xml | ||
env: | ||
DB_HOST: localhost | ||
|
||
- name: Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./clover.xml | ||
flags: unittests | ||
name: codecov-umbrella | ||
fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
.env | ||
.env.backup | ||
.phpunit.result.cache | ||
docker-compose.override.yml | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
/.idea | ||
/.vscode | ||
/public/css | ||
/public/js | ||
/public/fonts | ||
/public/mix-manifest.json | ||
/public/sw.js | ||
/storage/reports | ||
/.vagrant | ||
/docker | ||
.DS_Store | ||
.influxdb | ||
.influxmount | ||
.redis | ||
/public/vendor | ||
supervisord.* | ||
!supervisord.sh | ||
/id_rsa | ||
provision/caddy/tls/* | ||
provision/caddy/caddyfile | ||
.docker-sync | ||
mysql/logs/*.log | ||
/public/VERSION | ||
/storage/clockwork | ||
/provision/caddy/Caddyfile | ||
/public/build | ||
manifest.json | ||
.php-cs-fixer.cache | ||
cert.pem | ||
/reports | ||
/stan_tmp | ||
/docs/.vitepress/cache | ||
*.pfx | ||
/.phpunit.cache | ||
/clover.xml | ||
/draft.yaml | ||
/.blueprint | ||
/.editorconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
[![codecov](https://codecov.io/gh/IronSinew/recipebox/graph/badge.svg?token=IJC5HGMP0W)](https://codecov.io/gh/IronSinew/recipebox) | ||
# Recipebox | ||
|
||
## Overview | ||
Recipebox is a [Laravel Jetstream](https://jetstream.laravel.com)-based site using Vue and InertiaJS. It's also built with: | ||
- Docker | ||
- Caddy | ||
- PostgresSQL | ||
- Laravel Scout | ||
|
||
## Installation Prerequisites | ||
- Docker Desktop | ||
- [Bun](https://bun.sh) | ||
- **If using Windows:** | ||
- You will need to setup [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install) (Ubuntu is known to work) and configure Docker Desktop to use it as a [backend](https://docs.docker.com/desktop/windows/wsl/). | ||
- All of the following command line commands should be run inside your WSL2 / shell. | ||
|
||
## Cet the Code and Configure Git | ||
Get the code. | ||
`git clone [email protected]:IronSinew/recipebox.git` | ||
`cd recipebox` | ||
|
||
Configure Git options for the local repo. | ||
`git config core.fileMode false` | ||
`git config core.autocrlf input` | ||
`git config core.eol lf` | ||
|
||
## Installation | ||
`cp provision/caddy/Caddyfile.example provision/caddy/Caddyfile` | ||
|
||
It is highly likely that `.env` will not be present, but rather, `.env.example` instead. To fix this, run: | ||
`cp .env.example .env` | ||
|
||
`docker-compose up -d` | ||
`docker-compose exec php composer install` | ||
|
||
`docker-compose exec php php artisan key:generate` | ||
`bun install` | ||
|
||
Confirm the `recipebox` schema was created during pgsql container creation, otherwise create the schema. | ||
`docker-compose exec php php artisan migrate` | ||
|
||
If migration fails | ||
`docker-compose exec pgsql createdb -U root recipebox` | ||
|
||
Also create the testing schema | ||
`docker-compose exec pgsql createdb -U root recipebox_test` | ||
|
||
Configure folder permissions. | ||
`sudo chmod -R 777 storage/` | ||
|
||
See if it works! | ||
|
||
`bun run dev` | ||
|
||
You should now be able to view the site at <http://recipebox.localhost>. | ||
|
||
--- | ||
|
||
## Testing emails | ||
Access mailhog locally at <http://localhost:1025> | ||
|
||
## Stop Application | ||
`docker-compose down` | ||
|
||
## Start Application (after install) | ||
`docker-compose up -d` | ||
`bun run dev` | ||
- It may not be an awful idea to check migration / npm / composer deps in case other installs are needed as well. | ||
|
||
--- | ||
|
||
## Extras | ||
You may want to add these aliases to your `.bashrc` or `.bash_aliases` file for working with Docker easier. Use these commands at the root of the project. | ||
|
||
alias dockup="docker-compose up -d" | ||
alias dockdown="docker-compose down" | ||
dockin() { | ||
docker exec -it "$1" /bin/bash | ||
} | ||
|
||
### Start application: | ||
`dockup` | ||
|
||
### Stop application: | ||
`dockdown` | ||
|
||
### Access Containers Directly | ||
`dockin <container_name>` | ||
Example: | ||
`dockin recipebox-php-1` | ||
|
||
### Xdebug | ||
|
||
Xdebug is available in the PHP container but is turned off by default. To turn it on, set `XDEBUG_MODE` (`XDEBUG_MODE=develop` is Xdebug's default, other options are [documented](https://xdebug.org/docs/all_settings#mode)) in `.env` and restart PHP via docker-compose: | ||
|
||
``` | ||
docker-compose up -d php | ||
``` | ||
|
||
# Roadmap | ||
### Admin section | ||
- [ ] Label Manager | ||
- [ ] Category Manager | ||
- [ ] Recipe Manager | ||
- [ ] Image uploads | ||
### Other | ||
- [ ] Customization of intro blurb | ||
- [ ] Recent recipes component | ||
### Possible future features | ||
- [ ] "I made it" counter | ||
- [ ] Reviews/ratings | ||
- [ ] Roles for access to recipe manager as contributor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace App\Actions\Fortify; | ||
|
||
use App\Models\User; | ||
use Illuminate\Support\Facades\Hash; | ||
use Illuminate\Support\Facades\Validator; | ||
use Laravel\Fortify\Contracts\CreatesNewUsers; | ||
use Laravel\Jetstream\Jetstream; | ||
|
||
class CreateNewUser implements CreatesNewUsers | ||
{ | ||
use PasswordValidationRules; | ||
|
||
/** | ||
* Validate and create a newly registered user. | ||
* | ||
* @param array<string, string> $input | ||
*/ | ||
public function create(array $input): User | ||
{ | ||
Validator::make($input, [ | ||
'name' => ['required', 'string', 'max:255'], | ||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | ||
'password' => $this->passwordRules(), | ||
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '', | ||
])->validate(); | ||
|
||
return User::create([ | ||
'name' => $input['name'], | ||
'email' => $input['email'], | ||
'password' => Hash::make($input['password']), | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace App\Actions\Fortify; | ||
|
||
use Illuminate\Validation\Rules\Password; | ||
|
||
trait PasswordValidationRules | ||
{ | ||
/** | ||
* Get the validation rules used to validate passwords. | ||
* | ||
* @return array<int, \Illuminate\Contracts\Validation\Rule|array|string> | ||
*/ | ||
protected function passwordRules(): array | ||
{ | ||
return ['required', 'string', Password::default(), 'confirmed']; | ||
} | ||
} |
Oops, something went wrong.