diff --git a/README.md b/README.md index 30e298dd..29bb5f22 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ XMRChat is a tip-for-chat application. Users can set up a page and have others s - [Server](#server) - [Client](#client) +- [Development](#development) + ## Technology Stack 🚀 - **Client Side:** @@ -36,11 +38,10 @@ XMRChat is a tip-for-chat application. Users can set up a page and have others s - **Language:** [TypeScript](https://www.typescriptlang.org/) - **Server Side:** - - **Framework:** [Elysia Js](https://elysiajs.com/) + - **Framework:** [Nest Js](https://nestjs.com/) - **Language:** [TypeScript](https://www.typescriptlang.org/) - - **Runtime:** [Bun](https://bun.sh) - **Cache:** [Redis](https://redis.io/) - - **ORM:** [Kysely](https://kysely.dev/) + - **ORM:** [TypeORM](https://typeorm.io/) - **Database:** [PostgreSQL](https://www.postgresql.org/) - **Infrastructure:** @@ -50,7 +51,7 @@ XMRChat is a tip-for-chat application. Users can set up a page and have others s - **Payment Providers:** - **Monero:** - - [Monero Project](https://www.docker.com/) + - [Monero Project](https://www.getmonero.com/) - wallet Server : [monero-lws](https://github.com/vtnerd/monero-lws) ## Business Strategy: Payment @@ -60,24 +61,13 @@ The service uses a one-time payment strategy. During the deployment setup proces ## Requirements 📝 - [Docker 🐳](https://docs.docker.com/engine/install/) -- [git](https://git-scm.com/downloads) -- [Monero wallet](https://www.getmonero.org/downloads/#gui) +- [Monero-lws Instance](https://github.com/vtnerd/monero-lws) +- A Monero Wallet ## Project Structure 📍 -- [Server](./server/): Contains the backend code. - - - [db](./server/src/db/): Contains the database connection and migration files. - - [routes](./server/src/routes/): Contains the route handlers. - - [schemas](./server/src/schemas/): Contains the route schemas definitions for validation. - - [services](./server/src/services/): Contains the service classes. - - [types](./server/src/types/): Contains type definitions. - - [utils](./server/src/utils/): Contains utility functions. - - [env.ts](./server/src/env.ts): Contains the environment variables and their default values. - - [index.ts](./server/src/index.ts): The entrypoint file for the backend. - -- [Client](./client/): Contains the frontend code. -- [Monero](./monero/): Contains Monero network services (Monero Project & Monero-LWS). +- [Server](./server/): Contains the backend code ( Nest JS ). +- [Client](./client/): Contains the frontend code ( Nuxt JS ). - [Traefik](./traefik/): Contains Traefik setups ## Install & Build 🛠️ @@ -103,26 +93,116 @@ Now change the .env with yours and run the container. > The **password** must be **Hashed** in the env and also if you add that in compose file the "$" characters must be doubled to not recognized as variable by docker engine. ```console -docker compose up +docker compose up -d ``` -### 2. Monero +### 2.1. Monero -You can use Make file by below command in Monero directory to get and config Monero related repositories. +Create and run a monero node. If you already have a synced node with zmq enabled skip to next step. ```console -cp monero -make monero-setup +mkdir monero && cd monero +git clone https://github.com/monero-project/monero.git ``` -or: +In last line of Dockerfile comment out CMD Command. + +``` +# CMD ["--p2p-bind ... +``` + +### 2.2 Monero-LWS + +Clone Monero-lws repository on branch `release-v0.3_0.18`: ```console -cp monero -git clone https://github.com/monero-project/monero.git -git clone https://github.com/vtnerd/monero-lws/tree/release-v0.3_0.18 -cp Dockerfile.monero ./monero/Dockerfile -cp Dockerfile.lws ./monero-lws/Dockerfile +git clone -b release-v0.3_0.18 https://github.com/vtnerd/monero-lws +``` + +From last line of Dockerfile remove ENTRYPOINT and CMD and replace it with only `ENTRYPOINT ["monero-lws-daemon"]` + +Final Dockerfile will be ending like this: + +```console +... +EXPOSE 8443 + +ENTRYPOINT ["monero-lws-daemon"] +``` + +### 2.3. Run Monero and Monero-LWS + +Add following `docker-compose.yml` to /monero directory we created on step 2.1 considering monero project ( step 2.1 ) is inside `./monero/monero` folder and monero lws ( step 2.2 ) is on `./monero/monero-lws` directory + +```yml +services: + monero: + container_name: monero + build: + context: ./monero + restart: always + user: root + ports: + # - :80 + - :18080 + - :18081 + - :18082 + - :18083 + - :18084 + command: + - --p2p-bind-ip=0.0.0.0 + - --p2p-bind-port=18080 + - --rpc-bind-ip=0.0.0.0 + - --rpc-bind-port=18081 + - --non-interactive + - --rpc-ssl=disabled + - --rpc-access-control-origins=monero + - --disable-rpc-ban + - --confirm-external-bind + - --zmq-pub=tcp://0.0.0.0:18084 + - --zmq-rpc-bind-port=1882 + - --zmq-rpc-bind-ip=0.0.0.0 + + volumes: + - bitmonero:/root/.bitmonero + networks: + - traefik + + lws: + depends_on: + - monero + container_name: lws + user: root + build: + context: ./monero-lws + restart: always + ports: + # - :80 + - :8443 + command: + - --db-path=/home/monero-lws/.bitmonero/light_wallet_server + - --daemon=tcp://monero:1882 + - --sub=tcp://monero:18084 + - --log-level=4 + - --webhook-ssl-verification=none + - --disable-admin-auth + - --admin-rest-server=http://0.0.0.0:8443/admin + - --rest-server=http://0.0.0.0:8443/basic + - --access-control-origin=lws:8443 + - --confirm-external-bind + volumes: + - monerolws:/home/monero-lws + networks: + - traefik + +volumes: + bitmonero: {} + monerolws: {} + +networks: + traefik: + name: traefik + external: true ``` Run the container : @@ -143,7 +223,7 @@ After it is synced and ready, go next. ```console cd server -cp .env.example +cp .env.example .env ``` Change .env file with yours. @@ -156,18 +236,44 @@ docker compose up -d ```console cd client -cp .env.example +cp .env.example .env ``` -Change .env file with yours. and also change the env at the end of "Dockerfile" file. +Change .env file with yours. ```console docker compose up -d ``` -## Notes +## Development + +For development you might not need monero or monero-lws if you don't make tips or create new pages ( any payments related to monero ). If you need lws instance access or can't run yours please contact us. + +### Server + +Add your .env file based on .env.example. + +Run backend locally with docker-compose.dev.yml file + +```console +docker compose -f docker-compose.dev.yml up -d +``` + +Then run the Nest project itself use node version more than 20.x.x + +``` +npm i +npm run start:dev +``` -See [NOTES.md](./NOTES.md) for additional notes and information about the technical details of the project. +### Client + +Add your .env based on .env.example, then run the project: + +``` +npm i +npm run dev +``` ## License diff --git a/client/.env.example b/client/.env.example index d26ac25b..f6190c58 100644 --- a/client/.env.example +++ b/client/.env.example @@ -2,5 +2,6 @@ DOMAIN_NAME=xmrchat.com NUXT_PUBLIC_API_BASE_URL=https://api.xmrchat.com/api NUXT_PUBLIC_API_SERVER_SIDE_BASE_URL=http://backend:3000/api NUXT_PUBLIC_DEVTOOLS_ENABLED=false -PORT=3000 +NUXT_PUBLIC_IMAGE_BASE_URL= # base url from minio +PORT=3001 HOST=127.0.0.1 \ No newline at end of file diff --git a/client/.vscode/settings.json b/client/.vscode/settings.json deleted file mode 100644 index f8c18459..00000000 --- a/client/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "css.lint.unknownAtRules": "ignore", - "scss.lint.unknownAtRules": "ignore", - "i18n-ally.localesPaths": ["locales"] -} diff --git a/client/Dockerfile b/client/Dockerfile index 63f6fc06..70030b0e 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -1,26 +1,18 @@ # Dockerfile FROM node:lts-alpine3.19 AS builder -# create destination directory -RUN mkdir -p /usr/src/nuxt-app -WORKDIR /usr/src/nuxt-app - -# update and install dependency -RUN apk update && apk upgrade -RUN apk add git - -# copy the app, note .dockerignore -COPY . /usr/src/nuxt-app/ -COPY .env.example /usr/src/nuxt-app/.env -RUN npm install --No +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . RUN npm run build -EXPOSE 3000 -ENV DOMAIN_NAME=xmrchat.com -ENV NUXT_PUBLIC_API_BASE_URL=https://api.xmrchat.com/api -ENV NUXT_PUBLIC_API_SERVER_SIDE_BASE_URL=http://backend:3000/api -ENV PORT=3000 -ENV HOST=0.0.0.0 -CMD [ "node", "/usr/src/nuxt-app/.output/server/index.mjs" ] +FROM node:lts-alpine3.19 +WORKDIR /app +COPY --from=builder /app/.output /app/.output +COPY package*.json ./ +RUN npm install +EXPOSE 3000 +CMD ["node", ".output/server/index.mjs"] \ No newline at end of file diff --git a/client/app.vue b/client/app.vue index a20a9ac4..6a18de55 100644 --- a/client/app.vue +++ b/client/app.vue @@ -1,7 +1,8 @@ + + + + diff --git a/client/components/general/GeneralImage.vue b/client/components/general/GeneralImage.vue index fbceadf5..c2886ae3 100644 --- a/client/components/general/GeneralImage.vue +++ b/client/components/general/GeneralImage.vue @@ -1,7 +1,9 @@ diff --git a/client/components/obs/ObsMessage.vue b/client/components/obs/ObsMessage.vue new file mode 100644 index 00000000..cdf83a40 --- /dev/null +++ b/client/components/obs/ObsMessage.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/client/components/obs/ObsMessageHead.vue b/client/components/obs/ObsMessageHead.vue new file mode 100644 index 00000000..35602fe2 --- /dev/null +++ b/client/components/obs/ObsMessageHead.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/client/components/payment-modal/StreamerPaymentModal.vue b/client/components/payment-modal/StreamerPaymentModal.vue index 818f3499..4eca0ee0 100644 --- a/client/components/payment-modal/StreamerPaymentModal.vue +++ b/client/components/payment-modal/StreamerPaymentModal.vue @@ -1,5 +1,5 @@ +
There are no suggested amounts added, Click the button bellow to add new tiers. diff --git a/client/components/streamer/StreamerTipsList.vue b/client/components/streamer/StreamerTipsList.vue index 10ccb137..e0b1e490 100644 --- a/client/components/streamer/StreamerTipsList.vue +++ b/client/components/streamer/StreamerTipsList.vue @@ -1,9 +1,16 @@