Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darrylmorley/guntrader-api-sync
A Bun.js application for syncing advert data from Guntrader API and managing images with S3 compatible storage.
https://github.com/darrylmorley/guntrader-api-sync
Last synced: about 2 months ago
JSON representation
A Bun.js application for syncing advert data from Guntrader API and managing images with S3 compatible storage.
- Host: GitHub
- URL: https://github.com/darrylmorley/guntrader-api-sync
- Owner: darrylmorley
- Created: 2024-09-06T14:40:12.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-12T15:34:21.000Z (4 months ago)
- Last Synced: 2024-09-13T14:08:37.731Z (4 months ago)
- Language: TypeScript
- Size: 356 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Guntrader API Sync
A Bun application that syncs your advert data from the Guntrader API, stores it in a Postgresql database, and manages images by uploading them to to any S3 compatible storage. The application uses a cron job to update the database periodically and ensures that obsolete data is removed, including deleting related images from storage.
## Features
- Fetches gun data from the Guntrader API.
- Upserts gun records into a database using Prisma.
- Uploads gun images to DigitalOcean Spaces.
- Deletes old/obsolete guns and corresponding images from both the database and DigitalOcean.
- Runs periodically using `node-cron`.## Install
Clone this repository.
Install dependencies:
```sh
bun install
```To run:
```sh
bun run dev
```Provide the following env variables in your own .env file:
### Guntrader API key
GUNTRADER_API_KEY=your_guntrader_api_key
### DigitalOcean Spaces credentials
- S3_ACCESS_KEY=your_S3_access_key
- S3_SECRET_KEY=your_S3_secret_key
- S3_SPACE_NAME=your_space_name
- S3_REGION=your_space_region
- S3_ENDPOINT=your_s3_endpoint### Database credentials
DATABASE_URL=postgresql://username:password@localhost:5432/dbname