A platform that allows users to set up webhooks for blockchain transactions and store the data in their PostgreSQL database.
- User authentication (login/register)
- PostgreSQL database connection setup
- Webhook creation for blockchain transactions
- Real-time transaction data storage
- Webhook management (view/delete)
- Support for multiple transaction types:
- Transfers
- NFT Bids
- Frontend: Next.js with TypeScript and Tailwind CSS
- Backend: Node.js with Express and TypeScript
- Database: PostgreSQL with Prisma ORM
- Blockchain Integration: Helius API
- Authentication: JWT-based authentication
- Node.js (v18 or higher)
- PostgreSQL database
- Helius API key
- npm or yarn package manager
- Create a
.envfile in theapps/apidirectory:
cd apps/api
cp .env.example .envcd apps/web
cp .env.example .envcd packages/database
cp .env.example .env- Update the
.envfile with your actual values:
# Backend
DATABASE_URL="postgresql://username:password@localhost:5432/dbname"
JWT_SECRET="your-jwt-secret"
HELIUS_API_KEY="your-helius-api-key" #login to helius get api key
NEXT_PUBLIC_BACKEND_URL="http://localhost:5000" #add ngrok instance, used to create helius webhook
# Frontend
NEXT_PUBLIC_BACKEND_URL="http://localhost:5000"DATABASE_URL="postgres://postgres:mysecretpassword@localhost:5433/postgres"Note: The .env.example file serves as a template showing required environment variables. Never commit your actual .env file to version control as it contains sensitive information.
blockchain_indexing_platform/
├── apps/
│ ├── api/ # Backend API
│ │ ├── src/
│ │ │ ├── routes/ # API routes
│ │ │ ├── services/ # Business logic
│ │ │ ├── lib/ # Utilities and configurations
│ │ │ └── middleware/ # Authentication middleware
│ │ ├── prisma/ # Prisma schema and migrations
│ │ └── package.json
│ └── web/ # Frontend application
│ ├── app/ # Next.js app directory
│ └── package.json
└── README.md
- Clone the repository:
git clone https://github.com/yourusername/blockchain_indexing_platform.git
cd blockchain_indexing_platform- Install dependencies for both frontend and backend:
# Install backend dependencies
cd apps/api
cp .env .env.example
npm install
# Install frontend dependencies
cd ../web
cp .env .env.example
npm installEnter variables values in .env 3. Set up Prisma:
# Navigate to the backend directory
cd packages/database
cp .env .env.example
# Install Prisma CLI
npm install
# After setting up your schema, generate Prisma Client
npx prisma generate
# Create and apply migrations
npx prisma db push
The project uses the following Prisma schema:
// apps/api/prisma/schema.prisma
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
email String @unique
password String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
postgresConnections PostgresConnection[]
webhooks Webhook[]
}
model PostgresConnection {
id Int @id @default(autoincrement())
host String
port Int
database String
username String
password String
userId Int
user User @relation(fields: [userId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Webhook {
id Int @id @default(autoincrement())
webhookId String @unique
walletAddress String
transactionTypes String[]
userId Int
user User @relation(fields: [userId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}1.Backend Ngrok Setup:
Install ngrok login and add your token, after that run
ngrok http http://localhost:5000- Fill the values of env variables.
- Start the application:
npm run dev- Run Prisma Studio:
cd packages/database
npm run studioThe application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
-
Registration/Login
- Visit http://localhost:3000
- Create a new account or login with existing credentials
-
Setting up Database Connection
- After logging in, you'll be redirected to the dashboard
- Enter your PostgreSQL database details:
- Host
- Port
- Database Name
- Username
- Password
-
Creating Webhooks
- Enter the wallet address you want to monitor
- Select transaction types to track (Transfer, NFT Bids)
- Click "Setup Connection & Webhook"
-
Managing Webhooks
- View all your webhooks on the dashboard
- Delete webhooks as needed
- Monitor transaction data in your PostgreSQL database
POST /api/auth/register- Register a new userPOST /api/auth/login- Login user
POST /api/postgres/connections- Create new database connectionGET /api/postgres/connections/:id/tables- Get available tablesGET /api/postgres/connections/:id/tables/:table/data- Get table data
POST /api/helius/create-webhook- Create new webhookGET /api/helius/webhooks- Get user's webhooksDELETE /api/helius/webhook/:id- Delete webhookPOST /api/helius/webhook-handler- Data coming from helius is handled by this api, to make this work in local, run it on ngrok.
- All API endpoints are protected with JWT authentication
- Database credentials are stored securely
- Webhook data is validated before processing
- HTTPS is recommended for production
- Prisma provides type safety and query validation
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- User Postgres table connection with sockets to show user data.
- Supporting more events from webhook in helius.
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue in the GitHub repository or contact the maintainers.