Deploy from a Template
Start from a ready-made starter app, or add a Deploy to Cosmoner button to your own repository's README so readers can run a copy in a few clicks.
Overview
A template is a small, working app in a public GitHub repository, set up to deploy on Cosmoner as it is. You copy it to your own GitHub account, then deploy your copy like any other repository. From then on it is your code: change anything, and every push redeploys it.
Browse them on the templates page.
| Template | Deploys as | Needs a database |
|---|---|---|
| Next.js | Web service | No |
| Astro | Static site | No |
| Hono API | Web service | No |
| Laravel | Web service | No, it uses SQLite, which resets on every deploy |
| Node and PostgreSQL | Web service | Yes, PostgreSQL |
| FastAPI | Web service | No |
| Django | Web service | Yes, PostgreSQL |
Deploy a template
Select Deploy on a template. The page that opens walks you through three steps.
- Copy the template to your GitHub. Use this template opens GitHub's own page for creating a repository from a template, on your account. Keep the suggested name if you like: the deploy step searches for it.
- Create a PostgreSQL database, for templates that need one. Create a database in your project and store its connection string as a secret named
DATABASE_URL. The app reads its connection from that variable. - Deploy it. Deploy to Cosmoner takes you into the control panel. Log in or create an account first if you need to, and you come back to this step afterwards. Choose a project (or create one), and the app wizard opens with GitHub selected and the repository search filled in with your copy's name.
If GitHub is not connected to the project yet, the wizard asks you to connect it first: install the Cosmoner GitHub App on the account that owns your copy. When the App is installed for selected repositories only, add your copy to it in GitHub's settings, or it will not be listed.
Once you select the repository, the wizard offers Fill in from file, which loads the template's build settings from its configuration file. Choose a plan and launch.
Cosmoner does not create the repository for you. Copying it on GitHub keeps the repository in your account and under your control, and means the GitHub App never needs permission to create repositories.
Add a deploy button to your README
Maintain a repository other people might want to run? Add the Deploy to Cosmoner button to its README. Readers who select it get the same guided page, for your repository: fork or copy it to their GitHub, then deploy their copy.
Replace OWNER/REPO with your repository.
Markdown:
[](https://cosmoner.com/deploy?repo=https://github.com/OWNER/REPO)HTML:
<a href="https://cosmoner.com/deploy?repo=https://github.com/OWNER/REPO">
<img src="https://cosmoner.com/deploy-button.svg" alt="Deploy to Cosmoner" width="188" height="36">
</a>The repo value must be the repository's GitHub address and nothing more: https://github.com/OWNER/REPO. A trailing slash or a .git suffix is accepted. A link to a branch, a file, or anything other than a GitHub repository shows an error page instead.
Make your repository deploy well
The button deploys whatever the reader's copy contains, so a little preparation helps:
- Commit a
.cosmoner/deployment.yamldescribing the build and start commands, so Fill in from file sets the app up in one click. - Listen on the port in the
PORTenvironment variable. See Ports. - If the app needs a database or other secrets, say so in the README and reference them with
from_secretin the configuration file, so the wizard links them. - Mark the repository as a template in its GitHub settings if you want readers to get a clean copy rather than a fork.
Limits
- The repository must be on GitHub. GitLab and Bitbucket repositories deploy through the app wizard as usual, without a button.
- Every deploy is of a repository the reader owns. Deploying straight from someone else's public repository is not supported.
Deploy an App from Git
Connect GitHub, GitLab or Bitbucket, pick a repository, and have your app built and running on a cosmoner.com address — then redeployed on every push.
Deploy a Next.js App
Run a Next.js app on Cosmoner from your repository — server rendering, API routes and NEXT_PUBLIC_ variables included — or ship it as a static export.