Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinWu098 authored Nov 8, 2024
0 parents commit f6cfeb6
Show file tree
Hide file tree
Showing 70 changed files with 9,026 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# EditorConfig is awesome: https://editorconfig.org/

# top-most EditorConfig file
root = true

# Use unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.{md,json}]
insert_final_newline = false

[.*]
insert_final_newline = false
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Description

## Screenshots/Media

## Issues
Closes #

<!-- [Optional]
## Additional Notes
-->
53 changes: 53 additions & 0 deletions .github/workflows/client-dev-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# client-dev-CD.yml

name: S3 Dev Deploy
on:
push:
branches:
- dev
env:
NODE_ENV: ${{ secrets.NODE_ENV }}
VITE_FIREBASE_APIKEY: ${{ secrets.VITE_FIREBASE_APIKEY }}
VITE_FIREBASE_AUTHDOMAIN: ${{ secrets.VITE_FIREBASE_AUTHDOMAIN }}
VITE_FIREBASE_PROJECTID: ${{ secrets.VITE_FIREBASE_PROJECTID }}
VITE_FIREBASE_STORAGEBUCKET: ${{ secrets.VITE_FIREBASE_STORAGEBUCKET }}
VITE_FIREBASE_MESSAGINGSENDERID: ${{ secrets.VITE_FIREBASE_MESSAGINGSENDERID }}
VITE_FIREBASE_APPID: ${{ secrets.VITE_FIREBASE_APPID }}
VITE_BACKEND_HOST: ${{ secrets.VITE_BACKEND_HOST }}
# …and any additional environment variables

jobs:
run:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3

- name: Install dependencies
uses: borales/actions-yarn@v4
with:
cmd: install

- name: Build
uses: borales/actions-yarn@v4
with:
cmd: build

- name: Deploy
uses: reggionick/s3-deploy@v4
with:
folder: dist
bucket: ${{ secrets.S3_BUCKET }}
bucket-region: ${{ secrets.S3_BUCKET_REGION }}
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
invalidation: /
delete-removed: true
no-cache: true
private: true
files-to-include: ".*/*,*/*,**"
53 changes: 53 additions & 0 deletions .github/workflows/client-prod-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# client-dev-CD.yml

name: S3 Prod Deploy
on:
push:
branches:
- dev
env:
NODE_ENV: ${{ secrets.NODE_ENV }}
VITE_FIREBASE_APIKEY: ${{ secrets.VITE_FIREBASE_APIKEY }}
VITE_FIREBASE_AUTHDOMAIN: ${{ secrets.VITE_FIREBASE_AUTHDOMAIN }}
VITE_FIREBASE_PROJECTID: ${{ secrets.VITE_FIREBASE_PROJECTID }}
VITE_FIREBASE_STORAGEBUCKET: ${{ secrets.VITE_FIREBASE_STORAGEBUCKET }}
VITE_FIREBASE_MESSAGINGSENDERID: ${{ secrets.VITE_FIREBASE_MESSAGINGSENDERID }}
VITE_FIREBASE_APPID: ${{ secrets.VITE_FIREBASE_APPID }}
VITE_BACKEND_HOST: ${{ secrets.VITE_BACKEND_HOST }}
# …and any additional environment variables

jobs:
run:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3

- name: Install dependencies
uses: borales/actions-yarn@v4
with:
cmd: install

- name: Build
uses: borales/actions-yarn@v4
with:
cmd: build

- name: Deploy
uses: reggionick/s3-deploy@v4
with:
folder: dist
bucket: ${{ secrets.S3_BUCKET }}
bucket-region: ${{ secrets.S3_BUCKET_REGION }}
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
invalidation: /
delete-removed: true
no-cache: true
private: true
files-to-include: ".*/*,*/*,**"
31 changes: 31 additions & 0 deletions .github/workflows/run-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run Checks

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
run-checks:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "yarn"

- name: Install dependencies
run:
npm exec --workspaces -- npx rimraf node_modules && npx rimraf
node_modules && yarn install --frozen-lockfile

- name: Build React project
run: cd client && yarn run build

- name: Run linter
run: cd client && yarn run lint && cd ../ && cd server && yarn run lint
33 changes: 33 additions & 0 deletions .github/workflows/server-dev-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# server-dev-CD.yml

name: EC2 Dev Deploy

on:
push:
branches:
- dev

jobs:
Deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Deploy in EC2
env:
PRIVATE_KEY: ${{ secrets.AWS_EC2_PRIVATE_KEY }}
HOSTNAME: ${{ secrets.AWS_EC2_HOSTNAME }}
USER: ${{ secrets.AWS_EC2_USER }}

run: |
echo "$PRIVATE_KEY" > private_key.pem && chmod 600 private_key.pem
ssh -o StrictHostKeyChecking=no -i private_key.pem ${USER}@${HOSTNAME} '
#Now we have got the access of EC2 and we will start the deploy .
cd ~/npo-backend-template &&
git checkout dev &&
git stash &&
git pull origin dev &&
yarn &&
pm2 restart app.js
'
33 changes: 33 additions & 0 deletions .github/workflows/server-prod-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# server-prod-CD.yml

name: EC2 Prod Deploy

on:
push:
branches:
- dev

jobs:
Deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Deploy in EC2
env:
PRIVATE_KEY: ${{ secrets.AWS_EC2_PRIVATE_KEY }}
HOSTNAME: ${{ secrets.AWS_EC2_HOSTNAME }}
USER: ${{ secrets.AWS_EC2_USER }}

run: |
echo "$PRIVATE_KEY" > private_key.pem && chmod 600 private_key.pem
ssh -o StrictHostKeyChecking=no -i private_key.pem ${USER}@${HOSTNAME} '
#Now we have got the access of EC2 and we will start the deploy .
cd ~/npo-backend-template &&
git checkout dev &&
git stash &&
git pull origin dev &&
yarn &&
pm2 restart app.js
'
66 changes: 66 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#####################################################################################
# Generated
#####################################################################################

## Packages installed by NPM. https://docs.npmjs.com/about-packages-and-modules
node_modules/

## Vitest coverage output. https://vitest.dev/guide/coverage.html
coverage/

## ESLint cache. https://eslint.org/docs/latest/use/command-line-interface#caching
.eslintcache

## Vite build output for React.
build/

## `tsc` output, specified by tsconfig.json
dist/
dist-ssr

## CDK output.
cdk.out/

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


#####################################################################################
# Operating System
#####################################################################################

## MacOS folder settings. https://en.wikipedia.org/wiki/.DS_Store
.DS_Store

## Windows folder icon settings. https://learn.microsoft.com/en-us/windows/win32/shell/how-to-customize-folders-with-desktop-ini#use-a-desktopini-file
Desktop.ini


#####################################################################################
# Development Environment
#####################################################################################

## Private environment variables.
.env
.env.*
!.env.example

## Editor directories and files.
.vscode/*
!.vscode/extensions.json
.idea/*
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

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

npx --no -- lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/hydrogen
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist/
node_modules/
build/
public/
*.md
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--pure-lockfile true
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MIT License

Copyright (c) 2024 Commit the Change

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit f6cfeb6

Please sign in to comment.