Skip to content

Commit 7756a4e

Browse files
committed
feat:intial commit
0 parents  commit 7756a4e

File tree

149 files changed

+21114
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+21114
-0
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
17+
[docker-compose.yml]
18+
indent_size = 4

.env.example

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
LOG_CHANNEL=stack
8+
LOG_DEPRECATIONS_CHANNEL=null
9+
LOG_LEVEL=debug
10+
11+
DB_CONNECTION=mysql
12+
DB_HOST=127.0.0.1
13+
DB_PORT=3306
14+
DB_DATABASE=laravel
15+
DB_USERNAME=root
16+
DB_PASSWORD=
17+
18+
BROADCAST_DRIVER=log
19+
CACHE_DRIVER=file
20+
FILESYSTEM_DISK=local
21+
QUEUE_CONNECTION=sync
22+
SESSION_DRIVER=file
23+
SESSION_LIFETIME=120
24+
25+
MEMCACHED_HOST=127.0.0.1
26+
27+
REDIS_HOST=127.0.0.1
28+
REDIS_PASSWORD=null
29+
REDIS_PORT=6379
30+
31+
MAIL_MAILER=smtp
32+
MAIL_HOST=mailpit
33+
MAIL_PORT=1025
34+
MAIL_USERNAME=null
35+
MAIL_PASSWORD=null
36+
MAIL_ENCRYPTION=null
37+
MAIL_FROM_ADDRESS="[email protected]"
38+
MAIL_FROM_NAME="${APP_NAME}"
39+
40+
AWS_ACCESS_KEY_ID=
41+
AWS_SECRET_ACCESS_KEY=
42+
AWS_DEFAULT_REGION=us-east-1
43+
AWS_BUCKET=
44+
AWS_USE_PATH_STYLE_ENDPOINT=false
45+
46+
PUSHER_APP_ID=
47+
PUSHER_APP_KEY=
48+
PUSHER_APP_SECRET=
49+
PUSHER_HOST=
50+
PUSHER_PORT=443
51+
PUSHER_SCHEME=https
52+
PUSHER_APP_CLUSTER=mt1
53+
54+
VITE_APP_NAME="${APP_NAME}"
55+
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
56+
VITE_PUSHER_HOST="${PUSHER_HOST}"
57+
VITE_PUSHER_PORT="${PUSHER_PORT}"
58+
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
59+
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* text=auto eol=lf
2+
3+
*.blade.php diff=html
4+
*.css diff=css
5+
*.html diff=html
6+
*.md diff=markdown
7+
*.php diff=php
8+
9+
/.github export-ignore
10+
CHANGELOG.md export-ignore
11+
.styleci.yml export-ignore

.github/workflows/deploy.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Deploy to AWS ECS
2+
3+
on:
4+
push:
5+
branches: [main, production]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
AWS_REGION: us-east-1
11+
ECR_REPOSITORY: laravel-blog
12+
ECS_SERVICE: laravel-blog-service
13+
ECS_CLUSTER: laravel-blog-cluster
14+
ECS_TASK_DEFINITION: laravel-blog-task
15+
CONTAINER_NAME: laravel-app
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
21+
services:
22+
mysql:
23+
image: mysql:8.0
24+
env:
25+
MYSQL_ROOT_PASSWORD: password
26+
MYSQL_DATABASE: laravel_test
27+
options: >-
28+
--health-cmd="mysqladmin ping"
29+
--health-interval=10s
30+
--health-timeout=5s
31+
--health-retries=3
32+
ports:
33+
- 3306:3306
34+
35+
redis:
36+
image: redis
37+
options: >-
38+
--health-cmd "redis-cli ping"
39+
--health-interval 10s
40+
--health-timeout 5s
41+
--health-retries 5
42+
ports:
43+
- 6379:6379
44+
45+
steps:
46+
- name: Checkout code
47+
uses: actions/checkout@v4
48+
49+
- name: Setup PHP
50+
uses: shivammathur/setup-php@v2
51+
with:
52+
php-version: '8.2'
53+
extensions: mbstring, dom, fileinfo, mysql, redis
54+
55+
- name: Install dependencies
56+
run: |
57+
composer install --prefer-dist --no-progress --no-suggest
58+
npm install
59+
npm run build
60+
61+
- name: Setup environment
62+
run: |
63+
cp .env.example .env
64+
php artisan key:generate
65+
php artisan config:cache
66+
67+
- name: Run tests
68+
env:
69+
DB_CONNECTION: mysql
70+
DB_HOST: 127.0.0.1
71+
DB_PORT: 3306
72+
DB_DATABASE: laravel_test
73+
DB_USERNAME: root
74+
DB_PASSWORD: password
75+
REDIS_HOST: 127.0.0.1
76+
REDIS_PORT: 6379
77+
run: |
78+
php artisan migrate --force
79+
php artisan test
80+
81+
deploy:
82+
name: Deploy to ECS
83+
runs-on: ubuntu-latest
84+
needs: test
85+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/production'
86+
87+
steps:
88+
- name: Checkout
89+
uses: actions/checkout@v4
90+
91+
- name: Configure AWS credentials
92+
uses: aws-actions/configure-aws-credentials@v4
93+
with:
94+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
95+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
96+
aws-region: ${{ env.AWS_REGION }}
97+
98+
- name: Login to Amazon ECR
99+
id: login-ecr
100+
uses: aws-actions/amazon-ecr-login@v2
101+
102+
- name: Build, tag, and push image to Amazon ECR
103+
id: build-image
104+
env:
105+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
106+
IMAGE_TAG: ${{ github.sha }}
107+
run: |
108+
# Build Docker image for production
109+
docker build -f docker/php/Dockerfile.prod -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
110+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
111+
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
112+
113+
- name: Fill in the new image ID in the Amazon ECS task definition
114+
id: task-def
115+
uses: aws-actions/amazon-ecs-render-task-definition@v1
116+
with:
117+
task-definition: aws/task-definition.json
118+
container-name: ${{ env.CONTAINER_NAME }}
119+
image: ${{ steps.build-image.outputs.image }}
120+
121+
- name: Deploy Amazon ECS task definition
122+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
123+
with:
124+
task-definition: ${{ steps.task-def.outputs.task-definition }}
125+
service: ${{ env.ECS_SERVICE }}
126+
cluster: ${{ env.ECS_CLUSTER }}
127+
wait-for-service-stability: true

.gitignore

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/bootstrap/compiled.php
2+
/vendor
3+
/node_modules
4+
/public/storage
5+
/public/hot
6+
/public/build
7+
/storage/*.key
8+
/storage/app/*
9+
!/storage/app/.gitkeep
10+
/storage/framework/cache/*
11+
!/storage/framework/cache/.gitkeep
12+
/storage/framework/sessions/*
13+
!/storage/framework/sessions/.gitkeep
14+
/storage/framework/testing/*
15+
!/storage/framework/testing/.gitkeep
16+
/storage/framework/views/*
17+
!/storage/framework/views/.gitkeep
18+
/storage/logs/*
19+
!/storage/logs/.gitkeep
20+
21+
.env
22+
.env.backup
23+
.env.production
24+
.env.local
25+
.env.testing
26+
.phpunit.result.cache
27+
28+
Homestead.json
29+
Homestead.yaml
30+
npm-debug.log
31+
yarn-error.log
32+
33+
34+
/.idea
35+
/.vscode
36+
*~
37+
38+
.DS_Store
39+
.DS_Store?
40+
._*
41+
.Spotlight-V100
42+
.Trashes
43+
ehthumbs.db
44+
Thumbs.db
45+
46+
/public/css
47+
/public/js
48+
/public/mix-manifest.json
49+
50+
51+
*.log
52+
logs
53+
54+
55+
aws/ecs-task-policy.json
56+
aws/task-definition.json.bak
57+
aws/*.tmp
58+
aws/*.bak
59+
60+
61+
*.tmp
62+
*.temp
63+
temp/
64+
tmp/
65+
66+
67+
*.backup
68+
*.bak
69+
70+
71+
node_modules/
72+
npm-debug.log*
73+
yarn-debug.log*
74+
yarn-error.log*
75+
76+
77+
coverage/
78+
*.lcov
79+
80+
81+
.dockerignore
82+
83+
84+
.idea
85+
.vscode
86+
*.suo
87+
*.ntvs*
88+
*.njsproj
89+
*.sln
90+
*.sw?
91+
92+
composer.phar
93+
94+
.phpunit.result.cache

.styleci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
php:
2+
preset: laravel
3+
disabled:
4+
- no_unused_imports
5+
finder:
6+
not-name:
7+
- index.php
8+
js: true
9+
css: true

Architecture.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## Complete Directory Structure
2+
3+
```
4+
project-root/
5+
├── app/
6+
│ ├── Foundation/ # Shared kernel, base classes, traits
7+
│ │ ├── Entities/ # Base entities, models, value objects, shared domain logic
8+
│ │ ├── UseCases/ # Base interactors, shared application services
9+
│ │ ├── Repositories/ # Repository interfaces for shared entities
10+
│ │ ├── Adapters/ # Base presenters, view models, framework-agnostic components
11+
│ │ ├── IO/ # Shared IO components
12+
│ │ ├── Database/ # Common database concerns, repository implementations
13+
│ │ ├── Http/ # Shared controllers, middleware, API resources
14+
│ │ ├── Web/ # Common layouts, shared components, base templates
15+
│ │ ├── GraphQL/ # Shared GraphQL components
16+
│ │ └── ExternalServices/ # Shared service clients, integrations
17+
│ │ ├── FoundationServiceProvider.php # Core app-wide service provider
18+
│ │ ├── Specs/ # Foundation specifications
19+
│ │ └── Testing/ # Foundation testing support API
20+
│ │
21+
│ ├── Blog/ # Blog domain module
22+
│ │ ├── Entities/ # Domain entities, models, and business rules
23+
│ │ ├── UseCases/ # Application business logic
24+
│ │ ├── Repositories/ # Repository interfaces
25+
│ │ ├── Adapters/ # Framework-agnostic interface adapters
26+
│ │ ├── IO/ # Frameworks, drivers, external services
27+
│ │ ├── Database/ # Blog-specific database migrations, seeders, repositories
28+
│ │ ├── Http/ # Blog-specific HTTP interfaces, controllers, resources
29+
│ │ ├── Web/ # Blog-specific UI elements
30+
│ │ ├── GraphQL/ # Blog-specific GraphQL components
31+
│ │ └── ExternalServices/ # Blog-specific external services
32+
│ │ ├── BlogServiceProvider.php # Blog domain service provider
33+
│ │ ├── Specs/ # Blog behavior specifications
34+
│ │ └── Testing/ # Blog-specific testing utilities
35+
│ │
36+
│ └── User/ # User domain module (same structure)
37+
```
38+

0 commit comments

Comments
 (0)