Skip to content

Commit b2904fc

Browse files
authored
Merge pull request #4 from sa8ab/temp
Use Nest and Nuxt
2 parents a3d0435 + 236bc3e commit b2904fc

File tree

240 files changed

+15365
-10499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+15365
-10499
lines changed

README.md

Lines changed: 141 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,19 @@ XMRChat is a tip-for-chat application. Users can set up a page and have others s
2929
- [Server](#server)
3030
- [Client](#client)
3131

32+
- [Development](#development)
33+
3234
## <a name="tech-stack">Technology Stack 🚀</a>
3335

3436
- **Client Side:**
3537
- **Framework:** [Nuxt Js](https://nuxt.com/) - [Vue Js](https://vuejs.org/)
3638
- **Language:** [TypeScript](https://www.typescriptlang.org/)
3739
- **Server Side:**
3840

39-
- **Framework:** [Elysia Js](https://elysiajs.com/)
41+
- **Framework:** [Nest Js](https://nestjs.com/)
4042
- **Language:** [TypeScript](https://www.typescriptlang.org/)
41-
- **Runtime:** [Bun](https://bun.sh)
4243
- **Cache:** [Redis](https://redis.io/)
43-
- **ORM:** [Kysely](https://kysely.dev/)
44+
- **ORM:** [TypeORM](https://typeorm.io/)
4445
- **Database:** [PostgreSQL](https://www.postgresql.org/)
4546

4647
- **Infrastructure:**
@@ -50,7 +51,7 @@ XMRChat is a tip-for-chat application. Users can set up a page and have others s
5051

5152
- **Payment Providers:**
5253
- **Monero:**
53-
- [Monero Project](https://www.docker.com/)
54+
- [Monero Project](https://www.getmonero.com/)
5455
- wallet Server : [monero-lws](https://github.com/vtnerd/monero-lws)
5556

5657
## Business Strategy: <a name="payment-strategy">Payment</a>
@@ -60,24 +61,13 @@ The service uses a one-time payment strategy. During the deployment setup proces
6061
## <a name="requirements">Requirements 📝</a>
6162

6263
- [Docker 🐳](https://docs.docker.com/engine/install/)
63-
- [git](https://git-scm.com/downloads)
64-
- [Monero wallet](https://www.getmonero.org/downloads/#gui)
64+
- [Monero-lws Instance](https://github.com/vtnerd/monero-lws)
65+
- A Monero Wallet
6566

6667
## <a name="structure">Project Structure 📍</a>
6768

68-
- [Server](./server/): Contains the backend code.
69-
70-
- [db](./server/src/db/): Contains the database connection and migration files.
71-
- [routes](./server/src/routes/): Contains the route handlers.
72-
- [schemas](./server/src/schemas/): Contains the route schemas definitions for validation.
73-
- [services](./server/src/services/): Contains the service classes.
74-
- [types](./server/src/types/): Contains type definitions.
75-
- [utils](./server/src/utils/): Contains utility functions.
76-
- [env.ts](./server/src/env.ts): Contains the environment variables and their default values.
77-
- [index.ts](./server/src/index.ts): The entrypoint file for the backend.
78-
79-
- [Client](./client/): Contains the frontend code.
80-
- [Monero](./monero/): Contains Monero network services (Monero Project & Monero-LWS).
69+
- [Server](./server/): Contains the backend code ( Nest JS ).
70+
- [Client](./client/): Contains the frontend code ( Nuxt JS ).
8171
- [Traefik](./traefik/): Contains Traefik setups
8272

8373
## <a name="install-and-build">Install & Build 🛠️</a>
@@ -103,26 +93,116 @@ Now change the .env with yours and run the container.
10393
> 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.
10494
10595
```console
106-
docker compose up
96+
docker compose up -d
10797
```
10898

109-
### <a name="monero">2. Monero</a>
99+
### <a name="monero">2.1. Monero</a>
110100

111-
You can use Make file by below command in Monero directory to get and config Monero related repositories.
101+
Create and run a monero node. If you already have a synced node with zmq enabled skip to next step.
112102

113103
```console
114-
cp monero
115-
make monero-setup
104+
mkdir monero && cd monero
105+
git clone https://github.com/monero-project/monero.git
116106
```
117107

118-
or:
108+
In last line of Dockerfile comment out CMD Command.
109+
110+
```
111+
# CMD ["--p2p-bind ...
112+
```
113+
114+
### <a name="monero-lws">2.2 Monero-LWS</a>
115+
116+
Clone Monero-lws repository on branch `release-v0.3_0.18`:
119117

120118
```console
121-
cp monero
122-
git clone https://github.com/monero-project/monero.git
123-
git clone https://github.com/vtnerd/monero-lws/tree/release-v0.3_0.18
124-
cp Dockerfile.monero ./monero/Dockerfile
125-
cp Dockerfile.lws ./monero-lws/Dockerfile
119+
git clone -b release-v0.3_0.18 https://github.com/vtnerd/monero-lws
120+
```
121+
122+
From last line of Dockerfile remove ENTRYPOINT and CMD and replace it with only `ENTRYPOINT ["monero-lws-daemon"]`
123+
124+
Final Dockerfile will be ending like this:
125+
126+
```console
127+
...
128+
EXPOSE 8443
129+
130+
ENTRYPOINT ["monero-lws-daemon"]
131+
```
132+
133+
### <a name="monero-lws">2.3. Run Monero and Monero-LWS</a>
134+
135+
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
136+
137+
```yml
138+
services:
139+
monero:
140+
container_name: monero
141+
build:
142+
context: ./monero
143+
restart: always
144+
user: root
145+
ports:
146+
# - :80
147+
- :18080
148+
- :18081
149+
- :18082
150+
- :18083
151+
- :18084
152+
command:
153+
- --p2p-bind-ip=0.0.0.0
154+
- --p2p-bind-port=18080
155+
- --rpc-bind-ip=0.0.0.0
156+
- --rpc-bind-port=18081
157+
- --non-interactive
158+
- --rpc-ssl=disabled
159+
- --rpc-access-control-origins=monero
160+
- --disable-rpc-ban
161+
- --confirm-external-bind
162+
- --zmq-pub=tcp://0.0.0.0:18084
163+
- --zmq-rpc-bind-port=1882
164+
- --zmq-rpc-bind-ip=0.0.0.0
165+
166+
volumes:
167+
- bitmonero:/root/.bitmonero
168+
networks:
169+
- traefik
170+
171+
lws:
172+
depends_on:
173+
- monero
174+
container_name: lws
175+
user: root
176+
build:
177+
context: ./monero-lws
178+
restart: always
179+
ports:
180+
# - :80
181+
- :8443
182+
command:
183+
- --db-path=/home/monero-lws/.bitmonero/light_wallet_server
184+
- --daemon=tcp://monero:1882
185+
- --sub=tcp://monero:18084
186+
- --log-level=4
187+
- --webhook-ssl-verification=none
188+
- --disable-admin-auth
189+
- --admin-rest-server=http://0.0.0.0:8443/admin
190+
- --rest-server=http://0.0.0.0:8443/basic
191+
- --access-control-origin=lws:8443
192+
- --confirm-external-bind
193+
volumes:
194+
- monerolws:/home/monero-lws
195+
networks:
196+
- traefik
197+
198+
volumes:
199+
bitmonero: {}
200+
monerolws: {}
201+
202+
networks:
203+
traefik:
204+
name: traefik
205+
external: true
126206
```
127207
128208
Run the container :
@@ -143,7 +223,7 @@ After it is synced and ready, go next.
143223

144224
```console
145225
cd server
146-
cp .env.example
226+
cp .env.example .env
147227
```
148228

149229
Change .env file with yours.
@@ -156,18 +236,44 @@ docker compose up -d
156236

157237
```console
158238
cd client
159-
cp .env.example
239+
cp .env.example .env
160240
```
161241

162-
Change .env file with yours. and also change the env at the end of "Dockerfile" file.
242+
Change .env file with yours.
163243

164244
```console
165245
docker compose up -d
166246
```
167247

168-
## Notes
248+
## <a name="development">Development</a>
249+
250+
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.
251+
252+
### Server
253+
254+
Add your .env file based on .env.example.
255+
256+
Run backend locally with docker-compose.dev.yml file
257+
258+
```console
259+
docker compose -f docker-compose.dev.yml up -d
260+
```
261+
262+
Then run the Nest project itself use node version more than 20.x.x
263+
264+
```
265+
npm i
266+
npm run start:dev
267+
```
169268

170-
See [NOTES.md](./NOTES.md) for additional notes and information about the technical details of the project.
269+
### Client
270+
271+
Add your .env based on .env.example, then run the project:
272+
273+
```
274+
npm i
275+
npm run dev
276+
```
171277

172278
## License
173279

client/.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ DOMAIN_NAME=xmrchat.com
22
NUXT_PUBLIC_API_BASE_URL=https://api.xmrchat.com/api
33
NUXT_PUBLIC_API_SERVER_SIDE_BASE_URL=http://backend:3000/api
44
NUXT_PUBLIC_DEVTOOLS_ENABLED=false
5-
PORT=3000
5+
NUXT_PUBLIC_IMAGE_BASE_URL= # base url from minio
6+
PORT=3001
67
HOST=127.0.0.1

client/.vscode/settings.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

client/Dockerfile

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
# Dockerfile
22
FROM node:lts-alpine3.19 AS builder
33

4-
# create destination directory
5-
RUN mkdir -p /usr/src/nuxt-app
6-
WORKDIR /usr/src/nuxt-app
7-
8-
# update and install dependency
9-
RUN apk update && apk upgrade
10-
RUN apk add git
11-
12-
# copy the app, note .dockerignore
13-
COPY . /usr/src/nuxt-app/
14-
COPY .env.example /usr/src/nuxt-app/.env
15-
RUN npm install --No
4+
WORKDIR /app
5+
COPY package*.json ./
6+
RUN npm install
7+
COPY . .
168
RUN npm run build
179

18-
EXPOSE 3000
1910

20-
ENV DOMAIN_NAME=xmrchat.com
21-
ENV NUXT_PUBLIC_API_BASE_URL=https://api.xmrchat.com/api
22-
ENV NUXT_PUBLIC_API_SERVER_SIDE_BASE_URL=http://backend:3000/api
23-
ENV PORT=3000
24-
ENV HOST=0.0.0.0
25-
CMD [ "node", "/usr/src/nuxt-app/.output/server/index.mjs" ]
11+
FROM node:lts-alpine3.19
12+
WORKDIR /app
13+
COPY --from=builder /app/.output /app/.output
14+
COPY package*.json ./
15+
RUN npm install
2616

17+
EXPOSE 3000
18+
CMD ["node", ".output/server/index.mjs"]

client/app.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<script setup lang="ts">
22
useHead(() => {
33
return {
4-
titleTemplate: (title) => (title ? `${title} | XMRChat` : "XMRChat"),
4+
titleTemplate: (title) =>
5+
title ? `${title} | XMRChat` : "Monero Superchats : XMRChat",
56
};
67
});
78
@@ -19,6 +20,6 @@ useAppSeoMeta();
1920

2021
<style>
2122
.app {
22-
@apply text-text bg-background;
23+
@apply text-text;
2324
}
2425
</style>

client/components/Home/HomeFAQ.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,15 @@ const linkProps = { padded: false, target: "_blank", variant: "link" } as any; /
172172
<ul class="list">
173173
<li>
174174
<p>
175-
If you already have crypto, trade for Monero (XMR) at
175+
Buy or trade other crypto for Monero in
176+
<UButton to="https://cakewallet.com" v-bind="linkProps">
177+
Cake Wallet</UButton
178+
>.
179+
</p>
180+
</li>
181+
<li>
182+
<p>
183+
Trade other crypto for Monero (XMR) at
176184
<UButton to="https://stealthex.io" v-bind="linkProps">
177185
stealthex.io</UButton
178186
>
@@ -224,9 +232,9 @@ const linkProps = { padded: false, target: "_blank", variant: "link" } as any; /
224232
</li>
225233
<li>
226234
<p>
227-
Buy Monero with fiat, without KYC as an Executor at
228-
<UButton to="https://monezon.com" v-bind="linkProps">
229-
monezon.com </UButton
235+
Create a Monero Fundraiser at
236+
<UButton to="https://kuno.anne.media/" v-bind="linkProps">
237+
kuno.anne.media </UButton
230238
>.
231239
</p>
232240
</li>

client/components/Home/HomeHero.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const { toStreamerDisplay } = useRouteLocation();
66
<div class="home-hero">
77
<div class="image-side">
88
<img
9-
class="w-full rounded-md overflow-hidden"
10-
src="/images/home-hero-2.jpg"
9+
class="w-full rounded-md overflow-hidden border-border border-2"
10+
src="/images/home-hero-3.png"
1111
alt=""
1212
/>
1313
</div>

0 commit comments

Comments
 (0)