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/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",