91 |
|
158 |
{{ doc.title }}
29 |30 | by {{ doc.author }}, {{ doc.date }} 31 |
32 |├── .env.prod ├── .github └── workflows │ └── release.yml ├── .gitignore ├── avantage ├── .example.env ├── .gitignore ├── Changelog.md ├── README.md ├── app.vue ├── assets │ └── css │ │ └── tailwind.css ├── components │ ├── User.vue │ ├── content │ │ ├── Alert.vue │ │ ├── BaseCard.vue │ │ ├── ContentHeader.vue │ │ ├── Hero.vue │ │ ├── ProseCode.vue │ │ └── TitleCard.vue │ ├── elements │ │ ├── Logos │ │ │ ├── FlameLogo.vue │ │ │ └── colorMode.vue │ │ ├── TestingPhaseDialog.vue │ │ ├── TheBillboard.vue │ │ └── TheFeatureMapGrid.vue │ └── layout │ │ ├── TheFooter.vue │ │ ├── TheMobileNav.vue │ │ └── TheNavBar.vue ├── composables │ ├── getParam.ts │ ├── useAuth.ts │ ├── useErrorMapper.ts │ ├── useOtp.ts │ ├── useSpark.ts │ └── useVisitCounter.ts ├── config │ └── fullstackjack.service ├── content │ ├── articles │ │ ├── deploy-nuxt3-github-actions.md │ │ └── state-in-nuxt3.md │ ├── index.md │ └── nuxt3-data-fetching.md ├── docker-compose.yml ├── hello.js ├── layouts │ ├── MobileOnly.vue │ └── default.vue ├── middleware │ ├── auth.ts │ └── guest.ts ├── nuxt.config.ts ├── package.json ├── pages │ ├── articles │ │ ├── [...slug].vue │ │ └── overview.vue │ ├── dashboard.vue │ ├── index.vue │ ├── info.vue │ ├── login.vue │ ├── register.vue │ ├── subscribe │ │ ├── index.vue │ │ └── success.vue │ └── verify.vue ├── public │ └── img │ │ ├── avantage-clear.svg │ │ ├── color-mode.svg │ │ ├── color-mode.webp │ │ └── logo-shadow.svg ├── server │ ├── api │ │ ├── auth │ │ │ ├── getByAuthToken.ts │ │ │ ├── login.ts │ │ │ ├── logout.ts │ │ │ ├── register.ts │ │ │ ├── update.ts │ │ │ └── verifyOtp.ts │ │ ├── counter.ts │ │ ├── stripe │ │ │ ├── createPortalSession.ts │ │ │ └── webhooks.post.ts │ │ └── subscribe.post.ts │ ├── app │ │ ├── email │ │ │ ├── emailSender.ts │ │ │ ├── templates │ │ │ │ └── verifyEmailTemplate.ts │ │ │ ├── types │ │ │ │ └── emailTypes.ts │ │ │ └── verifyEmail.ts │ │ ├── errors │ │ │ ├── errorMapper.ts │ │ │ └── responses │ │ │ │ ├── DefaultErrorsResponse.ts │ │ │ │ └── ZodErrorsResponse.ts │ │ ├── formRequests │ │ │ ├── LoginRequest.ts │ │ │ ├── RegisterRequest.ts │ │ │ ├── UpdateUserRequest.ts │ │ │ └── VerifyOtpRequest.ts │ │ └── services │ │ │ ├── otp.ts │ │ │ ├── sessionService.ts │ │ │ ├── stripeService.ts │ │ │ ├── userService.ts │ │ │ └── validator.ts │ ├── database │ │ ├── client.ts │ │ ├── dev.db │ │ ├── migrations │ │ │ ├── 20220928204235_init │ │ │ │ └── migration.sql │ │ │ ├── 20220929201021_add_test_table │ │ │ │ └── migration.sql │ │ │ ├── 20220930194208_add_test_another_migration │ │ │ │ └── migration.sql │ │ │ ├── 20221104204024_add_test_another_migration │ │ │ │ └── migration.sql │ │ │ ├── 20221215190709_dev │ │ │ │ └── migration.sql │ │ │ ├── 20221226101719_dev │ │ │ │ └── migration.sql │ │ │ └── migration_lock.toml │ │ ├── repositories │ │ │ ├── askJackRespository.ts │ │ │ ├── sessionRepository.ts │ │ │ ├── userRespository.ts │ │ │ └── videoRepository.ts │ │ └── schema.prisma │ └── middleware │ │ └── serverAuth.ts ├── tailwind.config.js ├── tests │ ├── feature │ │ └── register.test.ts │ └── unit │ │ └── register_validation.test.ts ├── tsconfig.json ├── types │ ├── FormValidation.ts │ ├── IAnswer.ts │ ├── IAnswerPost.ts │ ├── ICategory.ts │ ├── ILogin.ts │ ├── IQuestion.ts │ ├── IQuestionPost.ts │ ├── IRegistration.ts │ ├── ISession.ts │ ├── ISubscription.ts │ ├── ITag.ts │ ├── IUser.ts │ ├── InputValidation.ts │ ├── SubPostRes.ts │ ├── TopicData.ts │ └── theme.ts ├── vitest.config.js └── yarn.lock ├── bin ├── npm ├── npx └── prisma ├── config ├── avantage │ └── Dockerfile ├── deployment │ ├── fullstackjack.service │ ├── pre-release-int-config.json │ └── release-prod-config.json ├── nginx │ ├── auth │ │ └── .htpasswd │ ├── fastcgi_params │ ├── includes │ │ └── cors.conf │ ├── nginx.conf │ ├── sites-dev │ │ └── avantage.conf │ └── sites-prod │ │ └── fullstackjack.conf └── ssl │ └── avantage.dev │ ├── create-certificate.sh │ ├── fullchain.pem │ ├── openssl.cnf │ └── privkey.pem ├── docker-compose.dev.yml ├── docker-compose.prod.yml └── docker-compose.yml /.env.prod: -------------------------------------------------------------------------------- 1 | COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml 2 | 3 | COMPOSE_PROJECT_NAME=avantage 4 | 5 | DB_NAME=avantage 6 | DB_USERNAME=jack 7 | DB_PASSWORD=password 8 | DB_ROOT_PASSWORD=password 9 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Deploy release candidate to int 2 | 3 | on: 4 | push: 5 | tags: 6 | - rc* 7 | 8 | jobs: 9 | test-application: 10 | runs-on: ubuntu-latest 11 | strategy: 12 | matrix: 13 | node-version: [ 16.14.2 ] 14 | env: 15 | working-directory: ./nuxt-app 16 | steps: 17 | - uses: actions/checkout@v3 18 | - name: Use Node.js ${{ matrix.node-version }} 19 | uses: actions/setup-node@v3 20 | with: 21 | node-version: ${{ matrix.node-version }} 22 | cache: 'npm' 23 | cache-dependency-path: ./nuxt-app/package-lock.json 24 | - run: npm ci 25 | working-directory: ${{env.working-directory}} 26 | - run: npm run build 27 | working-directory: ${{env.working-directory}} 28 | - run: npm test 29 | working-directory: ${{env.working-directory}} 30 | 31 | create-deployment-artifacts: 32 | needs: test-application 33 | name: Create Deployment Artefacts 34 | runs-on: ubuntu-latest 35 | strategy: 36 | matrix: 37 | node-version: [ 16.14.2 ] 38 | env: 39 | working-directory: ./nuxt-app 40 | outputs: 41 | deployment-matrix: ${{ steps.export-deployment-matrix.outputs.deployment-matrix }} 42 | steps: 43 | - uses: actions/checkout@v3 44 | - name: Use Node.js ${{ matrix.node-version }} 45 | uses: actions/setup-node@v3 46 | with: 47 | node-version: ${{ matrix.node-version }} 48 | cache: 'npm' 49 | cache-dependency-path: ./nuxt-app/package-lock.json 50 | - run: npm ci 51 | working-directory: ${{env.working-directory}} 52 | - run: npm run build 53 | working-directory: ${{env.working-directory}} 54 | - run: npm test 55 | working-directory: ${{env.working-directory}} 56 | - name: Create deployment artifact 57 | env: 58 | GITHUB_SHA: ${{ github.sha }} 59 | run: tar -czf "${GITHUB_SHA}".tar.gz --exclude=node_modules --exclude=tests * .??* 60 | 61 | - name: Store artifact for distribution 62 | uses: actions/upload-artifact@v2 63 | with: 64 | name: app-build 65 | path: ${{ github.sha }}.tar.gz 66 | 67 | - name: Export deployment matrix 68 | id: export-deployment-matrix 69 | run: | 70 | JSON="$(cat ./config/deployment/pre-release-int-config.json)" 71 | JSON="${JSON//'%'/'%25'}" 72 | JSON="${JSON//$'\n'/'%0A'}" 73 | JSON="${JSON//$'\r'/'%0D'}" 74 | echo "::set-output name=deployment-matrix::$JSON" 75 | 76 | prepare-release-on-servers: 77 | needs: create-deployment-artifacts 78 | name: "${{ matrix.server.name }}: Prepare release" 79 | runs-on: ubuntu-latest 80 | strategy: 81 | matrix: 82 | server: ${{ fromJson(needs.create-deployment-artifacts.outputs.deployment-matrix) }} 83 | steps: 84 | - uses: actions/download-artifact@v2 85 | with: 86 | name: app-build 87 | - name: Upload 88 | uses: appleboy/scp-action@master 89 | with: 90 | host: ${{ matrix.server.ip }} 91 | port: ${{ matrix.server.port }} 92 | username: ${{ matrix.server.username }} 93 | key: ${{ secrets.SSH_KEY_INT }} 94 | source: ${{ github.sha }}.tar.gz 95 | target: ${{ matrix.server.path }}/artifacts 96 | 97 | - name: Extract archive and create directories 98 | uses: appleboy/ssh-action@master 99 | env: 100 | GITHUB_SHA: ${{ github.sha }} 101 | with: 102 | host: ${{ matrix.server.ip }} 103 | username: ${{ matrix.server.username }} 104 | key: ${{ secrets.SSH_KEY_INT }} 105 | port: ${{ matrix.server.port }} 106 | envs: GITHUB_SHA 107 | script: | 108 | mkdir -p "${{ matrix.server.path }}/releases/${GITHUB_SHA}" 109 | tar xzf ${{ matrix.server.path }}/artifacts/${GITHUB_SHA}.tar.gz -C "${{ matrix.server.path }}/releases/${GITHUB_SHA}" 110 | rm -rf ${{ matrix.server.path }}/releases/${GITHUB_SHA}/storage 111 | 112 | run-before-hooks: 113 | name: "${{ matrix.server.name }}: Before hook" 114 | runs-on: ubuntu-latest 115 | needs: [ create-deployment-artifacts, prepare-release-on-servers ] 116 | strategy: 117 | matrix: 118 | server: ${{ fromJson(needs.create-deployment-artifacts.outputs.deployment-matrix) }} 119 | steps: 120 | - name: Run before hooks 121 | uses: appleboy/ssh-action@master 122 | env: 123 | GITHUB_SHA: ${{ github.sha }} 124 | RELEASE_PATH: ${{ matrix.server.path }}/releases/${{ github.sha }} 125 | ACTIVE_RELEASE_PATH: ${{ matrix.server.path }}/current 126 | STORAGE_PATH: ${{ matrix.server.path }}/storage 127 | BASE_PATH: ${{ matrix.server.path }} 128 | with: 129 | host: ${{ matrix.server.ip }} 130 | username: ${{ matrix.server.username }} 131 | key: ${{ secrets.SSH_KEY_INT }} 132 | port: ${{ matrix.server.port }} 133 | envs: GITHUB_SHA,RELEASE_PATH,ACTIVE_RELEASE_PATH,STORAGE_PATH,BASE_PATH 134 | script: | 135 | ${{ matrix.server.beforeHooks }} 136 | 137 | 138 | activate-release: 139 | name: "${{ matrix.server.name }}: Activate release" 140 | runs-on: ubuntu-latest 141 | needs: [ create-deployment-artifacts, prepare-release-on-servers, run-before-hooks ] 142 | strategy: 143 | matrix: 144 | server: ${{ fromJson(needs.create-deployment-artifacts.outputs.deployment-matrix) }} 145 | steps: 146 | - name: Activate release 147 | uses: appleboy/ssh-action@master 148 | env: 149 | GITHUB_SHA: ${{ github.sha }} 150 | GITHUB_REF: ${{ github.ref }} 151 | RELEASE_PATH: ${{ matrix.server.path }}/releases/${{ github.sha }} 152 | ACTIVE_RELEASE_PATH: ${{ matrix.server.path }}/current 153 | STORAGE_PATH: ${{ matrix.server.path }}/storage 154 | BASE_PATH: ${{ matrix.server.path }} 155 | PLATFORM_PROD_ENV: ${{ secrets.PLATFORM_PROD_ENV }} 156 | ROOT_PROD_ENV: ${{ secrets.ROOT_PROD_ENV }} 157 | with: 158 | host: ${{ matrix.server.ip }} 159 | username: ${{ matrix.server.username }} 160 | key: ${{ secrets.SSH_KEY_INT }} 161 | port: ${{ matrix.server.port }} 162 | envs: GITHUB_SHA,RELEASE_PATH,ACTIVE_RELEASE_PATH,STORAGE_PATH,BASE_PATH,ENV_PATH,PLATFORM_PROD_ENV,ROOT_PROD_ENV,GITHUB_REF 163 | script: | 164 | cp "${RELEASE_PATH}/apps/nuxt-app/.env.prod" "${RELEASE_PATH}/apps/nuxt-app/.env" 165 | echo "RELEASE_VERSION=${GITHUB_REF}" >> "${RELEASE_PATH}/apps/nuxt-app/.env" 166 | cp "${RELEASE_PATH}/.env.prod" "${RELEASE_PATH}/.env" 167 | ln -s -n -f $RELEASE_PATH $ACTIVE_RELEASE_PATH 168 | systemctl restart fullstackjack 169 | chown -R www-data:www-data ${RELEASE_PATH} 170 | 171 | clean-up: 172 | name: "${{ matrix.server.name }}: Clean up" 173 | runs-on: ubuntu-latest 174 | needs: [ create-deployment-artifacts, prepare-release-on-servers, run-before-hooks, activate-release ] 175 | strategy: 176 | matrix: 177 | server: ${{ fromJson(needs.create-deployment-artifacts.outputs.deployment-matrix) }} 178 | steps: 179 | - name: Run after hooks 180 | uses: appleboy/ssh-action@master 181 | env: 182 | RELEASES_PATH: ${{ matrix.server.path }}/releases 183 | ARTIFACTS_PATH: ${{ matrix.server.path }}/artifacts 184 | with: 185 | host: ${{ matrix.server.ip }} 186 | username: ${{ matrix.server.username }} 187 | key: ${{ secrets.SSH_KEY_INT }} 188 | port: ${{ matrix.server.port }} 189 | envs: RELEASES_PATH 190 | script: | 191 | cd $RELEASES_PATH && ls -t -1 | tail -n +4 | xargs rm -rf 192 | cd $ARTIFACTS_PATH && echo "now cleaning . . . ." && pwd && ls && echo "fies to clean . . . ." && ls -t -1 && ls -t -1 | tail -n +4 | xargs rm -rf 193 | # delete-artifact 194 | - uses: geekyeggo/delete-artifact@v1 195 | with: 196 | name: create-deployment-artifacts 197 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | .idea 3 | .vscode/ 4 | apps/nuxt-app/.env 5 | apps/nuxt-app/.env 6 | -------------------------------------------------------------------------------- /avantage/.example.env: -------------------------------------------------------------------------------- 1 | 2 | DATABASE_URL=mysql://root:pw@localhost:3306/unavance 3 | DATABASE_ROOT_PASSWORD=pw 4 | DATABASE_NAME=unavance 5 | DATABASE_USER=unavance 6 | DATABASE_PASSWORD=unavance 7 | 8 | NUXT_MAILER_DRIVER=smtp 9 | NUXT_MAILER_HOST=mailhog 10 | NUXT_MAILER_PORT=1025 11 | NUXT_MAILER_USER=null 12 | NUXT_MAILER_PASS=null 13 | NUXT_MAILER_ENCRYPTION=null 14 | NUXT_MAILER_FROM_ADDRESS="noreply@example.dev" 15 | NUXT_MAILER_FROM_NAME="Fake Company" 16 | NUXT_MAILER_TO_ADDRESS="info@example.dev" 17 | NUXT_MAILER_TO_NAME="Fake Recipient" 18 | 19 | APP_DOMAIN=http://localhost 20 | 21 | EMAIL=info@unavance.dev 22 | 23 | STRIPE_SECRET_KEY=sk_test_unavanceunavanceunavanceunavanceunavanceunavanceunavanceunavanceunavance 24 | 25 | NUXT_PUBLIC_SOMETHING_ELSE='i was set in .example.env' -------------------------------------------------------------------------------- /avantage/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log* 3 | .nuxt 4 | .nitro 5 | .cache 6 | .output 7 | .env 8 | .env.production 9 | dist 10 | .idea 11 | .vscode 12 | -------------------------------------------------------------------------------- /avantage/Changelog.md: -------------------------------------------------------------------------------- 1 | Release 0.5.0 2 | - added nuxt-mailer 3 | - added otp to registration process 4 | - code quality refactors -------------------------------------------------------------------------------- /avantage/README.md: -------------------------------------------------------------------------------- 1 |  2 | 3 | avantage seeks to accelerate building fullstack node applications with Nuxt 3. 4 | 5 | Features: 6 | - Auth (Can now send OTP via nuxt-mailer) 7 | - Tailwind CSS 8 | - Stripe Checkout Integration 9 | - Prisma Js (database ORM) 10 | - Nuxt-Mailer (node mailer integration) 11 | - what feature do you think belong? open a discussion 12 | 13 | Look at the [nuxt 3 documentation](https://v3.nuxtjs.org) to learn more. 14 | 15 | ## Demo App 16 | Check out [avantage.fullStackJack.dev](https://avantage.fullstackjack.dev) to see this code live in action. 17 | 18 | ## Setup 19 | 20 | Make sure to install the dependencies: 21 | 22 | ```bash 23 | # yarn 24 | yarn install 25 | 26 | # npm 27 | npm install 28 | 29 | # pnpm 30 | pnpm install --shamefully-hoist 31 | ``` 32 | 33 | ## Development Server 34 | 35 | Start the development server on http://localhost:3000 36 | 37 | ```bash 38 | npm run dev 39 | ``` 40 | 41 | ## Production 42 | 43 | Build the application for production: 44 | 45 | ```bash 46 | npm run build 47 | ``` 48 | 49 | Locally preview production build: 50 | 51 | ```bash 52 | npm run preview 53 | ``` 54 | 55 | Checkout the [deployment documentation](https://v3.nuxtjs.org/guide/deploy/presets) for more information. 56 | 57 | 58 | ## Hi there, Full Stack Jack here 59 | I'm glad you found this awesome repo. 60 | 61 | If you'd like a walk through of how nuxt3 and in particular this set up 62 | works, 63 | 64 | check out the Full Stack Jack Youtube Channel here :point_right:  65 | FullStackJack Youtube Channel. 66 | 67 | ## Connect with me 68 | 69 | 70 | 71 |
82 | -------------------------------------------------------------------------------- /avantage/app.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 |25 | The subscriptions are in TEST MODE 26 |
27 |28 | Feel free to play around with it. 29 |
30 |31 | Any subscriptions you create will be fake. 32 |
33 |34 | Test Card Number: 4242 4242 4242 4242 35 |
36 |YouTube Channel
29 |Tailwind
48 |Prisma Js
68 |95 | Auth
96 |Vitest
135 |152 | Color Mode
153 |30 | by {{ doc.author }}, {{ doc.date }} 31 |
32 |37 | {{ article.description }} 38 |
39 |28 | Current Application
29 |30 | For more information see the github respository 31 |
32 |Release Version
44 |Git Hash 63 |
64 |build something awesome.
94 |
91 |
|
158 |