From 614fee419222f9cd38e95d75b0afedc7b6f851fd Mon Sep 17 00:00:00 2001 From: Nico Jensch Date: Fri, 8 Nov 2024 12:08:05 +0100 Subject: [PATCH] docs(README): update / add ERD --- README.md | 85 +++++++++++++++++++++++++++++++++++++++----------- assets/ERD.svg | 1 + package.json | 4 +-- 3 files changed, 70 insertions(+), 20 deletions(-) create mode 100644 assets/ERD.svg diff --git a/README.md b/README.md index a5db026..c4c9c7c 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,90 @@ # Chaotic-AUR Next -Monorepo for all Java-/Typescript projects of Chaotic-AUR. +Monorepo for all Java-/Typescript projects of Chaotic-AUR. Includes: + +- Part of repository management (.so lib bumps, up-to-date in-depth package data, etc..) +- Router stats +- Package, Router, Metrics API +- Extracting messages from a Telegram news channel to display on the website +- Chaotic-AURs website +- Smaller helper functions / API ## Building To build the project, run the following command: ```bash -nx build frontend -nx build backend +pnpm build ``` To run it locally for development purposes, run the following command: ```bash -nx serve frontend -nx serve backend +pnpm start:home +pnpm start:be-nx ``` -## Running a local CORS enabled API proxy +## Running a local CORS-enabled API proxy -To run a local CORS enabled API proxy, change the following constants in the `types.ts` file of the shared libs to the +To run a local CORS-enabled API proxy, change the following constants in the `types.ts` file of the shared libs to the following values: ```typescript export const CAUR_BACKEND_URL = "http://localhost:8010/proxy/backend" -export const CAUR_API_URL = "http://localhost:8010/proxy/api"` +export const CAUR_API_URL = "http://localhost:8010/proxy/api" ``` and run the following command afterward: ```bash -pnpm proxy +pnpm proxy:api +pnpm proxy:be ``` This will allow using the production API without CORS issues. +## Tech Stack + +- Angular +- NestJs (Fastify, Passport, TypeORM, Swagger) +- Nx (Monorepo management) +- Postgresql +- Redis +- TailwindCSS +- Telegram API +- TypeORM +- Typescript + +## Backend + +### Required environment variables + +- AUTH0_AUDIENCE: Auth0 audience to target +- AUTH0_CLIENT_ID: Auth0 client id +- AUTH0_CLIENT_SECRET: Auth0 client secret +- AUTH0_DOMAIN: Auth0 domain +- CAUR_DEPLOY_LOG_ID: Telegram chat id for deploy logs +- CAUR_GITLAB_TOKEN: Gitlab token for pushing to the repository +- CAUR_JWT_SECRET: JWT secret for the backend +- CAUR_NEWS_ID: Telegram chat id for news +- CAUR_TRUST_PROXY: IP address of the proxy, if any +- CAUR_USERS: JSON object with user ids and roles +- NODE_ENV: "production" / any other for dev (will enable TypeORM sync mode) +- PG_DATABASE: Postgres database to use +- PG_HOST: Host name of the Postgres database +- PG_PASSWORD: Postgres password +- PG_USER: Postgres user +- REDIS_PASSWORD: Redis password to connect with the Chaotic Manager (Moleculer microservice) +- REDIS_SSH_HOST: Host of the Redis server, used for SSH port forwarding the Redis instance +- REDIS_SSH_USER: User to use for SSH port forwarding the Redis instance +- TELEGRAM_API_HASH: Telegram API hash +- TELEGRAM_API_ID: Telegram API id +- TELEGRAM_DB_ENCRYPTION_KEY: Encryption key for the Telegram database + +## Database structure (as of November 2024) + +![ERD](./assets/ERD.svg) + ## Integrate with editors Enhance your Nx experience by installing [Nx Console](https://nx.dev/nx-console) for your favorite editor. Nx Console @@ -48,20 +97,20 @@ Add Nx plugins to leverage their code generators and automated, inferred tasks. ``` # Add plugin -npx nx add @nx/react +pnpm exec nx add @nx/react # Use code generator -npx nx generate @nx/react:app demo +pnpm exec nx generate @nx/react:app demo # Run development server -npx nx serve demo +pnpm exec nx serve demo # View project details -npx nx show project demo --web +pnpm exec nx show project demo --web ``` -Run `npx nx list` to get a list of available plugins and whether they have generators. Then run -`npx nx list ` to see what generators are available. +Run `pnpm exec nx list` to get a list of available plugins and whether they have generators. Then run +`pnpm exec nx list ` to see what generators are available. Learn more about [code generators](https://nx.dev/features/generate-code) and [inferred tasks](https://nx.dev/concepts/inferred-tasks) in the docs. @@ -71,19 +120,19 @@ Learn more about [code generators](https://nx.dev/features/generate-code) and To execute tasks with Nx use the following syntax: ``` -npx nx <...options> +pnpm exec nx <...options> ``` You can also run multiple targets: ``` -npx nx run-many -t +pnpm exec nx run-many -t ``` ..or add `-p` to filter specific projects ``` -npx nx run-many -t -p +pnpm exec nx run-many -t -p ``` Targets can be defined in the `package.json` or `projects.json`. Learn more diff --git a/assets/ERD.svg b/assets/ERD.svg new file mode 100644 index 0000000..967546c --- /dev/null +++ b/assets/ERD.svg @@ -0,0 +1 @@ +
id
integer
pkgname
character varying
version
character varying
pkgrel
integer
arch
character varying
lastUpdated
timestamp without time zone
previousVersion
character varying
metadata
jsonb
id
integer
buildClass
character varying
status
user-defined
arch
character varying
logUrl
character varying
commit
character varying
timeToEnd
double precision
replaced
boolean
pkgbaseId
integer
builderId
integer
repoId
integer
timestamp
timestamp without time zone
Show More
id
integer
name
character varying
description
character varying
builderClass
character varying
isActive
boolean
lastActive
timestamp without time zone
id
integer
hostname
character varying
id
integer
pkgname
character varying
lastUpdated
timestamp without time zone
isActive
boolean
version
character varying
bumpCount
integer
bumpTriggers
jsonb
metadata
jsonb
pkgrel
integer
namcapAnalysis
jsonb
id
integer
bumpType
user-defined
trigger
integer
triggerFrom
user-defined
timestamp
timestamp without time zone
pkgId
integer
id
integer
identifier
character varying
time
bigint
duration
integer
query
text
result
text
id
integer
name
character varying
repoUrl
character varying
isActive
boolean
status
integer
gitRef
character varying
dbPath
character varying
id
integer
key
character varying
value
character varying
id
integer
timestamp
timestamp without time zone
ip
character varying
repo_arch
character varying
version
character varying
country
character varying
user_agent
character varying
pkgbaseId
integer
hostnameId
integer
repoId
integer
id
integer
name
character varying
password
character varying
mail
character varying
status
user-defined
\ No newline at end of file diff --git a/package.json b/package.json index 8c5b6a5..d1bdd0d 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "build": "nx run-many --target=build --all", "format": "nx format:write", "lint": "nx run-many --target=biome-lint", - "proxy-api": "lcp --proxyUrl https://builds.garudalinux.org/api", - "proxy-be": "lcp --proxyUrl http://localhost:3000 --port 8011", + "proxy:api": "lcp --proxyUrl https://builds.garudalinux.org/api", + "proxy:be": "lcp --proxyUrl http://localhost:3000 --port 8011", "start": "nx run-many --target=serve --all", "start:be-hr": "source backend/.env && nest build --webpack --webpackPath backend/webpack-hmr.config.cjs --watch --path backend/tsconfig.json | pino-pretty -cSt SYS:HH:MM --ignore pid,hostname", "start:be-nx": "nx run backend:serve | pino-pretty -cSt SYS:standard",