Skip to content

Commit

Permalink
docs(README): update / add ERD
Browse files Browse the repository at this point in the history
  • Loading branch information
dr460nf1r3 committed Nov 8, 2024
1 parent 2f618ef commit 614fee4
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 20 deletions.
85 changes: 67 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 <plugin-name>` 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 <plugin-name>` 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.
Expand All @@ -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 <target> <project> <...options>
pnpm exec nx <target> <project> <...options>
```

You can also run multiple targets:

```
npx nx run-many -t <target1> <target2>
pnpm exec nx run-many -t <target1> <target2>
```

..or add `-p` to filter specific projects

```
npx nx run-many -t <target1> <target2> -p <proj1> <proj2>
pnpm exec nx run-many -t <target1> <target2> -p <proj1> <proj2>
```

Targets can be defined in the `package.json` or `projects.json`. Learn more
Expand Down
1 change: 1 addition & 0 deletions assets/ERD.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 614fee4

Please sign in to comment.