-
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 fe1aef9
Showing
139 changed files
with
23,013 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,54 @@ | ||
name: "Code scanning" | ||
|
||
on: | ||
push: | ||
branches: ${{ github.ref }} | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: ${{ github.ref }} | ||
schedule: | ||
- cron: '0 13 * * 0' | ||
|
||
jobs: | ||
CodeQL-Build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
# We must fetch at least the immediate parents so that if this is | ||
# a pull request then we can checkout the head. | ||
fetch-depth: 2 | ||
|
||
# If this run was triggered by a pull request event, then checkout | ||
# the head of the pull request instead of the merge commit. | ||
- run: git checkout HEAD^2 | ||
if: ${{ github.event_name == 'pull_request' }} | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
# Override language selection by uncommenting this and choosing your languages | ||
# with: | ||
# languages: go, javascript, csharp, python, cpp, java | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v1 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
# and modify them (or add more) to build your code if your project | ||
# uses a compiled language | ||
|
||
#- run: | | ||
# make bootstrap | ||
# make release | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 |
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,31 @@ | ||
name: Lint and Fix | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Install and Run lint:fix in authentication directory | ||
working-directory: ./authentication | ||
run: | | ||
npm install | ||
npm run lint:fix | ||
- name: Install and Run lint:fix in frontend directory | ||
working-directory: ./client | ||
run: | | ||
npm install | ||
npm run lint:fix |
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 @@ | ||
.vscode | ||
**/*_password.txt | ||
.DS_Store | ||
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,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no -- commitlint --edit ${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,10 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
cd authentication | ||
npm run lint:fix | ||
cd .. | ||
|
||
cd client | ||
npm run lint:fix | ||
cd .. |
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,55 @@ | ||
PROJECT_NAME = "esd" | ||
LOCAL_DEPLOY_DIR = "deployment/docker" | ||
NPM_SUBDIRS = authentication client | ||
|
||
npm-install: npm-install-subdirectories | ||
@echo "Running npm install to set up Husky and other dependencies..." | ||
@if [ ! -d "node_modules" ]; then \ | ||
npm install; \ | ||
fi | ||
@echo "All npm dependencies installed." | ||
|
||
npm-install-subdirectories: | ||
@echo "Running npm install in subdirectories..." | ||
@for dir in ${NPM_SUBDIRS}; do \ | ||
if [ ! -d "$${dir}/node_modules" ]; then \ | ||
echo "Running npm install in $${dir} service..."; \ | ||
cd $${dir} && npm install && cd ..; \ | ||
fi \ | ||
done | ||
@echo "All subdirectory dependencies installed." | ||
|
||
# --------------------------------------- | ||
# For deploying docker containers locally | ||
# --------------------------------------- | ||
up: npm-install | ||
@docker compose -p ${PROJECT_NAME} \ | ||
-f ${LOCAL_DEPLOY_DIR}/docker-compose.yml \ | ||
up --build -d --remove-orphans | ||
|
||
nobuild/up: npm-install | ||
@docker-compose -p ${PROJECT_NAME} \ | ||
-f ${LOCAL_DEPLOY_DIR}/docker-compose.yml \ | ||
up -d | ||
|
||
# --------------------------------- | ||
# For tearing down local deployment | ||
# --------------------------------- | ||
down: | ||
@docker compose -p ${PROJECT_NAME} \ | ||
-f ${LOCAL_DEPLOY_DIR}/docker-compose.yml \ | ||
down | ||
down-clean: | ||
@docker compose -p ${PROJECT_NAME} \ | ||
-f ${LOCAL_DEPLOY_DIR}/docker-compose.yml \ | ||
down --volumes --remove-orphans | ||
@docker system prune -f | ||
|
||
prune-all: | ||
@echo "Running this command will prune all images. Do you want to proceed [y/N]?"; \ | ||
read ans; \ | ||
case "$$ans" in \ | ||
[Yy]*) docker image prune -a -f ;; \ | ||
*) echo "Aborting." ;; \ | ||
esac | ||
|
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,76 @@ | ||
# 🏢 Enterprise Solution Development IS213 Template Files | ||
|
||
Quickly create and manage new projects with the Enterprise Solution Development IS213 template files. | ||
|
||
- [🏢 Enterprise Solution Development IS213 Template Files](#-enterprise-solution-development-is213-template-files) | ||
- [🚀 Quick Start](#-quick-start) | ||
- [📚 TODO](#-todo) | ||
- [🔧 CICD](#-cicd) | ||
- [🏛 Architecture](#-architecture) | ||
- [🌐 Frontend](#-frontend) | ||
- [🔒 Authentication](#-authentication) | ||
- [📁 Folder Structure](#-folder-structure) | ||
- [🔨 Commit Hooks](#-commit-hooks) | ||
- [🔍 Miscellaneous](#-miscellaneous) | ||
- [🛠 Makefile](#-makefile) | ||
|
||
## 🚀 Quick Start | ||
|
||
To get started: | ||
|
||
1. Populate all the environment variables. | ||
2. Run the following make commands for local development using Docker. This will also install dependencies for Husky. | ||
```bash | ||
make up | ||
``` | ||
|
||
## 📚 TODO | ||
|
||
### 🔧 CICD | ||
|
||
- [ ] Cleanup local deployment using Docker. | ||
- [ ] Create a .env file populator script. | ||
- [ ] Kubernetes cluster configuration. | ||
- [ ] Terraform configuration. | ||
|
||
### 🏛 Architecture | ||
|
||
- [ ] Create a pipeline for separating read and write databases using Kafka, Debezium (CDC). | ||
- [ ] Improve documentation for maintenance. | ||
- [ ] Conduct Mini VAPT for security testing. | ||
|
||
### 🌐 Frontend | ||
|
||
- [ ] Migrate from CRA to Vite. | ||
- [ ] Write unit tests. | ||
- [ ] Set up a visual regression testing pipeline. | ||
|
||
### 🔒 Authentication | ||
|
||
- [ ] Write unit tests. | ||
- [ ] Enhance logging capabilities. | ||
|
||
## 📁 Folder Structure | ||
|
||
| Folder | Description | | ||
|----------------------|------------------------------------------------------------------------------------------| | ||
| `authentication` | Code for authentication and authorization. | | ||
| `deployment` | Docker and Kubernetes configurations. Subfolders for Docker and Kubernetes setups. | | ||
| `downstream-services`| Different downstream services, all behind the Kong gateway. Each with its Dockerfile. | | ||
| `frontend` | Front-end portion of the project. | | ||
| `kong` | Kong API Gateway related code, configurations, and custom authentication plugin. | | ||
| `Makefile` | Makefile for various project-related tasks. | | ||
|
||
## 🔨 Commit Hooks | ||
|
||
Utilizing Husky with: | ||
|
||
- **lint-staged** for linting files on commit. | ||
- **commitlint** to ensure commit messages adhere to the [convention](https://www.conventionalcommits.org/en/v1.0.0/). | ||
|
||
## 🔍 Miscellaneous | ||
|
||
### 🛠 Makefile | ||
|
||
For instructions on installing `Make` on Windows and Ubuntu, refer to [`/docs/Makefile.md`](/docs/Makefile.md). | ||
|
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 @@ | ||
JWT_SECRET_KEY="KUKUBIRDAIDHAIDHAJKSDAJIDBQIheh09u2jeqinwdjnbqwsdifhnw0euq2e0nqwdo" | ||
ACCESS_COOKIE_NAME=access_token | ||
REFRESH_COOKIE_NAME=refresh_token | ||
IDENTITY_COOKIE_NAME=identity_token | ||
GOOGLE_CLIENT_ID=563635941658-naqb6b9b021fqsqesdrfqds3dgbrap35.apps.googleusercontent.com | ||
GOOGLE_CLIENT_SECRET=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 | ||
SERVER_PORT=80 | ||
DB_TYPE=mysql | ||
DB_HOST=mysqldb | ||
DB_PORT=3306 | ||
DB_USERNAME=root | ||
DB_PASSWORD=password | ||
DB_NAME=my_db | ||
DB_SYNCHRONIZE=true | ||
DB_LOGGING=false | ||
REDIS_URL=cache-service | ||
REDIS_PASSWORD=password | ||
NODE_ENV=production |
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 @@ | ||
// .eslintignore | ||
**/node_modules/* | ||
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,110 @@ | ||
module.exports = { | ||
env: { | ||
es6: true, | ||
node: true, | ||
jest: true, | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
}, | ||
plugins: [ | ||
'@typescript-eslint/eslint-plugin', | ||
'import', | ||
'simple-import-sort', | ||
'prettier', | ||
'testing-library', | ||
], | ||
root: true, | ||
ignorePatterns: ['.eslintrc.js', 'jest.config.ts'], | ||
rules: { | ||
'no-console': 'warn', | ||
'linebreak-style': | ||
process.platform === 'win32' ? ['error', 'windows'] : ['error', 'unix'], | ||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], | ||
'@typescript-eslint/member-delimiter-style': [ | ||
'error', | ||
{ singleline: { delimiter: 'semi', requireLast: false } }, | ||
], | ||
semi: ['error', 'always'], | ||
// Clean Code specific rules | ||
'id-length': ['error', { min: 2 }], | ||
'max-lines': ['error', 300], | ||
complexity: ['error', 10], | ||
'max-depth': ['error', 4], | ||
'max-nested-callbacks': ['error', 3], | ||
'max-params': ['error', 4], | ||
'max-statements': ['error', 15], | ||
camelcase: 'error', | ||
'new-cap': [ | ||
'error', | ||
{ | ||
newIsCap: true, | ||
capIsNew: false, | ||
properties: true, | ||
capIsNewExceptions: [ | ||
'Entity', | ||
'PrimaryGeneratedColumn', | ||
'ManyToOne', | ||
'JoinColumn', | ||
'Column', | ||
], | ||
}, | ||
], | ||
'no-mixed-operators': 'error', | ||
'no-nested-ternary': 'error', | ||
'no-unneeded-ternary': 'error', | ||
'spaced-comment': ['error', 'always'], | ||
'multiline-comment-style': ['error', 'starred-block'], | ||
'no-warning-comments': [ | ||
'warn', | ||
{ | ||
terms: ['todo', 'fixme'], | ||
location: 'start', // Checks only the start of comments | ||
}, | ||
], | ||
'no-throw-literal': 'error', | ||
'handle-callback-err': 'error', | ||
'no-redeclare': 'error', | ||
'no-dupe-keys': 'error', | ||
'no-duplicate-imports': 'error', | ||
'no-useless-rename': 'error', | ||
'no-var': 'error', | ||
// Import sorting and organization | ||
'simple-import-sort/imports': [ | ||
'error', | ||
{ | ||
groups: [ | ||
['^\\u0000'], | ||
['^react', '^@?\\w'], | ||
['^(~shared)(/.*|$)'], | ||
['^(~)(/.*|$)'], | ||
['^(~typings)(/.*|$)'], | ||
[ | ||
'^(~assets|~theme)(/.*|$)', | ||
'^(~contexts)(/.*|$)', | ||
'^(~constants)(/.*|$)', | ||
'^(~hooks)(/.*|$)', | ||
'^(~utils)(/.*|$)', | ||
'^(~services)(/.*|$)', | ||
'^(~components)(/.*|$)', | ||
'^(~templates)(/.*|$)', | ||
], | ||
['^(~pages)(/.*|$)', '^(~features)(/.*|$)'], | ||
['^\\.\\.(?!/?$)', '^\\.\\./?$'], | ||
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'], | ||
], | ||
}, | ||
], | ||
'simple-import-sort/exports': 'error', | ||
'import/first': 'error', | ||
'import/newline-after-import': 'error', | ||
'import/no-duplicates': '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,6 @@ | ||
.idea/ | ||
.vscode/ | ||
node_modules/ | ||
build/ | ||
tmp/ | ||
temp/ |
Oops, something went wrong.