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

runtime-server

v1.1.1

Published

a server for running virtual stacks

Downloads

2

Readme

Runtime-Server

Overview

This is a back-end server for running virtual stacks in NoStack. It enables three things primarily:

  1. Actions: actions enabled specifically for a given set of users on a given stack. They are dynamically defined based on data in the neo4j graph database. The execute mutation runs an action.
  2. Auth: the auth is handled using a specific Cognito User Pool that is dedicated to a given stack. Most of the mutations are for auth.
  3. Queries: retrieving the data for a "unit". The uniData and source queries provide that information.

Every stack has an id, which for convenience is the user pool id. Any information about users and other data is stored in the database. Until a virtual stack is exported, all information about a stack, including it's actions, is retrieved dynamically as needed. The clientId can be retrieved with the platformInfo query.

Deployment

This is a serverless app. See the serverless.yml file. See the intro of the nostack backend wiki for how to deploy using serverless.

Queries

The server is developed on top of apollo-server-lambda and neo4j. It provides 3 queries and 2 mutations as the resolvers.

Queries: - platformInfo - unitData - source Mutations: - createUserOnPlatform - execute - resendConfirmation - forgotPassword - resetForgottenPassword - confirmSignUp - login - refreshToken - verifyToken

This authentication is based on the AWS Cognito authentication. The auth helper functions are contained in the auth directory.

- login: /src/auth/login/index.js
- registerUser: /src/auth/registerUser/index.js
- confirmSignUp: /src/auth/confirmSignUp/index.js
- resendConfirmCode: /src/auth/resendConfirmCode/index.js
- forgotPassword: /src/auth/forgotPass/index.js
- confirmForgotPassword: /src/auth/confirmForgotPass/index.js
- refreshToken: /src/auth/refreshToken/index.js
- verifyToken: /src/auth/verifyToken/index.js

actions

This actions should be called by the excute mutation with actionType. The actions helper functions are contained in the actions directory.

- createInstance: /src/actions/createInstance/index.js
- createInstanceAssn: /src/actions/createInstanceAssn/index.js
- createInstanceUnknownParent: /src/actions/createInstanceUnknownParent/index.js
- deleteInstance: /src/actions/deleteInstance/index.js
- removeInstanceAssn: /src/actions/removeInstanceAssn/index.js
- updataInstance: /src/actions/updateInstance/index.js
- updateInstanceAssn: /src/actions/updateInstanceAssn/index.js
- source: /src/actions/source/index.js
- submitForm: /src/actions/submitForm/index.js
- unitData: /src/actions/unitData/index.js

utils

This includes some functions to call the action with actionTypes. The excute mutation refers to this functions. The main function is /src/utils/callModuleToExecuteAction.js.

typeDefs

This part is a definition part for the queries and mutations, and types for them. The main function is /src/typeDefs/index.js.

Config

This includes three functions for the awsInfo, databaseInfo and dbSession.

  • awsInfo: /src/config/awsInfo.js
  • databaseInfo: /src/config/databaseInfo.js
  • dbSession: /src/config/getSession.js

Info

Git Repository

```link
<https://github.com/NoStackApp/runtime-server>
```

Endpoints

- POST - [nostackapp.github.io/multitask](https://osc6oeg32a.execute-api.us-east-1.amazonaws.com/dev/graphql)
- GET - [nostackapp.github.io/multitask](https://osc6oeg32a.execute-api.us-east-1.amazonaws.com/dev/graphql)

- cerificated endpoint: <https://api.nostack.net/graphql>

Location

hosted directly from an S3 Bucket: https://s3.console.aws.amazon.com/s3/buckets/runtime-server-dev-serverlessdeploymentbucket-km6ift2kg5ju?region=us-east-1&tab=objects

Routing

The routing is done in Route53.

Certificates

Certificates are handled via the Certificate Manager. The most important ones are for *.nostack.net and *.pivotate.com.

globalActionIdToActionType

```info
  'a0d89c1f-c423-45e0-9339-c719dcbb7afe': actionTypes.LOGIN,
  '1279e113-d70f-4a95-9890-a5cebd344f3d': actionTypes.VERIFY_USER_TOKEN,
  '96d3be63-53c5-418e-9167-71e3d43271e3': actionTypes.REFRESH_USER_TOKEN,
  'afd0c972-8f72-47ea-8313-94f895c4f87a': actionTypes.CONFIRM_SIGNUP,
  '25bfdd78-6a2c-11eb-9439-0242ac130002': actionTypes.RESEND_CONFIRM
```

But currently it is unnecessary because we separate the authentication part from the action.

Update

This project is based on the serverless framework so it is maintained using the serverless framework. In this server, you can find the serverless specification in the file ~/serverless.yml.

To deploy the latest version, you must:

  1. install serverless globally: npm install -g serverless
  2. configure AWS credentials: serverless config credentials --profider aws --key <your aws access key> --secret <your aws secret key> --profile custom-profile
  3. run sls deploy locally.

We are running everything from within us-east-1 on AWS.

Testing

You can run npm test and npm run coverage. Or, there's an integration test: npm run int-test with live data.

There's an original test set, integration tests written in jest, apparently by Bruth. Don't touch those with a ten foot pole. To run those, you supposedly have to copy .env.example to .env, add the info requested, and then you can run them.