Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #62

Merged
merged 9 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ jobs:
yarn && yarn build

- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login registry.gitlab.com -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: Build and push Onebox Docker image
run: |
cd app
docker build -f apps/onebox/Dockerfile --target production -t registry.gitlab.com/cauta/onebox:master .
docker push registry.gitlab.com/cauta/onebox:master
docker build -f apps/onebox/Dockerfile --target production -t crypitor/onebox:master .
docker push crypitor/onebox:master

- name: Build and push Monitor Docker image
run: |
cd app
docker build -f apps/monitor-service/Dockerfile --target production -t registry.gitlab.com/cauta/crypitor-monitor:master .
docker push registry.gitlab.com/cauta/crypitor-monitor:master
docker build -f apps/monitor-service/Dockerfile --target production -t crypitor/crypitor-monitor:master .
docker push crypitor/crypitor-monitor:master

- name: Build and push Worker Docker image
run: |
cd app
docker build -f apps/worker-service/Dockerfile --target production -t registry.gitlab.com/cauta/crypitor-worker:master .
docker push registry.gitlab.com/cauta/crypitor-worker:master
docker build -f apps/worker-service/Dockerfile --target production -t crypitor/crypitor-worker:master .
docker push crypitor/crypitor-worker:master
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ jobs:
yarn && yarn build

- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login registry.gitlab.com -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: Build and push Onebox Docker image
run: |
cd app
VERSION=$(jq -r '.version' package.json)
docker build -f apps/onebox/Dockerfile --target production -t registry.gitlab.com/cauta/onebox:${VERSION} -t registry.gitlab.com/cauta/onebox:latest .
docker push registry.gitlab.com/cauta/onebox:${VERSION}
docker push registry.gitlab.com/cauta/onebox:latest
docker build -f apps/onebox/Dockerfile --target production -t crypitor/onebox:${VERSION} -t crypitor/onebox:latest .
docker push crypitor/onebox:${VERSION}
docker push crypitor/onebox:latest

- name: Build and push Monitor Docker image
run: |
cd app
VERSION=$(jq -r '.version' package.json)
docker build -f apps/monitor-service/Dockerfile --target production -t registry.gitlab.com/cauta/crypitor-monitor:${VERSION} -t registry.gitlab.com/cauta/crypitor-monitor:latest .
docker push registry.gitlab.com/cauta/crypitor-monitor:${VERSION}
docker push registry.gitlab.com/cauta/crypitor-monitor:latest
docker build -f apps/monitor-service/Dockerfile --target production -t crypitor/crypitor-monitor:${VERSION} -t crypitor/crypitor-monitor:latest .
docker push crypitor/crypitor-monitor:${VERSION}
docker push crypitor/crypitor-monitor:latest

- name: Build and push Worker Docker image
run: |
cd app
VERSION=$(jq -r '.version' package.json)
docker build -f apps/worker-service/Dockerfile --target production -t registry.gitlab.com/cauta/crypitor-worker:${VERSION} -t registry.gitlab.com/cauta/crypitor-worker:latest .
docker push registry.gitlab.com/cauta/crypitor-worker:${VERSION}
docker push registry.gitlab.com/cauta/crypitor-worker:latest
docker build -f apps/worker-service/Dockerfile --target production -t crypitor/crypitor-worker:${VERSION} -t crypitor/crypitor-worker:latest .
docker push crypitor/crypitor-worker:${VERSION}
docker push crypitor/crypitor-worker:latest
122 changes: 27 additions & 95 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
# New Project Guidelines
# Crypitor: High-Performance Real-Time Blockchain Activities Monitoring
Welcome to Crypitor, a cutting-edge platform designed for high-performance, real-time monitoring of blockchain activities. Our mission is to provide developers, businesses, and enthusiasts with the tools they need to stay updated on blockchain transactions and events across various networks.

This is a boilerplate repository for creating a new Docker project using Node, NestJS, React, Mongo, Material-UI along with quick start commands (check Makefile/ReadMe).

Best practices have been used and implemented to my knowledge to ensure the longevity of this project. For example a multi-database architecture is being used to distribute the load to the databases. Encourage pull requests for improving the workflow and processes + maintenance updates.

This project includes the bare minimum for authentication and authorization e.g: a user is able to create an account and sign-in (with password hashing, form validation on front-end).

Step debugging through VS Code is enabled and launch.json provided (see below).
# Key Features

- Real-Time Monitoring: Instantly receive notifications for blockchain activities and transactions as they happen.
- Multi-Network Support: Seamlessly create monitors across multiple blockchain networks.
- Comprehensive Coverage: Support for native transfers, ERC20, and ERC721 tokens.
- Webhook Integration: Effortlessly integrate with your existing systems using our robust webhook endpoint.
- Retry System: Ensure reliable data delivery with our webhook retry mechanism.
## Dependancies

The following dependancies have been added to improve developer workflow and build the application.

* **Docker** Docker is a containerization software.
* **MongoDB** MongoDB database.
* **Nest.js** Nest (NestJS) is a framework for building efficient, scalable Node.js server-side applications.
* **React JS** Core front-end technology
* **Material UI** Component library
* **Apache Kafka** Apache Kafka is a distributed streaming platform for real-time data processing.

## Getting started

Clone the repository, **change all references to {PROJECT_NAME} in all files (do find and replace)**, also ensure project name matches the root directory name Eg: docker-compose.yml, Makefile, .env files (client/app) etc..

```bash
git clone https://github.com/jaybabak/docker-nestjs-mongodb-react-typescript-starter-kit
git clone https://github.com/crypitor/blockchain-webhook
```

**Update .env files** for both client and app.
Expand All @@ -33,48 +32,41 @@ Change directory.
```bash
cd /app
```

Install Nest.js CLI globally
Install node_modules.

```bash
npm i -g @nestjs/cli
yarn install
```
## Build back-end Docker containers (server, db etc..)

Run the following command to install the dependancies, make sure to be inside the "app" directory.

```bash
npm install
```
Run the following command to build the containers and start the development environment, make sure to be inside the "app" directory.
Install Nest.js CLI globally

```bash
make up
yarn global add @nestjs/cli
```
Run the container and Nest.js development environment in quiet/silent mode (not recommended for local development, this hides the console output).

Start docker dependencys.
```bash
make up-silent
make up-deps
```

## Build the React front-end (client)

In a new terminal window, change directory to "client" folder.

Start the application.
```bash
cd /client
yarn start:dev onebox
yarn start:dev monitor-service
yarn start:dev worker-service
```
Visit back-end [http://localhost:3002](http://localhost:3002).

Run the following command to install the dependancies, make sure to be inside the "client" directory.
## Start Docker containers (server, db etc..)
**Update .env files** for docker.
Run the following command to build the containers and start the development environment, make sure to be inside the "app" directory.

```bash
npm install
cd docker
docker compose up -d
```
Run the following command to build the containers and start the development environment, make sure to be inside the "client" directory.

```bash
make up
```
access http://localhost

## MongoDB

Expand All @@ -99,64 +91,4 @@ mongodb://{PROJECT_NAME}:{PROJECT_NAME}@mongo:27017/?directConnection=true&serve

## View the app

Visit back-end [http://localhost:3002](http://localhost:3002).

Visit front-end [http://localhost:3000](http://localhost:3000).

## Optional

Update /etc/hosts (mac) if you want to use a custom development domain with the following:

```bash
localhost:3000 my-site.dev
```

## VS Code Launch.json config file

```
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"address": "localhost",
"name": "Debug NestJS in Docker",
"port": 9229,
"remoteRoot": "/usr/src/app",
"sourceMaps": true,
"restart": true,
"localRoot": "${workspaceFolder}/app",
}
]
}
```

## Available Commands (app)

| Command | Description |
|--|--|
| help | Prints the help screen. |
| up | Builds the application container and starts it with logging. |
| build | Rebuilds the application container and starts it with logging. |
| up-silent | Builds the application container and starts it in background mode, no active logging. |
| down | Stops and removes the docker containers. |
| stop | Stops the running containers. |
| shell | SSH into the main app container. |
| shell-db | SSH into the MongoDB container with mongosh |
| db | Get the MongoDB connection string |

## Help

To get a list of all available commands

```bash
make help
```

## Additional documentation

[Click Here](https://github.com/jaybabak/onebox/tree/main/app)
76 changes: 0 additions & 76 deletions app/.env

This file was deleted.

Loading