generated from phucvinh57/fastify-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit e5b09b5
Showing
69 changed files
with
5,919 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,15 @@ | ||
{ | ||
"directory": [ | ||
"./src/handlers", | ||
"./src/constants", | ||
"./src/dtos/in", | ||
"./src/dtos/out", | ||
"./src/configs", | ||
"./src/hooks", | ||
"./src/interfaces", | ||
"./src/repositories", | ||
"./src/utils" | ||
], | ||
"exclude": ["__mock__", "__mocks__", ".spec.ts"], | ||
"delete": 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,5 @@ | ||
node_modules | ||
Dockerfile | ||
.env.local | ||
.env.development | ||
.git |
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 @@ | ||
POSTGRES_USER= | ||
POSTGRES_PASSWORD= | ||
POSTGRES_DB= | ||
POSTGRES_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}?schema=public | ||
|
||
CORS_WHITE_LIST=http://localhost:3000,http://localhost:8080 | ||
COOKIE_SECRET= | ||
JWT_SECRET= | ||
|
||
# environment variables for elasticsearch and kibana docker container | ||
ELASTIC_PASSWORD=abcdef | ||
KIBANA_PASSWORD=abcdef | ||
STACK_VERSION=8.7.0 | ||
CLUSTER_NAME=docker-cluster | ||
LICENSE=basic | ||
ES_PORT=9200 | ||
KIBANA_PORT=5601 | ||
MEM_LIMIT=2073741824 # in bytes |
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,3 @@ | ||
dist | ||
coverage | ||
node_modules |
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,23 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"extends": [ | ||
"prettier", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"plugins": ["@typescript-eslint"], | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"rules": { | ||
"@typescript-eslint/no-inferrable-types": 0, | ||
"@typescript-eslint/no-unused-vars": 2, | ||
"@typescript-eslint/no-var-requires": 0, | ||
"eqeqeq": "error" | ||
} | ||
} |
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,16 @@ | ||
# Example configuration file that: | ||
# - Ignores lodash dependency | ||
# - Disables version-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
ignore: | ||
# For Lodash, ignore all updates | ||
- dependency-name: "lodash" | ||
# Disable version updates for npm dependencies | ||
open-pull-requests-limit: 0 | ||
target-branch: master |
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,49 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: ["master"] | ||
# See docs at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-excluding-paths | ||
paths-ignore: | ||
- '.husky/**' | ||
- '**.md' | ||
- 'package.json' | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [19.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
name: Checkout repository | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | ||
|
||
- uses: actions/cache@v3 | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'yarn' | ||
|
||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Test | ||
run: yarn lint && yarn test | ||
|
||
- name: Build | ||
run: yarn build |
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,104 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
packages: write | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# Image name MUST have a pattern like <org_name_lowercase>/<repo_name_lowercase> | ||
IMAGE_NAME: phucvinh57/fastify-template | ||
# username login to ghcr MUST be organization or personal name in lower case | ||
CD_USERNAME: phucvinh57 | ||
|
||
name: Release and deploy | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
build: ${{ steps.release.outputs.release_created }} | ||
tag_name: ${{ steps.release.outputs.tag_name }} | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
release-type: node | ||
pull-request-header: "Bot (:robot:) requested to create a new release on ${{ github.ref_name }}" | ||
|
||
## Use if need to build package | ||
# build: | ||
# name: Build | ||
# needs: [release] | ||
# runs-on: ubuntu-latest | ||
# if: ${{ needs.release.outputs.build == 'true' }} | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# name: Checkout repository | ||
|
||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v2 | ||
|
||
# - name: Setup Docker buildx | ||
# uses: docker/setup-buildx-action@v2 | ||
# with: | ||
# version: v0.9.1 | ||
|
||
# - name: Log into registry ${{ env.REGISTRY }} | ||
# uses: docker/login-action@v2 | ||
# with: | ||
# registry: ${{ env.REGISTRY }} | ||
# username: ${{ env.CD_USERNAME }} | ||
# password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# - name: Build and push | ||
# uses: docker/build-push-action@v3 | ||
# with: | ||
# context: . | ||
# push: true | ||
# tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.release.outputs.tag_name }} | ||
|
||
## Use if need to deploy on a server | ||
# deploy: | ||
# name: Deploy | ||
# runs-on: ubuntu-latest | ||
# needs: [build] | ||
# env: | ||
# POSTGRES_URL: postgresql://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@postgres:5432/${{ secrets.POSTGRES_DB }}?schema=public | ||
# steps: | ||
# - name: Deploy | ||
# uses: appleboy/ssh-action@master | ||
# with: | ||
# host: ${{ secrets.VPS_HOST }} | ||
# port: ${{ secrets.VPS_PORT }} | ||
# username: ${{ secrets.VPS_USERNAME }} | ||
# password: ${{ secrets.VPS_PASSWORD }} | ||
|
||
# # TODO: Remove docker volumes in Dev stage only | ||
# script: | | ||
# export CR_PAT=${{ secrets.GITHUB_TOKEN }} | ||
# echo $CR_PAT | docker login ${{ env.REGISTRY }} -u ${{ env.CD_USERNAME }} --password-stdin | ||
# docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} | ||
|
||
# cd $HOME/thesis-222 | ||
# rm -f .env | ||
# echo POSTGRES_USER=${{ secrets.POSTGRES_USER }} >> .env | ||
# echo POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} >> .env | ||
# echo POSTGRES_DB=${{ secrets.POSTGRES_DB }} >> .env | ||
# echo POSTGRES_URL=${{ env.POSTGRES_URL }} >> .env | ||
# echo COOKIE_SECRET=${{ secrets.COOKIE_SECRET }} >> .env | ||
# echo JWT_SECRET=${{ secrets.JWT_SECRET }} >> .env | ||
# echo CORS_WHITE_LIST=${{ vars.CORS_WHITE_LIST }} >> .env | ||
|
||
# # curl https://raw.githubusercontent.com/phucvinh57/fastify-template/master/docker-compose.yml -o docker-compose.yml | ||
# docker-compose stop fastify | ||
# docker-compose rm -f fastify | ||
# docker-compose up -d fastify | ||
|
||
# docker logout ${{ env.REGISTRY }} | ||
|
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,60 @@ | ||
### Node template | ||
.DS_Store | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git | ||
node_modules | ||
.npmrc | ||
*.log | ||
|
||
# Typings | ||
typings/ | ||
|
||
# Typescript | ||
src/**/*.js | ||
src/**/*.js.map | ||
test/**/*.js | ||
test/**/*.js.map | ||
|
||
# Test | ||
/.tmp | ||
/.nyc_output | ||
|
||
# IDE | ||
.vscode | ||
.idea | ||
|
||
# Project | ||
/public | ||
/dist | ||
|
||
# env | ||
.env* | ||
!.env.example | ||
|
||
# certs | ||
*.crt |
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 @@ | ||
_ |
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,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
git update-index --again |
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,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged $1 |
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,4 @@ | ||
{ | ||
"**/*.{ts,js}": ["eslint --fix"], | ||
"**/*.{ts,js,json}": ["prettier --write"] | ||
} |
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,10 @@ | ||
dist | ||
docs | ||
node_modules | ||
*-lock.json | ||
*.lock | ||
*.yaml | ||
*.yml | ||
*.json | ||
*.md | ||
coverage |
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,10 @@ | ||
{ | ||
"printWidth": 140, | ||
"singleQuote": true, | ||
"jsxSingleQuote": true, | ||
"semi": true, | ||
"tabWidth": 4, | ||
"bracketSpacing": true, | ||
"arrowParens": "always", | ||
"trailingComma": "none" | ||
} |
Oops, something went wrong.