Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion @online-library/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion @online-library/config/src/utils/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
2 changes: 1 addition & 1 deletion @online-library/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion @online-library/logic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -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) |
| ----------------- | ------------------------ | --------------------- | -------------- | ----------------------------------- | ----------------------- | ---------------- | ----------------------- | ------------------------- | ------------------------------ | -------------- |
Expand All @@ -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

Expand All @@ -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:

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion apps/native/README.md
Original file line number Diff line number Diff line change
@@ -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) |
| ----------------- | ------------------------ | --------------------- | ------------------------------ | ----------------------- | -------------------- | ------------------------------ | -------------- |
Expand Down
2 changes: 1 addition & 1 deletion apps/native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions apps/server/nodemon.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"ext": "ts,gql,json",
"watch": [
"./",
"../../@online-library/config/dist/index.js",
"../../@online-library/config/dist/index.mjs"
],
"ignore": ["./database/generated/"]
}
2 changes: 1 addition & 1 deletion apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down