npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fakebank

v2.0.0

Published

Fakebank services using Apollo GraphQL Server and Federation, Express, REST, Faker - TypeScript

Downloads

14

Readme

fakebank

Fakebank services using Apollo GraphQL Server and Federation, Express, REST, Faker - TypeScript

  • GraphQL
    • "GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data."
  • GraphQL-JS
    • "A reference implementation of GraphQL for JavaScript"
  • Apollo Server
    • "Apollo Server is an open-source, spec-compliant GraphQL server that's compatible with any GraphQL client"
  • Apollo Federation
    • "... expose a single data graph that provides a unified interface for querying all of your backing data sources"
  • Apollo REST Data Source
    • "This package exports a (RESTDataSource) class which is used for fetching data from a REST API and exposing it via GraphQL within Apollo Server."
  • Apollo Gateway (sits above other GraphQL services)
  • GraphQL DataLoader
    • "DataLoader is a generic utility to be used as part of your application's data fetching layer to provide a consistent API over various backends and reduce requests to those backends via batching and caching."
    • improve performance of GraphQL service
  • Express
    • "Fast, unopinionated, minimalist web framework for node"
    • Create an HTTP service quickly
  • Faker
    • "generate massive amounts of realistic fake data in Node.js and the browser"
    • helps create random/mock data

List of core REST services

  • rest-auth (http://localhost:10111)
    • manages login actions, user records
  • rest-accounts (http://localhost:10222)
    • manages bank accounts and transactions
  • rest-payments (http://localhost:10333)
    • manages money transfers

List of GraphQL services using Core REST services

  • gql-fed-auth (http://localhost:20111)
    • uses rest-auth
  • gql-fed-accounts (http://localhost:20222)
    • uses rest-accounts
  • gql-fed-payments (http://localhost:20333)
    • uses rest-payments

Standard GraphQL service using Core REST services

  • gql-standard (http://localhost:30111)
    • uses rest-auth
    • uses rest-accounts
    • uses rest-payments

GraphQL Gateway service

  • gql-gateway (http://localhost:40111)
    • uses gql-fed-auth
    • uses gql-fed-accounts
    • uses gql-fed-payments

Sample sequence diagrams

Use sequencediagram.org

A. GraphQL Standard

title Fake Bank APIs with GraphQL Standard
app->api-gateway: request
api-gateway->gql-standard: request
gql-standard --> rest-X: request a
rest-X -> db-X: select data a
rest-X <- db-X: records a
gql-standard <- rest-X: response a
gql-standard --> rest-Y: request b
rest-Y -> db-Y: select data b
rest-Y <- db-Y: records b
gql-standard <- rest-Y: response b
api-gateway <- gql-standard: response
app <- api-gateway: response

B. GraphQL Gateway

title Fake Bank APIs with GrapQL Gateway

app->api-gateway: request
api-gateway->gql-gateway: request

gql-gateway --> gql-fed-X: request a
gql-fed-X -> rest-X: request a
rest-X -> db-X: select data a
rest-X <- db-X: records a
gql-fed-X <- rest-X: response a
gql-gateway <- gql-fed-X: response a

gql-gateway --> gql-fed-Y: request b
gql-fed-Y -> rest-Y: request b
rest-Y -> db-Y: select data b
rest-Y <- db-Y: records b
gql-fed-Y <- rest-Y: response b
gql-gateway <- gql-fed-Y: response b

api-gateway <- gql-gateway: response
app <- api-gateway: response

Install

npm i

Start - dev mode

in separate terminals

# start rest services first
npm run start:rest-accounts
npm run start:rest-auth
npm run start:rest-payments

# one standard graphql server
npm run start:gql-standard

# or federation
npm run start:gql-fed-accounts
npm run start:gql-fed-auth
npm run start:gql-fed-payments

# start gateway last
npm run start:gql-gateway

Start - prod mode

# start rest services first
npm run start:rest-accounts:prod
npm run start:rest-auth:prod
npm run start:rest-payments:prod

# one standard graphql server
npm run start:gql-standard:prod

# or federation
npm run start:gql-fed-accounts:prod
npm run start:gql-fed-auth:prod
npm run start:gql-fed-payments:prod

# start gateway last
npm run start:gql-gateway:prod