Skip to content

Commit 53991ea

Browse files
committed
wip
1 parent 5fc9668 commit 53991ea

File tree

128 files changed

+62
-9077
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+62
-9077
lines changed

.github/workflows/manual-gcp-expressjs.yml

-71
This file was deleted.

BACKLOG.md

-16
This file was deleted.

CHANGELOG.md

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11

22

33
### Version 0.7.0
4+
- [IMPORTANT] moved `js-node/expressjs` and `vue-nobundler` to [https://github.com/es-labs/express-template]()
45
- [chore] update packages & cleanup & work on improving documentation
56
- [chore] prototype projects `solid`, `react-admin` and `nest-admin` have been removed
67
- [jsonwebtoken] update version handle minimum key size requirement change
7-
- [@es-labs/node] moved to https://github.com/es-labs/jslib monorepo
8-
- [@es-labs/esm] moved to https://github.com/es-labs/jslib monorepo
9-
- [js-web/vue-vite] moved to https://github.com/ais-one/vue-antd-template
8+
- [@es-labs/node] moved to https://github.com/es-labs/jscommon monorepo
9+
- [@es-labs/esm] moved to https://github.com/es-labs/jscommon monorepo
10+
- [js-web/vue-vite] moved to https://github.com/es-labs/vue-antd-template
1011
- [js-web/react-vite] moved to https://github.com/ais-one/react-template (work in progress)
1112
- [js-node/jsdoc-ts] example on how to use jsdoc for typescript
12-
- [js-node/expressjs] webpush push notification sample [sample](js-node/expressjs/public/demo-express/pn.html)
13-
- [js-node/expressjs] SSO (OAuth, OIDC, SAML) sample [sample](js-node/expressjs/public/demo-express/sso.html)
13+
- [js-node/expressjs] webpush push notification sample at `public/demo-express/pn.html`
14+
- [js-node/expressjs] SSO (OAuth, OIDC, SAML) sample at `public/demo-express/sso.html`
1415
- [js-node/expressjs] try to removed passport & passport-saml, use @node-saml/node-saml
1516
- [js-node/expressjs] remove sentry, APM for userland to choose and implement
1617
- [@es-labs/node] SSO for oidc to opt to use IDP or issue own token
@@ -19,14 +20,7 @@
1920
- [all] APP_NAME is now only to identify name based on package.json name property. APP_PATH removed
2021
- [js-node/expressjs] rename apps/app-template to app-sample-template
2122
- [js-node/expressjs] replace openapi file joiner, swagger-ui-express and express-openapi-validator with express-jsdoc-swagger
22-
- [in-progress] rename `js-node` to js-apps, add js-libs, js-tools (https://github.com/mikemajesty/nestjs-monorepo) should I add back libs here?
23-
- clone a package from monorepo of a github template project? and able to have updates from upstream?
24-
- [in-progress] move error handling to @ss-labs/node/express/init or preRoute
25-
- [in-progress] clean up @es-labs/node/auth
26-
- [next-in-pipeline] add more express-jsdoc-swagger to routes
27-
- [next-in-pipeline] fix broken tests and examples
28-
- [next-in-pipeline] re-implement MQ
29-
- [next-in-pipeline] to use Typescript and tsoa ? or use JSDoc?
23+
3024

3125
### Version 0.6.11
3226
- [chore] update packages & cleanup & work on improving documentation

README.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@
1313
Latest Version [0.7.0](https://github.com/ais-one/cookbook/releases/tag/0.7.0) - Released 2023 Sep 01 0830 +8GMT. åSee changes history in [CHANGELOG.md](CHANGELOG.md) and discuss [here](https://github.com/ais-one/cookbook/discussions)
1414

1515
Companion Projects:
16-
- Frontend Template to go with the [express API backend](js-node/expressjs) in this repo
17-
- [vue-antd-template](https://github.com/ais-one/vue-antd-template)
16+
- Backend Template & Sample App:
17+
- [https://github.com/es-labs/express-template]()
18+
- Frontend Template & Sample App:
19+
- [https://github.com/es-labs/vue-antd-template]()
1820
- Reusable Components:
1921
- [es-labs/jslib](https://github.com/es-labs/jslibs) reusable CJS and ESM codes
2022
- Python:
2123
- [favv](https://github.com/ais-one/favv) API backend implement in Python FastAPI
2224
- streamlit componennt examples
2325

26+
# IMPORTANT
27+
28+
[Read Me First](_READMEFIRST.md)
29+
2430
# Features
2531

2632
Folder | Description | Features
@@ -32,7 +38,7 @@ Folder | Description | Features
3238
[js-node/expressjs/public/demo-express](js-node/expressjs/public/demo-express) | Frontend to test backend features | - GraphQL, File uploads, Signed URL file upload to GCP Storage, websockets, SSE, webworkers (frontend demo)<br>- JWT using RSA, JWT refresh token, token in HttpOnly cookies, GA OTP, role SAML, OIDC<br>- Github OAuth2 login (setup - https://www.sohamkamani.com/blog/javascript/2018-06-24-oauth-with-node-js)<br>- Fido & Webauthn<br>- Push Notification (Webpush & FCM)
3339
[js-node/*](js-node) | **Other Backend applications** | - [Services](js-node/services) (TCP event/stream, scalable Websocket with Redis Pubsub, etc.)<br>- [Serial server](js-node/serialserver)
3440
[vue-nobundler](vue-nobundler/) | Vue 3 SPA no bundler + Bulma | - signed uploads, recaptcha<br>- **Web component table, form & CRUD backend** (files to note)<br><table><tr><td>[js-node/expressjs/app-template-sample/tables/]()</td><td>sample custom app table configurations</td></tr><tr><td>[js-node/expressjs/router/t4t.js](js-node/expressjs/router/t4t.js)</td><td>handle backend CRUD API</td></tr><tr><td>[@es-labs/esm/t4t-fe.js](@es-labs/esm/t4t-fe.js)</td><td>frontend operations to interact with t4t.js</td></tr><tr><td>[@es-labs/esm/t4t-validate.js](@es-labs/esm/t4t-validate.js)</td><td>validation used by both front and backend</td></tr><tr><td>[@es-labs/esm/bwc-table](@es-labs/esm/bwc-table)</td><td>used to display table</td></tr><tr><td>[@es-labs/esm/bwc-t4t-form.js](@es-labs/esm/bwc-t4t-form.js)</td><td>form generated from table configurations</td></tr><tr><td>[vue-nobundler/views/ui1.js](vue-nobundler/views/ui1.js)</td><td>autcomplete, combobox, file upload example</td></tr><tr><td>[vue-nobundler/views/ui2.js](vue-nobundler/views/ui2.js)</td><td>table example</td></tr><tr><td>[vue-nobundler/views/ui3.js](vue-nobundler/views/ui3.js)</td><td>form example (with connection to backend)</td></tr><tr><td>[vue-nobundler/views/ui4.js](vue-nobundler/views/ui4.js)</td><td>table and form example (with connection to backend)</td></tr></table>
35-
[js-web/vue-vite] | - Vue 3 SPA<br>- vite / vue-router / Pinia<br>- Ant Design | - Leaflet Map, AntV Charts, PWA, Websockets, rxJS<br>- 2FA GA OTP, OIDC + Refresh, SAML, Github OAuth<br>- Web Components (Webcam, Signature)<br>- Playwrite Testing<br>- i18n / graphql (TBD)<br>- moved to https://github.com/ais-one/vue-antd-template
41+
[js-web/vue-vite] | - Vue 3 SPA<br>- vite / vue-router / Pinia<br>- Ant Design | - Leaflet Map, AntV Charts, PWA, Websockets, rxJS<br>- 2FA GA OTP, OIDC + Refresh, SAML, Github OAuth<br>- Web Components (Webcam, Signature)<br>- Playwrite Testing<br>- i18n / graphql (TBD)<br>- moved to https://github.com/es-labs/vue-antd-template
3642
js-web/react-vite | - react SPA<br>- react-router-dom<br>- zustand/@tanstack<br>- react-query | - moved to https://github.com/ais-one/react-template
3743
[.github/workflows](.github/workflows) | Github Actions (CI/CD) | - Manually Trigger<br>- On-push Trigger (WIP)
3844
AMP Website | [removed](https://plausible.io/blog/google-amp) | -
@@ -121,7 +127,7 @@ See [js-node/README.md](js-node/README.md)
121127

122128
### Vite SPA Setup & Run - development environment
123129

124-
See [vue-antd-template project](https://github.com/ais-one/vue-antd-template).
130+
See [https://github.com/es-labs/vue-antd-template]().
125131

126132
Why No SSR or SSG:
127133
- potential slow rendering by server app, added complexity in code, rehydration errors, added complexity in server

_READMEFIRST.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Read Me First
2+
3+
## Resuable JS frameworks how to...
4+
5+
for template (framework) repo
6+
1. exclude configurable files from repo (e.g. .env), but include sample config files (e.g. .env.sample)
7+
2. create an folder where all custom code is placed, framework must not touch anything inside this folder
8+
9+
for app based on template repo
10+
1. clone template repo
11+
2. create a remote called upstream pointing to template repo
12+
3. update framework when necessary by merging upstream into origin
13+
14+
template repo is advisable not to be monorepo
15+
16+
## Shareable libraries and contracts
17+
18+
TBD
19+
20+
21+
22+
23+
- [done] rename `js-node` to js-apps, add js-libs, js-tools (https://github.com/mikemajesty/nestjs-monorepo) should I add back libs here?
24+
- clone a package from monorepo of a github template project? and able to have updates from upstream?
25+
26+
27+
28+

docs/backend/tcp.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ Running the example
44

55
```
66
npm i
7-
cd js-node/expressjs/sandbox
7+
cd js-node/services/sandbox
88
node tcpServer.js
99
```
1010

1111
A TCP server will listen on port 7070. Use putty (for windows) as client to connect (Raw TCP) and test
1212

13-
Example Usage file location [../../js-node/expressjs/sandbox/tcpServer.js](../../js-node/expressjs/sandbox/tcpServer.js)
13+
Example Usage file location [../../js-node/services/sandbox/tcpServer.js]()
1414

1515
More Samples
16-
- More TCP Usage [../../js-node/expressjs/sandbox/net.js](../../js-node/expressjs/sandbox/net.js)
17-
- TCP Retries [../../js-node/expressjs/sandbox/net-retries.js](../../js-node/expressjs/sandbox/net-retries.js)
16+
- More TCP Usage [../../js-node/services/sandbox/net.js]()
17+
- TCP Retries [../../js-node/services/sandbox/net-retries.js]()

docs/deployment/deployment-vm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ ps ax | grep 'node index.js' | grep -v grep | awk '{print $1}' | xargs kill
130130

131131
### use pm2
132132

133-
See js-node/expressjs/ecosystem.config.js
133+
look for `ecosystem.config.js`
134134

135135

136136
# Startup on VM using SystemD

docs/deployment/home.md

-50
Original file line numberDiff line numberDiff line change
@@ -55,56 +55,6 @@ In GCP
5555
In Mongo Atlas
5656
- create mongo atlas account
5757

58-
### Backend - js-node/expressjs
59-
60-
In js-node/expressjs folder
61-
62-
1. place service account json file into [../../js-node/expressjs/.env.secret]()
63-
2. set the mongodb info in [../../js-node/expressjs/.env.secret]()
64-
3. set the CORS to allow frontend origin from the frontend setup
65-
66-
```bash
67-
# on windows, need to use bash shell
68-
deploy.sh uat app-template
69-
```
70-
71-
Note the URL returned you can test it using <URL>/api/healthcheck, you may need to wait awhile for initial response or retry a few times
72-
73-
74-
---
75-
76-
## Local Development
77-
78-
This is for local development purpose and tries to replicate as much of the real-life environment is possible
79-
80-
- git
81-
- webhooks testing
82-
- called by internal - http://xip.io/ - e.g. https://www.127.0.0.1.xip.io/api/health
83-
- called by external site - ngrok
84-
- NodeJS
85-
- with self signed cert
86-
- WSL Ubuntu
87-
- Docker
88-
- MongoDB, SAML, Kafka, MySQL, Vault docker compose files can be found in [../../docker-devenv](../../docker-devenv)
89-
90-
## Backend Application Container Build
91-
92-
We can build backend on container so that we can orchestrate using K8s
93-
94-
See [deployment-container.md](deployment-container.md)
95-
96-
And [../../js-node/expressjs/Dockerfile](../../js-node/expressjs/Dockerfile)
97-
98-
## Deployment Preparation
99-
100-
View files, folders and readme.md below, and configure them
101-
102-
- js-node/expressjs/.env
103-
- js-node/expressjs/.env.secret (enter your secrets as required)
104-
- js-node/expressjs/ecosystem.config.js (for pm2 deployments)
105-
- js-node/expressjs/Dockerfile (for docker deployments)
106-
- js-node/expressjs/deploy.sh
107-
10858
---
10959

11060
## Deployment On Single VM

docs/deployment/secrets.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Need to take into consideration, the following:
1414

1515
### Secret Managers
1616

17-
- Hashicorp Vault [we use the docker version of this for our testing js-node/expressjs on local machine]
17+
- Hashicorp Vault
1818
- self hosted, docker
1919
- helm, sidecar
2020
- vault + mongoatlas

docs/home.md

+2
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@
6666

6767
- https://www.aspecto.io/blog/lerna-hello-world-how-to-create-a-monorepo-for-multiple-node-packages/
6868
- https://medium.com/@anoop_gupta/cross-repository-component-sharing-using-mono-repo-multi-packages-architecture-2797c3e02c6c
69+
70+
- https://www.codemzy.com/blog/nodejs-file-folder-structure

git-hooks/pre-commit

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/sh
22

33
echo ---------- pre-commit execute start ----------
4-
cd js-node/expressjs && npm run lint
54
# you can do a git add . here also
65
echo ---------- pre-commit execute end ----------

js-node/README.md

-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ Below are a list of NodeJS applications
44

55
- dbdeploy
66
- see [dbdeploy/README.md]()
7-
- expressjs
8-
- see [expressjs/README.md]()
97
- jsdoc-ts
108
- see [jsdoc-ts/README.md]() may eventually replace swagger-jsdoc-swagger
119
- scaled-ws
@@ -42,9 +40,6 @@ npm run process-long
4240
npm run process-cron
4341
```
4442

45-
46-
47-
4843
# Useful commands
4944

5045
redirect to a file with date

js-node/dbdeploy/READMD.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ https://knexjs.org/guide/migrations.html#migration-cli
1010
when DB could be shared between packages
1111

1212

13-
## Quick Create DB For demo expressjs App
13+
## Quick Create DB
14+
15+
For [express-template](https://github.com/es-labs/express-template) app sample
1416

1517
```bash
1618
npx knex --knexfile knex-sample/knexfile.js migrate:up

js-node/dbdeploy/knex-sample/knexfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
development: {
99
client: 'sqlite3',
1010
connection: {
11-
filename: '../../expressjs/dev.sqlite3'
11+
filename: 'dev.sqlite3'
1212
}
1313
},
1414

js-node/expressjs/.dockerignore

-5
This file was deleted.

0 commit comments

Comments
 (0)