Our open-source server allows you to build backend-driven apps that run on your own infrastructure.
Below is the bones of an app server with user authentication built in.
// import { internalStack } from '@internalstack/server'
// const server = await internalStack('live_psk_5b2d902f24a057349d9f2d1c385fef7c59')
server.statefulSession(async(io, { user, sessionId }) => { // listening for requests
// Business logic
})
Everytime a user loads the app's page two things happen before a request hits your app:
sessionIdThe server can fulfill multiple requests from multiple users while keeping track of each session's progress in-memory.
The handler function is fired whenever a page is loaded will continue it's resolution path for the length of the session.
This allows for user identity to be paired with actions for the duration of every session.
// import { internalStack } from '@internalstack/server'
// const server = await internalStack('live_psk_5b2d902f24a057349d9f2d1c385fef7c59')
server.statefulSession(async(io, { user }) => { // listening for requests
console.log(user) // [email protected] (<- Fully authenticated and authorized)
const note = await io.input.text('Enter a note')
console.log(note) // 'This is a note from Ellen!'
const requestedItem = await io.input.number('Enter the name of the product to reorder')
console.log(requestedItem) // 'Space suits'
const requestedItemCount = await io.input.number('Enter the amount to reorder')
console.log(requestedItemCount) // 5
})
These servers run entirely on-premises! All of your code is committed to your organization's repositories.
┌───────────────────────────────────────────────────────┐
│ │
┌─────────────────┐ │ InternalStack Server SDK │
│ │ │ │
│ Hosted │ │ npm i @internalstack/server │
│ ├───────────┤ │
│ on-premises │ │ -Lets you define internal logic that runs on your │
│ │ │ organization's infrastructure │
└─────────────────┘ │ │
│ -Handles incomming authenticated sessions │
│ │
└──────────────┬────────────────────────────────────────┘
│ ▲
│ │
│ │
▼ │
┌───────────────────────────────────────────┴───────────┐
│ │
│ InternalStack Broker │
┌────────────────────│ │
│ │ -Enables real-time bi-directional communication │
│ │ between the sessions and the server │
┌────────┴────────┐ │ │
│ │ └──────────────┬────────────────────────────────────────┘
│ Hosted by │ │ ▲
│ │ │ │
│ InternalStack │ ▼ │
│ │ ┌───────────────────────────────────────────┴───────────┐
└────────┬────────┘ │ │
│ │ InternalStack Cloud │
│ │ │
│ │ -Provides the rendering layer │
└────────────────────│ │
│ -Authenticates and authorizes requests before they │
│ hit your server │
│ │
└───────────────────────────────────────────────────────┘