Skip to content

AndresImach/benefits-fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Benefits Fetcher

This project is a Node.js application that fetches benefits and discounts from various Argentine banks and stores them in MongoDB. It also provides a REST API to access the collected data.

Features

  • Fetches benefits from multiple banks:
    • BBVA
    • Banco Ciudad
    • ICBC
    • Banco Santander
    • Supervielle
    • Personal
  • Stores data in MongoDB
  • Provides REST API endpoints
  • Rate limiting and retry mechanism
  • CORS enabled

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB
  • pnpm (recommended) or npm

Installation

  1. Clone the repository:
git clone https://github.com/AndresImach/benefits-fetcher.git
cd benefits-fetcher
  1. Install dependencies:
pnpm install
# or using npm
npm install
  1. Create a .env file in the root directory with the following variables:
MONGO_URL=your_mongodb_connection_string
PORT=3000

Usage

Starting the API Server

npm start

The server will start on port 3000 (or the port specified in your .env file).

Available Endpoints

  • GET /api/benefits - Get benefits from all banks
  • GET /api/benefits/:bank - Get benefits from a specific bank (e.g., /api/benefits/bbva)

Running Individual Bank Fetchers

To fetch benefits from a specific bank:

node src/[BankName]/fetcher.js

Example:

node src/BBVA/fetcher.js

Project Structure

  • src/server.js - Main API server
  • src/[BankName]/fetcher.js - Individual bank fetchers
  • src/[BankName]/test.js - Test files for bank fetchers

Deployment

This application is deployed on Vercel. To deploy your own instance:

Using Vercel (Current Method)

  1. Install Vercel CLI:
npm i -g vercel
  1. Login to Vercel:
vercel login
  1. Deploy the application:
vercel
  1. Add environment variables in Vercel Dashboard:
    • Go to your project settings
    • Add MONGO_URL with your MongoDB connection string

The deployment is configured via vercel.json in the root directory.

Alternative Deployment Methods

  1. Create an account on Railway
  2. Connect your GitHub repository
  3. Add the following environment variables in Railway:
    • MONGO_URL: Your MongoDB connection string
    • PORT: 3000 (Railway will automatically assign a port)
  4. Deploy the application

Using Render

  1. Create an account on Render
  2. Create a new Web Service
  3. Connect your GitHub repository
  4. Set the following:
    • Build Command: npm install
    • Start Command: npm start
  5. Add environment variables:
    • MONGO_URL: Your MongoDB connection string
    • PORT: 3000

Using Heroku

  1. Install Heroku CLI
  2. Login to Heroku:
heroku login
  1. Create a new Heroku app:
heroku create your-app-name
  1. Add environment variables:
heroku config:set MONGO_URL=your_mongodb_connection_string
  1. Deploy:
git push heroku main

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

License

ISC

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors