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

letterbox

v2.1.0

Published

A database driven application platform using Envelope

Downloads

69

Readme

Letterbox

A database driven application platform leveraging Electron, Envelope and PostgreSQL.

What is Letterbox

Letterbox is a tool for developers that makes writing and distributing database driven applications easy!

Letterbox makes it easy to build database apps. Programs for business, like accounting or inventory. Once you've written your application, Letterbox helps you package your app for Linux, Mac and Windows computers. When users go to open your app, Letterbox will manage starting Envelope.

In order to accomplish all this magic, Letterbox makes several interesting choices to bring together an application stack. But although a lot of work went into Letterbox, it would not have been possible without the following projects:

Electron

Electron (by Github) is an application shell that provides you with several important components. The first is the web engine from Chromium, which renders your HTML and Javascript just like a browser. In order to display your HTML and Javascript files you need a webserver, so Electron provides and embeds a Node server. Finally, Electron helps you package your application so that you can easily distribute it to Linux, Mac and Windows computers. Electron is a powerful combination of technologies and effort.

PostgreSQL

PostgreSQL is an enterprise class, open source object-relational database. Letterbox helps you package Envelope applications with Electron that connect to PostgreSQL.

Postcard, a related open source project, brings portable binaries of PostgreSQL for Linux, Mac and Windows into Node modules.

Envelope

Envelope helps you publish web apps based on your PostgreSQL database. It includes a powerful set of custom HTML tags called "Web Components" that can be configured to talk directly to your database. This saves your from writing code in middleware. By simplifying your web app's architecture, you can write your app with less context switch. This reduces cognitive load making it easier to think clearly about what your app is trying to do.

Letterbox is still pre-release. Please ignore it for now.

Getting Started

There are two functions in Letterbox:

letterbox.init(appName, postgresHost, postgresPort, callback)

  • appName
  • Letterbox uses this to create a folder to hold the configuration file for Envelope.
  • postgresHost
  • Letterbox uses this to tell envelope how to connect to PostgreSQL.
  • postgresPort
  • Letterbox uses this to tell envelope how to connect to PostgreSQL.
  • callback(envelopePort)
  • This function will be called after envelope has started up, the envelopePort argument will allow you to tell Electron where to go to connect to Envelope.

letterbox.quit()

  • You need to call this function when the process is going to exit. If you don't then Envelope will keep running and you won't be able to start it the next time you launch the application.

Example

const letterbox = require('letterbox');
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;

let mainWindows = [];

app.on('ready', function () {
	var curWindow = new BrowserWindow({
		'width': 1024,
		'height': 768
	});
	mainWindows.push(curWindow);
	letterbox.init('letterbox-example', 'yourdomain.com', '5432',
			function (envelopePort) {

		curWindow.loadURL('http://127.0.0.1:' + envelopePort, {
			'extraHeaders': 'pragma: no-cache\n'
		});
	});

	// Emitted when the window is closed.
	curWindow.on('closed', function() {
		mainWindows.splice(mainWindows.indexOf(curWindow), 1);
	});
});

app.on('quit', function() {
	letterbox.quit();
});