Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
reynoldputra committed Feb 24, 2024
0 parents commit ecb9b4f
Show file tree
Hide file tree
Showing 71 changed files with 8,865 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker
20 changes: 20 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MYSQL_DATABASE=templatedb
MYSQL_USER=user
MYSQL_ROOT_PASSWORD=password
MYSQL_PASSWORD=password
MYSQL_HOST=0.0.0.0 # change hostname to mysql if using docker compose
MYSQL_PORT=3307
DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DATABASE}

BACKEND_PORT=3000

JWT_SECRET="secretKey"
JWT_EXPIRES_IN="1h"

MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAILER_SECURE=true
MAIL_USER=
MAIL_PASS=
MAIL_FROM=setiketemail
SMTP_URL=smtp://${MAIL_USER}:${MAIL_PASS}@${MAIL_HOST}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.eslintrc.js
23 changes: 23 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
env: {
es2021: true,
node: true,
},
extends: ['eslint:recommended', 'prettier', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'simple-import-sort', 'unused-imports'],
ignorePatterns: ['**/docker/*', '**/dist/*'],
rules: {
// 'no-unused-vars': 'error',
'no-console': 'off',
'react/display-name': 'off',
'simple-import-sort/imports': 'warn',
'simple-import-sort/exports': 'warn',
'@typescript-eslint/no-unused-vars': 'error',
},
globals: {
React: true,
JSX: true,
},
root: true,
};
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Request details

Please specify the content of the request.

### Things to note:

- Please assign this issue to a member.
- Please be sure to set a due date for this request.
- Tag Person to notify in the comment section.
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''
---
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
9 changes: 9 additions & 0 deletions .github/issue-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# https://github.com/robvanderleek/create-issue-branch#option-2-configure-github-action

# ex: i4-lower_camel_upper
branchName: 'is${issue.number}-${issue.title[0,32]}'
branches:
- label: epic
skip: true
- label: debt
skip: true
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

# Screenshots

please include screenshots if you have any relevant change to the UI
14 changes: 14 additions & 0 deletions .github/workflows/issue-autolink.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Issue Autolink'
on:
pull_request:
types: [opened]

jobs:
issue-links:
runs-on: ubuntu-latest
steps:
- uses: tkt-actions/add-issue-links@v1.6.0
with:
repo-token: '${{ secrets.GH_TOKEN }}'
branch-prefix: 'is'
resolve: 'true'
75 changes: 75 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# https://github.com/kentcdodds/kentcdodds.com/blob/main/.github/workflows/deployment.yml
name: Code Check
on:
workflow_dispatch:
push:
branches:
- main
pull_request: {}

jobs:
lint:
name: ⬣ ESLint
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1

- name: ⬇️ Checkout repo
uses: actions/checkout@v2

- name: ⎔ Setup node
uses: actions/setup-node@v2
with:
node-version: 18

- name: 📥 Download deps
uses: bahmutov/npm-install@v1

- name: 🔬 Lint
run: yarn lint

prettier:
name: 💅 Prettier
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1

- name: ⬇️ Checkout repo
uses: actions/checkout@v2

- name: ⎔ Setup node
uses: actions/setup-node@v2
with:
node-version: 18

- name: 📥 Download deps
uses: bahmutov/npm-install@v1

- name: 🔎 Type check
run: yarn format

test:
name: 🤡 Jest Test
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1

- name: ⬇️ Checkout repo
uses: actions/checkout@v2

- name: ⎔ Setup node
uses: actions/setup-node@v2
with:
node-version: 18

- name: 📥 Download deps
uses: bahmutov/npm-install@v1

- name: 🧪 Jest
run: yarn test
28 changes: 28 additions & 0 deletions .github/workflows/pull-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy Backend
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
name: Deploy Backend
runs-on: ubuntu-latest
steps:
- name: Connect to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: 22
script: |
cd /var/www/backend
git stash
git pull --rebase
nest build
pm2 delete backend
pm2 start dist/main.js --name backend
pm2 save
pm2 restart backend
systemctl restart nginx
49 changes: 49 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# compiled output
/dist
/node_modules

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# yarn
.yarn/*

#docker
docker
docker/*
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# npx --no-install commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn
8 changes: 8 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged --allow-empty
yarn lint
yarn format
# yarn test --passWithNoTests
git add .
3 changes: 3 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

7 changes: 7 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"src/**":[
"yarn format",
"yarn build && rimraf dist",
"yarn lint"
]
}
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
package.json
yarn.lock
.lintstagedrc
.prettierrc
tsconfig.json
dist
./src/database/schema.prisma
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 4
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:18-alpine

WORKDIR /app

COPY . .

RUN yarn

RUN yarn build

RUN rm -rf docker

CMD [ "yarn", "start:prod" ]
Loading

0 comments on commit ecb9b4f

Please sign in to comment.