This tool helps us deliver quick solutions to merchants without an infrastructure overhead. We can import data from Rutter API into MongoDB, supporting transactions, orders, and payouts.
-
Install Bun runtime environment
curl -fsSL https://bun.sh/install | bash
-
Clone the repository
-
Install dependencies:
bun install
-
Create a
.envfile based on.env.example:cp .env.example .env
-
Configure your environment variables in
.envwith your specific values:MONGODB_URI: Your MongoDB connection stringTRANSACTIONS_RUTTER_ACCESS_TOKEN: Access token for transactions (get from rutter)ORDERS_RUTTER_ACCESS_TOKEN: Access token for orders (get from rutter)PAYOUTS_RUTTER_ACCESS_TOKEN: Access token for payouts (get from rutter)RUTTER_CLIENT_ID: Rutter API Client ID (get from rutter)RUTTER_CLIENT_SECRET: Rutter API Client Secret (get from rutter)RUTTER_API_VERSION: Rutter API version (get from rutter)
-
Open
src/import/index.ts -
Comment/uncomment the import functions you want to run:
importTransactions().catch(console.error); //importOrders().catch(console.error); //importPayouts().catch(console.error);
-
Run the import:
bun run import
When creating new files that interact with the database, remember to:
-
Import the database initialization at the top of your file:
import { initializeDB } from "../db";
-
Initialize the database connection before performing operations:
await initializeDB();
See .env.example for all required environment variables. Make sure to set all required variables before running the application.