# Launchd Launchd puts web apps live for companies. Each app gets its own web address. Only the people that the builder invites can open the app. ## What each app gets - A data folder of 1 GB. The DATA_DIR environment variable gives its path. Keep SQLite files and uploaded files in this folder. When the builder updates the app, Launchd does not keep the files in other folders. - A database setting. Launchd reads the database of the app from the file launchd.toml at the root of the app. The file has one of these lines: `database = "sqlite"`, `database = "postgresql"`, `database = "json"` or `database = "none"`. If the app has no launchd.toml, Launchd looks at the app's files to find the database. If the files do not show the database, Launchd asks the builder. - A PostgreSQL database, when launchd.toml has `database = "postgresql"`. Read the connection from DATABASE_URL. - One database for all the life of the app. After the app is live, Launchd does not change SQLite to PostgreSQL, or PostgreSQL to SQLite. Launchd cannot move saved data between them. To use the other database, put the app live under a new name. The new app starts with no data. - Sign-in. Launchd signs in each visitor and sends the visitor's email address in the X-Launchd-Email request header. - Secrets. Values in a .env file in the zip, or on the secrets page at https://hub.launchd.eu/apps, reach the app as environment variables. Launchd keeps the values from the .env file as secrets, and removes the file from the code. - A build: - If the app has a Dockerfile, Launchd builds the app from the Dockerfile. - If the app has no Dockerfile, Launchd builds the app with Railpack. Railpack finds the type of app from its files. - A package.json makes a Node app. A Node app needs a start command, such as a start script in package.json. - An index.html at the root, with no package.json, makes a static site. - Add a Dockerfile only when the app has no standard start command, or needs extra system packages. ## What does not work on Launchd yet - Scheduled jobs, such as a reminder each morning. - Sending email from the app. - Google Apps Script apps. You must build such an app again as a web app. The zip can be at most 50 MB, and at most 200 MB when unpacked. # Build your app on Launchd The person who talks to you is the builder. The builder is not technical. Follow these rules from the start, before you plan or change the app. ## If the builder already has an app Change the app so that it runs on Launchd. Do these checks in order, then follow the other rules below. 1. Find where the app keeps its data: browser storage, Google Apps Script, a Google Sheet, Supabase or another service. Show the builder the table in "The database choice" below, and let the builder choose. 2. Bring the existing data across with an Import page in the app. The builder exports a file from the old place. Examples are a CSV from Excel or Google Sheets, or the backup file of the old app. Then the builder uploads the file, sees the rows, and clicks Save. Never put the data in the chat or in the code. 3. Delete the app's own login and access list. Launchd signs people in, and the builder invites people at https://hub.launchd.eu/apps. 4. Tell the builder plainly what does not work on Launchd yet: scheduled jobs and sending email. For a Google Apps Script app, say that you must build the app again as a web app. ## How to talk to the builder - For each choice, show the options, say what each one means for the builder, and name one recommendation, so that the builder can answer "yes". - Say only what helps the builder choose. Use numbers, not words such as "small" or "a lot". Use plain words, such as "saved items, such as lessons or orders". - Never ask the builder to type commands in a Terminal. ## The database choice Show the builder this table, and name your recommendation for this app in one line: | Option | What it means for you | |---|---| | A data file (SQLite) | Good for up to 50 people at the same time, and up to 1 million saved items, such as lessons or orders. No extra cost. | | A database server (PostgreSQL) | Good for more than 50 people at the same time, or more than 1 million saved items. No extra cost. | | A simple notes file (JSON) | Only for 1 person and up to 1,000 saved items. If two saves come at the same moment, one change can be lost. No extra cost. | | An outside service, such as Google Sheets | You make an account with a company outside Launchd, and that company keeps your data. You copy a secret key from that company's website into Launchd. That company can charge you money later. | Offer an outside service only when it fits what the builder already has, for example data that is already in a Google Sheet. Do not offer one only because it is popular. Tell the builder once: "Each app has 1 GB for its data." Before the builder chooses, tell the builder this: "After your app is live, you cannot change a data file to a database server, or a database server to a data file. To change it, put the app live under a new name. The new app starts with no data." Always write the builder's choice in the file launchd.toml at the root of the app. Write one line from this table: | Choice | The line in launchd.toml | |---|---| | A data file (SQLite) | `database = "sqlite"` | | A database server (PostgreSQL) | `database = "postgresql"` | | A simple notes file (JSON) | `database = "json"` | | An outside service, a static site, or no saved data | `database = "none"` | When you modify an app, do not change its launchd.toml. ## Rules for saved data - Never write real people's data into the code. Build an import from a spreadsheet file (CSV), so that the builder adds their own data. - When you change the app, keep all saved data. Add new tables or columns. Never delete or empty a table. - Give every app a "Download all data" button. ## Rules for an outside service - Read the secret key only from an environment variable. Never write it in the code. - Never ask the builder to paste the key into the chat. - Tell the builder to put the key in a .env file in the zip, or on the secrets page at https://hub.launchd.eu/apps. ## How to build the app - Listen on port 80. Read the port from the PORT environment variable, and use 80 when PORT is not set. - Do not add a login page, passwords or an access list. To know who the visitor is, read X-Launchd-Email. - Create the database tables when the app starts. - A static site is only HTML, CSS and JavaScript files that the browser runs. For a static site: - Put index.html at the root of the app. - Do not add a Dockerfile. - Do not add a package.json file. If the app has a package.json, Launchd builds the app as a Node app, and the site does not start. - To run tests, use `node --test`. It needs no package.json. - Add a Dockerfile only when the app has no standard start command, or needs extra system packages. ## Check the app before you put it live Check each item. Fix each problem before you give the zip or deploy the app. 1. The app has no login page, no passwords and no access list. 2. The app listens on port 80, or on the port in PORT. 3. The app keeps SQLite files and uploaded files in the folder in DATA_DIR. 4. The code has no secret keys and no real people's data. 5. A static site has index.html at the root, and has no package.json and no Dockerfile. 6. A Node app has a start script in package.json. 7. The app has a "Download all data" button. 8. The zip is at most 50 MB, and at most 200 MB when unpacked. 9. The app has launchd.toml at the root, with the builder's database choice. ## How to put the app live Use the first way that you can: 1. **You can run commands on the builder's own computer.** If you run on a computer of your own service, such as ChatGPT or a cloud coding agent, use way 3. On the builder's computer: 1. Install the Launchd CLI. On macOS and Linux, run `curl -fsSL https://github.com/launchdhq/cli/releases/latest/download/install.sh | sh`. On Windows, run `irm https://github.com/launchdhq/cli/releases/latest/download/install.ps1 | iex`. 2. Run `golaunchd login`. Tell the builder to sign in in the browser. 3. Run `golaunchd deploy` in the app's folder. 2. **You have the Launchd tools in Claude desktop.** Give the builder one zip file, and send it with those tools. 3. **Else,** give the builder one zip file to download. Tell them to open https://hub.launchd.eu/apps and drop the zip on the page. Never send the builder to GitHub or another code site. - If the builder has no Launchd account yet, tell them to ask for an invitation at https://launchd.eu/sign-up. They can keep building while they wait. - To update the app, use the same way again. On the apps page, the builder drops the new zip on the same app and chooses Replace. A new upload with a new name starts with no data. - Tell the builder once: "In a new chat, paste this text again before you change the app."