Skip to content

Commit

Permalink
chore: add template
Browse files Browse the repository at this point in the history
  • Loading branch information
eum602 committed May 1, 2023
0 parents commit 32e7cce
Show file tree
Hide file tree
Showing 92 changed files with 11,258 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Git and VSCode
.git
.gitignore
/.vscode

# Docker
Dockerfile.*
docker-compose.yml

# NPM dependencies
node_modules
npm-debug.log
package-lock.json
22 changes: 22 additions & 0 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
PORT = 3001
JWT_SECRET = some-secret-string
DOCS_ENABLED = false
TYPEORM_TYPE = postgres
TYPEORM_HOST = localhost
TYPEORM_USERNAME = postgres
TYPEORM_DATABASE = postgres
TYPEORM_PORT = 5432
TYPEORM_SYNCHRONIZE = true
TYPEORM_LOGGING = false
TYPEORM_MIGRATIONS_RUN = false

REDIS_HOST = localhost
REDIS_PORT = 6379
REDIS_PASSWORD = redis

RATE_LIMIT_WINDOW = 5
RATE_LIMIT_MAX_REQUESTS = 100

ACCESS_TOKEN_LIFE = 360000000

EMAIL_TRANSPORTER = AWS
33 changes: 33 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"env": {
"node": true,
"es6": true
},
"extends": ["prettier", "google", "plugin:@typescript-eslint/recommended"],
"plugins": ["prettier"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"indent": ["error", 2, { "SwitchCase": 1 }],
"comma-dangle": ["error", "never"],
"camelcase": ["warn", {"properties": "always"}],
"object-curly-spacing": ["error", "always"],
"curly": ["error", "all"],
"require-jsdoc": 0,
"new-cap": 0,
"arrow-parens": 0,
"operator-linebreak": 0,
"max-len": ["error", { "code": 90 }],
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-unused-vars": [2, {"args": "after-used", "argsIgnorePattern": "^_"}],
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-var-requires": 0,
"quotes": ["error", "single", { "avoidEscape": true }]
}
}
74 changes: 74 additions & 0 deletions .example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#PORT

PORT = 80 # use port 80 when running with docker
EXPOSED_CONTAINER_SERVER_PORT = 3002

#DOCS

DOCS_ENABLED = true

#TYPEORM

TYPEORM_TYPE = postgres
TYPEORM_HOST = localhost
TYPEORM_USERNAME = postgres
TYPEORM_PASSWORD = postgres
TYPEORM_DATABASE = laccpass_verification_registry
TYPEORM_PORT = 5432
TYPEORM_SYNCHRONIZE = false
TYPEORM_LOGGING = true
TYPEORM_MIGRATIONS_RUN = true
EXPOSED_CONTAINER_TYPEORM_PORT = 5434

#REDIS

REDIS_HOST = redis
REDIS_PORT = 6379
REDIS_PASSWORD = redis
EXPOSED_CONTAINER_REDIS_PORT = 6381

#TOKEN

JWT_SECRET = some-secret-string
ACCESS_TOKEN_LIFE = 360000000

#RATE LIMIT

RATE_LIMIT_WINDOW = 5
RATE_LIMIT_MAX_REQUESTS = 100

#AWS

AWS_ID=<ID>
AWS_SECRET=<SECRET>
AWS_REGION=<REGION>
AWS_S3_BUCKETNAME=api-express-test
AWS_SES_API_VERSION=<VERSION>


#SENDGRID
SENDGRID_API_USER=<USER>
SENDGRID_API_KEY=<API-KEY>

#Email
EMAIL_TRANSPORTER = AWS


# EXTERNAL SERVICES
# IS_DEPENDENT_SERVICE = true # uncomment this only if the service communicates with the other components by way of external services
IDENTITY_MANAGER_BASE_URL = http://laccpass-identity-manager/api/v1
DID_WEB_LAC = /did-web-lac
DID_WEB_LAC_CONTROLLER= /did-web-lac/controller
DID_WEB_LAC_DECODE_DID = /did-web-lac/decode

# Did Registry
CHAIN_ID = 0x9e55c
# DID_REGISTRY_ADDRESS = 0x00f23cda3cbec27ae630894dd84e88033676d136 # optional address, just in case you are willing to use another did registry
# DOMAIN_NAME = lacchain.id # optional param just in case you are willing to use another domain name

# Blockchain Connection
# for open protestnet: 'http://35.185.112.219'
# for mainnet: TBD
NODE_RPC_URL = http://35.185.112.219
#Node Address depends on the lacchain node you are connecting with
NODE_ADDRESS = 0xad730de8c4bfc3d845f7ce851bcf2ea17c049585
54 changes: 54 additions & 0 deletions .example.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#PORT

PORT = 80 # use port 80 when running with docker
EXPOSED_CONTAINER_SERVER_PORT = 3002

#DOCS

DOCS_ENABLED = true

#TYPEORM

TYPEORM_TYPE = postgres
TYPEORM_HOST = localhost
TYPEORM_USERNAME = postgres
TYPEORM_PASSWORD = postgres
TYPEORM_DATABASE = laccpass_verification_registry
TYPEORM_PORT = 5432
TYPEORM_SYNCHRONIZE = false
TYPEORM_LOGGING = true
TYPEORM_MIGRATIONS_RUN = true
EXPOSED_CONTAINER_TYPEORM_PORT = 5434

#REDIS

REDIS_HOST = redis
REDIS_PORT = 6379
REDIS_PASSWORD = redis
EXPOSED_CONTAINER_REDIS_PORT = 6381

#TOKEN

JWT_SECRET = some-secret-string
ACCESS_TOKEN_LIFE = 360000000

#RATE LIMIT

RATE_LIMIT_WINDOW = 5
RATE_LIMIT_MAX_REQUESTS = 100

#AWS

AWS_ID=<ID>
AWS_SECRET=<SECRET>
AWS_REGION=<REGION>
AWS_S3_BUCKETNAME=api-express-test
AWS_SES_API_VERSION=<VERSION>


#SENDGRID
SENDGRID_API_USER=<USER>
SENDGRID_API_KEY=<API-KEY>

#Email
EMAIL_TRANSPORTER = AWS
14 changes: 14 additions & 0 deletions .example.sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#----- Project Configuration

sonar.sources=<Src folder directory>
sonar.projectBaseDir=<project directory>
sonar.projectVersion=<project version>
sonar.javascript.lcov.reportPaths=<lcov directory usually ./coverage/lcov.info>
sonar.testExecutionReportPaths=<directory where text-report.xml is, usually __tests__/test-report.xml>
sonar.tests=<directory of test folder>
sonar.test.inclusions=<which tests should be included on the sonar analisis, usually **/*.spec.ts>
sonar.coverage.exclusions=<which coverage analisis should exclude, usually __tests__/**/*>
sonar.verbose=false
sonar.qualitygate.wait=true
sonar.scm.provider=git
sonar.java.binaries=/tmp
12 changes: 12 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence

# Change the next line to add your own reviewers
* @rootstrap/reviewers-express-api-base

# Order is important; the last matching pattern takes the most
# precedence. When someone opens a pull request that only
# modifies JS files, only @some_user and not the global
# owner(s) will be requested for a review.

# *.js @some_user
31 changes: 31 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Pull request type

<!-- Please check the type of change your PR introduces: -->

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

Issue Link: N/A

## What is the new behavior?

-

## Other information

<!-- Please add any relevant information that assists the code review. -->

N/A

## Preview

N/A
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
day: monday
time: "10:00"
timezone: America/Montevideo
open-pull-requests-limit: 10
ignore:
- dependency-name: aws-sdk
versions:
- 2.843.0
- 2.874.0
- 2.889.0
- 2.890.0
- 2.893.0
- dependency-name: "@types/node"
versions:
- 15.0.0
- dependency-name: eslint-config-prettier
versions:
- 8.0.0
15 changes: 15 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Auto merge Dependabot's PRs

on:
pull_request_target:
branches: [ master ]

jobs:
auto-merge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ahmadnassri/action-dependabot-auto-merge@v2
with:
target: minor
github-token: ${{ secrets.GH_PERMISSIONS_TOKEN }}
59 changes: 59 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Continuous Integration

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
services:
db:
image: postgres:11.6-alpine
env:
POSTGRES_PASSWORD: ${{ secrets.TEST_POSTGRES_PASSWORD }}
POSTGRES_USER: postgres
ports:
- "5432:5432"
redis:
image: redis:latest
ports:
- "6379:6379"
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Fetch unshallow
run: git fetch --unshallow
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Setup Databases
run: |
echo TYPEORM_PASSWORD=${{ secrets.TEST_POSTGRES_PASSWORD }} >> .env.ci
yarn db:setup:ci
- name: Lint
run: yarn lint
- name: Run tests
run: yarn test:ci
# Before running the scan, typescript must be installed from npm and
# NODE_PATH env var must point to tsc bin folder, otherways typescript static analysis will fail
- name: Setup sonar scanner
if: github.actor != 'dependabot[bot]'
uses: warchant/setup-sonar-scanner@v3
- name: Run Sonarqube analysis
if: github.actor != 'dependabot[bot]'
run: |
echo "NODE_PATH=$(which tsc)" >> $GITHUB_ENV
sonar-scanner -Dsonar.host.url=${{ secrets.SONAR_URL }} -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.projectKey=${{secrets.SONAR_PROJECT_KEY }} -Dsonar.nodejs.executable=$(which node) -Dsonar.projectVersion=$(echo $GITHUB_SHA | cut -c1-8)
Loading

0 comments on commit 32e7cce

Please sign in to comment.