PairTracker Backend is a backend service designed to monitor and track Automated Market Maker (AMM) pairs on various blockchain networks. It provides real-time updates and stores relevant data in a PostgreSQL database using Prisma ORM.
- Features
- Technologies Used
- Setup and Installation
- Environment Variables
- Scripts
- API Endpoints
- Database Schema
- Contributing
- License
- Real-time tracking of AMM pairs on EVM, Solana, and so on.
- WebSocket support for live updates.
- REST API for accessing AMM and network data.
- Prisma ORM for database interactions.
- TypeScript for type-safe development.
- Node.js: JavaScript runtime environment.
- Express: Web framework for Node.js.
- Socket.io: Real-time, bidirectional communication.
- Prisma: Next-generation ORM for Node.js and TypeScript.
- TypeScript: Typed superset of JavaScript.
- PostgreSQL: Relational database management system.
- Web3: JavaScript API for interacting with the blockchain.
-
Clone the repository:
git clone https://github.com/yourusername/pairtracker-backend.git cd pairtracker-backend
-
Install dependencies:
npm install
-
Set up the database:
Ensure you have a PostgreSQL database running. Update the
DATABASE_URL
in the.env
file with your database connection string. -
Run database migrations:
npx prisma migrate dev
-
Start the development server:
npm run dev
Create a .env
file in the root directory and add the following variables:
PORT=4000
DATABASE_URL=your_database_url
npm run dev
: Starts the development server with hot-reloading.npm run raydium
: Starts the Raydium listener script for the test purpose.npm run pancake
: Starts the PancakeSwap listener script for the test purpose.
- GET /: Returns a welcome message.
- GET /amms: Retrieves a list of all AMMs.
- POST /networks: Adds a new network.
- GET /swap-pairs/:ammId: Retrieves swap pairs for a specific AMM.
The database schema is defined using Prisma. Key models include:
- Network: Represents a blockchain network.
- AMM: Represents an Automated Market Maker.
- Token: Represents a token on a network.
- SwapPair: Represents a pair of tokens in an AMM.
- PairDetail: Stores details about a swap pair.
- TransactionHistory: Records transaction history for swap pairs.
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.
This project is licensed under the ISC License. See the LICENSE file for details.