TypeScript icon, indicating that this package has built-in type declarations

1.4.66 • Public • Published

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


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


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 allows you to wrap multiple modules into one, single page.


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


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(
    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(
    permalink: 'stackend-com' /* Replace with your community permalink */,

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 */




DownloadsWeekly Downloads






Unpacked Size

2.54 MB

Total Files


Last publish


  • bjorkman
  • stackend.com
  • jens-josh