Skip to content

Commit

Permalink
upload code
Browse files Browse the repository at this point in the history
  • Loading branch information
artemnih committed Feb 22, 2024
0 parents commit 74bc8ee
Show file tree
Hide file tree
Showing 70 changed files with 15,163 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
node_modules
packages/*/node_modules
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-unused-vars": ["warn"],
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-var-requires": "warn",
"@typescript-eslint/no-this-alias": "warn"
}
}
87 changes: 87 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build and Test
on:
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.9.0
- id: cache
uses: actions/cache@v3
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

lint:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.9.0
- id: cache
uses: actions/cache@v3
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- run: npm run lint

build-web:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.9.0
- id: cache
uses: actions/cache@v3
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- run: npm run build:common
- run: npm run build:ui

build-server:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.9.0
- id: cache
uses: actions/cache@v3
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- run: npm run build:common
- run: npm run build:api

test:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.9.0
- id: cache
uses: actions/cache@v3
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- run: npm run build:common
- run: npm run test
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# node-waf configuration
.lock-wscript

# Dependency directories
node_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

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

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
packages/ui/.angular

# Workspaces
packages/*/node_modules
packages/*/dist

.angular
.DS_Store
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
npm run lint
npm run prettier:fix
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package.json
yarn.lock
package-lock.json
dist
.angular
.husky
*.yaml
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"semi": true,
"bracketSpacing": true,
"trailingComma": "es5",
"printWidth": 140
}
21 changes: 21 additions & 0 deletions Dockerfile.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:20-alpine as builder

WORKDIR /app

COPY . .

RUN npm i --w=packages/common
RUN npm i --w=packages/api

RUN npm run build:common
RUN npm run build:api

FROM node:20-alpine

WORKDIR /usr/src/app
COPY --from=builder /app/packages/api/dist .
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/packages/common/dist ./node_modules/@example/common
EXPOSE 8080

CMD [ "node", "." ]
24 changes: 24 additions & 0 deletions Dockerfile.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM node:20 AS build

# Set the source folder
ARG SOURCE_FOLDER="./"

# Create app directory
WORKDIR /var/www/

# Bundle app source
COPY ${SOURCE_FOLDER} .

RUN npm i --w=packages/common
RUN npm i --w=packages/ui

RUN npm run build:common
RUN npm run build:ui

FROM nginx:1.17-alpine
COPY VERSION /VERSION
COPY --from=build /var/www/packages/ui/dist/workflow /var/www/

COPY default.conf /etc/nginx/conf.d/
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# MEAN Stack Monorepo Quick Starter

Full stack monorepo based on `NPM Workspaces`.

- Language: `Typescript`
- Frontend: `Angular 17` with routing and `SASS`
- Backend: `Express`
- Database: `MongoDB`
- ODM: `Mongoose`

## Features

- `NPM Workspaces` monorepo
- `api` and `ui` packages are independent and both import common types from `common` package
- `OIDC` authentication
- Inlcuded Github Actions checks on pull requests
- Inlcuded Dockerfile for both `api` and `ui` packages

## Prerequisites

Ensure you have the following installed on your machine:

- `Node.js`: 20
- `@angular/cli`: 17

## Getting Started

Install dependencies:

```bash
npm i
```

Run project in development mode

If auth is not yet configured, run the following command to start the project without auth:

```bash
npm run noauth # no auth mode
```

if Auth url is provided in `api` .env and in `ui` app.config.json

```bash
npm start # with auth mode
```

## Building

Build the project:

```bash
npm run build
```
7 changes: 7 additions & 0 deletions default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
server {
listen 80;
root /var/www/browser;
location / {
try_files $uri $uri/ /index.html;
}
}
1 change: 1 addition & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nginx -g 'daemon off;'
Loading

0 comments on commit 74bc8ee

Please sign in to comment.