Skip to content

JdeepReactDev/fastify-demo-backend

Repository files navigation

SignatureRx Prescription Management Backend

A Fastify-based backend service for managing prescriptions with SignatureRx API integration.

Features

  • OAuth2 Authentication: Client credentials flow with automatic token caching and refresh
  • Prescription Management: Issue prescriptions via SignatureRx API with retry logic
  • Webhook Processing: Receive and process SignatureRx webhook events
  • Database Integration: MongoDB for storing prescriptions and webhook logs
  • Error Handling: Comprehensive error handling with structured responses
  • Rate Limiting: Built-in rate limiting and security features

Quick Start

  1. Install Dependencies

    npm install
  2. Environment Setup

    cp env.example .env
    # Edit .env with your SignatureRx credentials
  3. Start Development Server

    npm run dev
  4. Test Endpoints

    node test-endpoints.js

API Endpoints

Authentication

  • POST /api/v1/auth/token - Get OAuth2 token
  • GET /api/v1/auth/test-connection - Test SignatureRx connection
  • GET /api/v1/auth/token-status - Get token cache status

Prescriptions

  • POST /api/v1/prescriptions/issue - Issue prescription
  • GET /api/v1/prescriptions/{id}/status - Get prescription status
  • GET /api/v1/prescriptions/medicines - Get available medicines
  • GET /api/v1/prescriptions/patient/mock - Get mock patient data

Webhooks

  • POST /api/v1/webhooks/signaturerx - Receive SignatureRx webhooks
  • GET /api/v1/webhooks/logs - Get webhook logs
  • GET /api/v1/webhooks/stats/overview - Get webhook statistics

Architecture

src/
├── app.ts                 # Main Fastify application
├── server.ts              # Server startup
├── config/                # Configuration files
├── controllers/           # Request handlers
├── services/              # Business logic
├── models/                # Database models
├── dao/                   # Data access objects
├── route/                 # API routes
└── utils/                 # Utility functions

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published