Skip to content

Commit

Permalink
update README and Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
cauta committed Jun 4, 2024
1 parent 20e6e70 commit b80f2eb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 106 deletions.
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)
16 changes: 5 additions & 11 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,16 @@ default: up
help : Makefile
@sed -n 's/^##//p' $<

.PHONY: up
up:
.PHONY: up dev
up-dev:
@echo "Building application and starting container..."
docker compose -f docker-compose-dev.yml up

.PHONY: build
build:
.PHONY: build dev
build-dev:
@echo "Re-building container and installing dependancies..."
docker compose -f docker-compose-dev.yml down && TARGET=development docker compose -f docker-compose-dev.yml build --no-cache && docker compose -f docker-compose-dev.yml up

.PHONY: up-silent
up-silent:
@echo "Building application and starting container in background mode..."
docker compose -f docker-compose-dev.yml up -d

.PHONY: log
log:
@echo "Building application and starting container in background mode..."
Expand All @@ -58,7 +53,7 @@ down:
@docker compose -f docker-compose-dev.yml down

.PHONY: stop
stop:
stop-dev:
@echo "Stopping containers for onebox..."
@docker compose -f docker-compose-dev.yml stop

Expand All @@ -83,7 +78,6 @@ db:
.PHONY: up
up:
# @echo "Init environment..."
# sudo certbot certonly --standalone -d $API_DOMAIN -m $EMAIL
@echo "Building application and starting container..."
docker compose --env-file docker/.env -f docker/docker-compose.yml up -d

Expand Down

0 comments on commit b80f2eb

Please sign in to comment.