From 6f2bc9c779cf7da0e7344876d105cb645df1f5d5 Mon Sep 17 00:00:00 2001 From: kuubson Date: Thu, 5 Jan 2023 13:45:29 +0100 Subject: [PATCH 1/4] restart nodemon after each change in @online-library/config package --- README.md | 30 +++++++++++++++--------------- apps/server/nodemon.json | 4 ++++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 61e9f029..d03687e5 100644 --- a/README.md +++ b/README.md @@ -184,21 +184,21 @@ socket("socket.io")-->api ## 🔒 Environment variables -| details | server | web | -| ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------- | -| [cloudinary](https://cloudinary.com) API credentials | `CLOUDINARY_API_KEY` `CLOUDINARY_API_SECRET` `CLOUDINARY_NAME` | ❌ | -| PostgreSQL credentials | `DATABASE_HOST` `DATABASE_NAME` `DATABASE_PASSWORD` `DATABASE_USERNAME` | ❌ | -| secret key for `jsonwebtoken` | `JWT_KEY` | ❌ | -| email address for the email sender (eg. no-reply@online-library.com) | `NODEMAILER_USERNAME` | ❌ | -| nodemailer testing credentials (`nodemailer.createTestAccount`) | `NODEMAILER_TEST_USER` `NODEMAILER_TEST_PASSWORD` | ❌ | -| SMTP provider (`nodemailer` credentials) | `MAILJET_USER` `MAILJET_PASSWORD` | ❌ | -| [paypal](https://developer.paypal.com) API credentials | `PAYPAL_CLIENT_ID` `PAYPAL_CLIENT_SECRET` | ❌ | -| `web-push` [package](<(https://www.npmjs.com/package/web-push)>) credentials (`web-push generate-vapid-keys`) | `PRIVATE_VAPID_KEY` `VITE_PUBLIC_VAPID_KEY` | `VITE_PUBLIC_VAPID_KEY` | -| fb [app](https://developers.facebook.com/apps) credentials | `FACEBOOK_APP_SECRET` `VITE_FACEBOOK_APP_ID` | `VITE_FACEBOOK_APP_ID` | -| [stripe](https://dashboard.stripe.com) API credentials | `STRIPE_SECRET_KEY` | `VITE_STRIPE_PUBLISHABLE_KEY` | -| set to `true` to re-autogenerate db models from existing tables (generates all methods for associations) | `SEQUELIZE_AUTO` | ❌ | -| set to `true` to seed db with some random books | `SEED_BOOKS` | ❌ | -| set to `true` to seed db with a test user | `SEED_USER` | ❌ | +| details | server | web | +| ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ----------------------------- | +| [cloudinary](https://cloudinary.com) API credentials | `CLOUDINARY_API_KEY` `CLOUDINARY_API_SECRET` `CLOUDINARY_NAME` | ❌ | +| PostgreSQL connection URL | `DATABASE_URL` | ❌ | +| secret key for `jsonwebtoken` | `JWT_KEY` | ❌ | +| email address for the email sender (eg. no-reply@online-library.com) | `NODEMAILER_USERNAME` | ❌ | +| nodemailer testing credentials (`nodemailer.createTestAccount`) | `NODEMAILER_TEST_USER` `NODEMAILER_TEST_PASSWORD` | ❌ | +| SMTP provider (`nodemailer` credentials) | `MAILJET_USER` `MAILJET_PASSWORD` | ❌ | +| [paypal](https://developer.paypal.com) API credentials | `PAYPAL_CLIENT_ID` `PAYPAL_CLIENT_SECRET` | ❌ | +| `web-push` [package](<(https://www.npmjs.com/package/web-push)>) credentials (`web-push generate-vapid-keys`) | `PRIVATE_VAPID_KEY` `VITE_PUBLIC_VAPID_KEY` | `VITE_PUBLIC_VAPID_KEY` | +| fb [app](https://developers.facebook.com/apps) credentials | `FACEBOOK_APP_SECRET` `VITE_FACEBOOK_APP_ID` | `VITE_FACEBOOK_APP_ID` | +| [stripe](https://dashboard.stripe.com) API credentials | `STRIPE_SECRET_KEY` | `VITE_STRIPE_PUBLISHABLE_KEY` | +| set to `true` to re-autogenerate db models from existing tables (generates all methods for associations) | `SEQUELIZE_AUTO` | ❌ | +| set to `true` to seed db with some random books | `SEED_BOOKS` | ❌ | +| set to `true` to seed db with a test user | `SEED_USER` | ❌ | > **Note** See [envs](https://github.com/kuubson/online-library/tree/master/apps/native#-environment-variables) for the mobile app diff --git a/apps/server/nodemon.json b/apps/server/nodemon.json index 68042157..2cc345e4 100644 --- a/apps/server/nodemon.json +++ b/apps/server/nodemon.json @@ -1,4 +1,8 @@ { "ext": "ts,gql,json", + "watch": [ + "../../@online-library/config/dist/index.js", + "../../@online-library/config/dist/index.mjs" + ], "ignore": ["./database/generated/"] } From 78280d1edc7392d6e3f31c5d1972e02ddf3d537d Mon Sep 17 00:00:00 2001 From: kuubson Date: Thu, 5 Jan 2023 13:45:54 +0100 Subject: [PATCH 2/4] reduce eslint warnings --- @online-library/config/package.json | 2 +- @online-library/core/package.json | 2 +- @online-library/logic/package.json | 2 +- apps/native/package.json | 2 +- apps/server/package.json | 2 +- apps/web/package.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/@online-library/config/package.json b/@online-library/config/package.json index a9ce5d67..f8c1ef1b 100644 --- a/@online-library/config/package.json +++ b/@online-library/config/package.json @@ -7,7 +7,7 @@ "types": "./dist/index.d.ts", "scripts": { "dev": "yarn lib:build --watch", - "lint": "eslint . && tsc --noEmit", + "lint": "eslint . --rule \"object-curly-newline: off\" && tsc --noEmit", "lib:build": "tsup src/index.ts --format esm,cjs --dts --external react" }, "dependencies": { diff --git a/@online-library/core/package.json b/@online-library/core/package.json index 06b044c9..d616758a 100644 --- a/@online-library/core/package.json +++ b/@online-library/core/package.json @@ -7,7 +7,7 @@ "types": "./dist/index.d.ts", "scripts": { "dev": "yarn lib:build --watch", - "lint": "eslint . && tsc --noEmit", + "lint": "eslint . --rule \"object-curly-newline: off\" && tsc --noEmit", "lib:build": "tsup src/index.ts --format esm,cjs --dts --external react" }, "dependencies": { diff --git a/@online-library/logic/package.json b/@online-library/logic/package.json index 89682422..e23a3be9 100644 --- a/@online-library/logic/package.json +++ b/@online-library/logic/package.json @@ -7,7 +7,7 @@ "types": "./dist/index.d.ts", "scripts": { "dev": "yarn lib:build --watch", - "lint": "eslint . && tsc --noEmit", + "lint": "eslint . --rule \"object-curly-newline: off\" && tsc --noEmit", "lib:build": "tsup src/index.ts --format esm,cjs --dts --external react" }, "dependencies": { diff --git a/apps/native/package.json b/apps/native/package.json index 0a2097be..ed208c38 100644 --- a/apps/native/package.json +++ b/apps/native/package.json @@ -6,7 +6,7 @@ "android": "react-native run-android", "ios": "react-native run-ios", "metro": "react-native start", - "lint": "eslint . && tsc --noEmit && stylelint src/**/*.{ts,tsx}", + "lint": "eslint . --rule \"object-curly-newline: off\" && tsc --noEmit && stylelint src/**/*.{ts,tsx}", "test": "jest", "test:watch": "jest --watchAll", "assets": "react-native bundle --platform android --dev false --entry-file apps/native/index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res", diff --git a/apps/server/package.json b/apps/server/package.json index f1fe6f09..97eb794b 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -6,7 +6,7 @@ "start": "cross-env NODE_ENV=production node dist/server.js", "start:testing": "cross-env NODE_ENV=testing PORT=3000 node dist/server.js", "dev": "cross-env NODE_ENV=development nodemon server.ts", - "lint": "eslint . && tsc --noEmit", + "lint": "eslint . --rule \"object-curly-newline: off\" && tsc --noEmit", "build": "tsc && copyfiles gql/**/**/*.gql dist", "docs": "npx ts-node swagger/swagger.ts" }, diff --git a/apps/web/package.json b/apps/web/package.json index 56f2285d..2b1a70de 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "lint": "eslint . && tsc --noEmit && stylelint src/**/*.{ts,tsx}", + "lint": "eslint . --rule \"object-curly-newline: off\" && tsc --noEmit && stylelint src/**/*.{ts,tsx}", "test:e2e": "npx cypress run --browser chrome", "build": "tsc && vite build", "cypress": "npx cypress open" From 16e9269c6c9b8ae198234bf62f7718d26fb34211 Mon Sep 17 00:00:00 2001 From: kuubson Date: Thu, 5 Jan 2023 15:00:29 +0100 Subject: [PATCH 3/4] tweak nodemon.json --- apps/server/nodemon.json | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/server/nodemon.json b/apps/server/nodemon.json index 2cc345e4..1438ab78 100644 --- a/apps/server/nodemon.json +++ b/apps/server/nodemon.json @@ -1,6 +1,7 @@ { "ext": "ts,gql,json", "watch": [ + "./", "../../@online-library/config/dist/index.js", "../../@online-library/config/dist/index.mjs" ], From 7ec77166d42e89cdca235bb360665eea2864643a Mon Sep 17 00:00:00 2001 From: kuubson Date: Wed, 25 Jan 2023 22:02:17 +0100 Subject: [PATCH 4/4] update hosting provider --- @online-library/config/src/utils/urls.ts | 3 ++- README.md | 12 ++++++------ apps/native/README.md | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/@online-library/config/src/utils/urls.ts b/@online-library/config/src/utils/urls.ts index fd4b44c8..534b4896 100644 --- a/@online-library/config/src/utils/urls.ts +++ b/@online-library/config/src/utils/urls.ts @@ -2,7 +2,8 @@ import { isProd } from 'is' const LOCALHOST = 'localhost' -export const HOST = 'online-library.up.railway.app' +// NOTE: must be a raw url +export const HOST = 'online-library-idvd.onrender.com' export const CLIENT_URL = isProd ? `https://${HOST}` : `http://${LOCALHOST}:3000` diff --git a/README.md b/README.md index d03687e5..608d4327 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 💻 js fullstack [app](https://online-library.up.railway.app), monorepo (web & [mobile](https://github.com/kuubson/online-library/tree/master/apps/native#-native-app)) +# 💻 js fullstack [app](https://online-library-idvd.onrender.com), monorepo (web & [mobile](https://github.com/kuubson/online-library/tree/master/apps/native#-native-app)) | [Stack](#-stack-) | [Preview](#-app-preview) | [Notes](#-some-notes) | [Flow](#-flow) | [Packages](#-custom-local-packages) | [Docs](#-documentation) | [Tools](#-tools) | [Goals](#-future-goals) | [Scripts](#-root-scripts) | [Env](#-environment-variables) | [Tips](#-tips) | | ----------------- | ------------------------ | --------------------- | -------------- | ----------------------------------- | ----------------------- | ---------------- | ----------------------- | ------------------------- | ------------------------------ | -------------- | @@ -9,7 +9,7 @@ ![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) ![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge&logo=express&logoColor=%2361DAFB) ![GraphQL](https://img.shields.io/badge/-GraphQL-E10098?style=for-the-badge&logo=graphql&logoColor=white) ![Socket.io](https://img.shields.io/badge/Socket.io-black?style=for-the-badge&logo=socket.io&badgeColor=010101) ![JWT](https://img.shields.io/badge/JWT-black?style=for-the-badge&logo=JSON%20web%20tokens) ![Swagger](https://img.shields.io/badge/-Swagger-%23Clojure?style=for-the-badge&logo=swagger&logoColor=white) ![Sequelize](https://img.shields.io/badge/Sequelize-52B0E7?style=for-the-badge&logo=Sequelize&logoColor=white) -![Vite](https://img.shields.io/badge/Vite-646CFF.svg?style=for-the-badge&logo=Vite&logoColor=white) ![Cypress](https://img.shields.io/badge/-cypress-%23E5E5E5?style=for-the-badge&logo=cypress&logoColor=058a5e) ![Turborepo](https://img.shields.io/badge/Turborepo-EF4444.svg?style=for-the-badge&logo=Turborepo&logoColor=white) ![Railway](https://img.shields.io/badge/Railway-131415?style=for-the-badge&logo=railway&logoColor=white) ![CircleCI](https://img.shields.io/badge/circle%20ci-%23161616.svg?style=for-the-badge&logo=circleci&logoColor=white) ![Firebase](https://img.shields.io/badge/firebase-%23039BE5.svg?style=for-the-badge&logo=firebase) ![Postgres](https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge&logo=postgresql&logoColor=white) +![Vite](https://img.shields.io/badge/Vite-646CFF.svg?style=for-the-badge&logo=Vite&logoColor=white) ![Cypress](https://img.shields.io/badge/-cypress-%23E5E5E5?style=for-the-badge&logo=cypress&logoColor=058a5e) ![Turborepo](https://img.shields.io/badge/Turborepo-EF4444.svg?style=for-the-badge&logo=Turborepo&logoColor=white) ![Render](https://img.shields.io/badge/Render-%46E3B7.svg?style=for-the-badge&logo=render&logoColor=white) ![CircleCI](https://img.shields.io/badge/circle%20ci-%23161616.svg?style=for-the-badge&logo=circleci&logoColor=white) ![Firebase](https://img.shields.io/badge/firebase-%23039BE5.svg?style=for-the-badge&logo=firebase) ![Postgres](https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge&logo=postgresql&logoColor=white) > **Note** See the [stack](https://github.com/kuubson/online-library/tree/master/apps/native#-stack-) for the mobile app @@ -31,7 +31,7 @@ ## 📄 Some notes -> **Note** A cutting-edge technologies driven 💯, fullstack, cross-plaftorm app, hosted on 📡 **Railway** +> **Note** A cutting-edge technologies driven 💯, fullstack, cross-plaftorm app, hosted on 📡 **Render** Acts as a **fake store** with possibility to chat 💬 with other users: @@ -68,10 +68,10 @@ lib-->apps((apps)) %% -------------------------- -railway[\Railway/]-->db[("PostgreSQL")] +render[\Render/]-->db[("PostgreSQL")] db[("PostgreSQL")]-->sequelize[\Sequelize/] sequelize-->server -railway-->server +render-->server Cypress[\Cypress/]-->web apps-->server(server) @@ -114,7 +114,7 @@ socket("socket.io")-->api ### 🤖 Automation -- every push to the master branch triggers the autodeployment on Railway + **CircleCI** build workflow (linting, e2e tests, new release of the mobile app that requires an approval) +- every push to the master branch triggers the autodeployment on Render + **CircleCI** build workflow (linting, e2e tests, new release of the mobile app that requires an approval) - [@trivago/prettier-plugin-sort-imports](https://www.npmjs.com/package/@trivago/prettier-plugin-sort-imports) for keeping a consistent order of imports (custom flow) - [graphql-codegen](https://www.the-guild.dev/graphql/codegen) for autogenerating the code (hooks & types) from gql schema & documents - [@graphql-tools/merge](https://www.graphql-tools.com/docs/schema-merging) for auto merging resolvers & type defs into schema (**custom wrapper** to detect duplicated resolvers) diff --git a/apps/native/README.md b/apps/native/README.md index 049bea5d..2d92516e 100644 --- a/apps/native/README.md +++ b/apps/native/README.md @@ -1,4 +1,4 @@ -# 📱 native [app](https://online-library.up.railway.app) +# 📱 native [app](https://online-library-idvd.onrender.com) | [Stack](#-stack-) | [Preview](#-app-preview) | [Notes](#-some-notes) | [Distribution](#-distribution) | [Goals](#-future-goals) | [Scripts](#-scripts) | [Env](#-environment-variables) | [Tips](#-tips) | | ----------------- | ------------------------ | --------------------- | ------------------------------ | ----------------------- | -------------------- | ------------------------------ | -------------- |