Swiftpack.co - Package - nodes-vapor/nstack


Swift Version Vapor Version Circle CI codebeat badge codecov Readme Score GitHub license

This package is a wrapper around the NStack.io API.

Supports the following features:

  • Translate

📦 Installation

Update your Package.swift file.

.Package(url: "https://github.com/nodes-vapor/nstack.git", majorVersion: 2)


Create config nstack.json

    "log": false,
    "defaultApplication": "appOne",
    "translate": {
        "defaultPlatform": "backend",
        "defaultLanguage": "en-UK",
        "cacheInMinutes": 60
    "applications": [
            "name": "appOne",
            "applicationId": "secret",
            "restKey": "secret",
            "masterKey": "secret"

Make sure that client is set to foundation in droplet.json because the engine client does not properly support the required SSL connections.

  "client": "foundation",

Getting started 🚀


import NStack

And add provider

try addProvider(NStackProvider.self)


import NStack

And register the nstack leaf tag

extension Droplet {
    // ...
    guard let leaf = view as? LeafRenderer else {
        fatalError("Leaf not configured.")

    leaf.stem.register(NStackTag(nStack: self.nstack))
    // ...


Consider making a easy accessible var

let translate = drop.nstack?.application.translate
// With default language and platform
translate?.get(section: "default", key: "ok")

// Specifying language and platform and replacing placeholders
translate?.get(platform: "backend", language: "en-UK", section: "default", key: "saveSuccess", replace: ["model": "test"])

Leaf usage yields a translated string or the given key if translation fails

// Get translation for camelCasedSection.camelCasedKey
#nstack("camelCasedSection", "camelCasedKey")

// Get translation for camelCasedSection.camelCasedKey and replace searchString1 with replaceString1 etc
#nstack("camelCasedSection", "camelCasedKey", "searchString1", "replaceString1", "searchString2", "replaceString2", ...)

🏆 Credits

This package is developed and maintained by the Vapor team at Nodes. The package owner for this project is Rasmus.

📄 License

This package is open-sourced software licensed under the MIT license


Stars: 5
Help us keep the lights on


2.0.4 - Oct 10, 2018


  • get(section: String) -method in translate to return all translations in a given section for the default platform and language

2.0.3 - Sep 28, 2018


  • #nstack() leaf tag now accepts search/replace parameters for placeholders in translations


  • Docs for the improved tag functionality

2.0.2 - Sep 27, 2018


  • New lead tag for leaf template translations
  • Docs for the new leaf tag

2.0.1 - Jan 24, 2018

  • Fixes runtime crash by postponing resolving of the client

2.0.0 - Jan 22, 2018

  • remove dependency on Droplet
  • fix type in ConnectionManager class + file