koperasi/README.md
2025-08-08 14:12:40 +07:00

2.4 KiB

koperasi

Getting started

Wallet Service

Configuration

Create database postgresql with name wallet

Open new terminal in services/wallet directory

Instalation dependencies

npm install

Copy .env.example to .env

cp .env.example .env

Set your database configuration in .env

generate secret key for API_KEY with command

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Note: API_KEY Backend Service and Wallet Service must be the same

Run project

Migration database

npm run migrate:fresh

Run project

npm run dev

Smart Contract Service

Configuration

Open new terminal in services/smartcontract directory

Instalation dependencies

npm install

Run project

Run localhost network hardhat (network blockchain for development)

npx hardhat node

Open new terminal again in services/smartcontract directory

Deploy

npx hardhat ignition deploy ./ignition/modules/Deploy.ts --network localhost

Backend Service

Configuration

Create database postgresql with name koperasi

Open new terminal in services/backend directory

Instalation dependencies

npm install

Copy .env.example to .env

cp .env.example .env

Set your database configuration in .env

generate secret key for JWT_SECRET with command

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Set contractABI.json with contract abi after compile contract

set PRIVATE_KEY=" " with private key wallet blockchain

Set CONTRACT_ADDRESS=" " with contract address after deploy contract

Run project

Migration database

npm run migrate:fresh

Seed fake data

npm run db:seed

Run project

npm run dev

Frontend Service

Configuration

Open new terminal in services/frontend directory

Instalation dependencies

npm install

Copy .env.example to .env

cp .env.example .env

set API_BASE_URL with backend service url example: API_BASE_URL=http://localhost:3000

generate SECRET_COOKIE_PASSWORD with command

openssl rand -base64 32

Run project

Run project

npm run dev

Import Postman Collection

create new workspace in postman

extract api-docs/postman-koperasi-blockchain.zip

import postman collection and environment in directory postman-koperasi-blockchain to your postman