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

@stackend/api

v1.4.77

Published

JS bindings to api.stackend.com

Downloads

95

Readme

About Stackend

Stackend.com is backend, frontend & hosting in a single line of code, or if you prefer - a downloadable NPM package. It contains of hosted, pre-made modules with focus on community driven features that you can add to your new or existing project. To use Stackend you need to create a Stackend account and a Stack (your cloudbased backend, frontend and admin).

Stackend Modules

Code Bins (CMS for frontend coders)

Code Bins are small chunks of HTML, CSS and JS used as bulding blocks for your sites

Comments

Stackend comments allows you to add threaded comments to your page.

Reviews

Reviews is a variation of comments that includes a 1-5 star rating.

Community Feed / Index

Allows you to add news feeds to you projects for anyone logged in or just selected members.

Login & Registration

A complete login/registration solution with support for email/password, Google, Facebook and OAuth2 support. OAuth2 is intended for those who want to have a tight integration with their existing user database.

Pages

Pages allows you to wrap multiple modules into one, single page.

Sites

Sites acts as a wrapper for pages and also keep tracks of all your permalinks and generates menus (optional) for you.

User Profiles

User profiles for registered users. If OAuth2 is activated you can use custom profile links (to support your existing solution from Stackend modules).

Stackend Admin

Stackend is very suitable for building dynamic applications with user generated content. In order to keep your content clean Stackend includes great moderation tools.

Stackend JS API

This project contains the lowest level of JS bindings to the JSON endpoints provided by api.stackend.com

Installation

To add Stackend to your project, run:

npm install --save @stackend/api

Initialization and basic setup

The code uses redux to keep application state. Most API methods are redux-thunk methods and should be dispatched thru the store. To get started with stackend, you need to first set up a redux store using the supplied reducers. Note: If your application also uses redux, please do not combine the stores into one single instance as the action types may clash.

The initialize function can also be used to set up logging, custom configuration and to load additional data from the api server.

import { createStore, combineReducers, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import { STANDARD_REDUCERS } from '@stackend/api/api/reducers';
import { initialize } from '@stackend/api/api/actions';
import { getCurrentCommunity } from '@stackend/api';

// Possibly add your own reducers and middleware here

const store = createStore(combineReducers(STANDARD_REDUCERS), {}, compose(applyMiddleware(thunk)));

await store.dispatch(
  initialize({
    permalink: 'stackend-com' /* Replace with your community permalink */
  })
);

// Get the community data
const community = await store.dispatch(getCurrentCommunity());
console.log('Community', community);

Custom logging

If you don't set up logging, a default console logger will be used.

To start stackend with a custom logging setup, supply it to the initialize function like this:

import { initialize } from '@stackend/api/api/actions';
import Logger from 'stackend/api/util/Logger';

const logger: Logger = {
  /* Your implementation goes here */
};

await store.dispatch(
  initialize({
    permalink: 'stackend-com' /* Replace with your community permalink */,
    logger
  })
);

Custom setup

Configuration options can also be passed to the initialize function. For details se the API documentation.

import { initialize } from '@stackend/api/api/actions';

await store.dispatch(initialize({
  permalink: 'stackend-com', /* Replace with your community permalink */
  config: {
    ... /* Any settings goes here */
  }
}));