How to host a full-stack app with a database
Host a full-stack app and its PostgreSQL database in one DASTER project. The app gets DATABASE_URL at every deployment, with no connection string to copy.
Published · DASTER
Last updated
To host a full-stack app with a database on DASTER, create an App project with the Full-stack app start, set up PostgreSQL, then deploy your code from GitHub or a .zip. At every deployment the app receives DATABASE_URL, DASTER_URL and DASTER_SERVER_KEY by itself, so there is no connection string to copy.
A full-stack app needs two things to run: a server that answers web requests and a database it can trust. On DASTER both live in the same project, in Mumbai (ap-south-1), and the project connects them for you. This post walks through the setup and the limits you should know before you start.
What can run on DASTER?
Hosting runs Node and npm servers, static build output served by Node, and restricted Dockerfiles. It builds from a GitHub repository, a .zip of your app folder or a public Docker image. A web service answers at https://<app id>.apps.daster.io.
For data you can choose:
| Database | Good for |
|---|---|
| PostgreSQL | Your app's main database, with SQL, policies, backups |
| Document Database (MongoDB-compatible) | JSON documents, with your existing MongoDB drivers |
| SQL Database (MySQL-compatible) | Existing MySQL apps, such as Laravel or WordPress apps |
This post uses PostgreSQL, the one most new apps start with.
Create a Full-stack app project
Open the organization menu, choose New project and pick App / Cloud. Under What are you building?, choose Full-stack app: the project starts with hosting, a database, storage, sign-in and domains. Give it a name such as
acme-appand keep the region, Mumbai.Set up PostgreSQL
In the project, open Backend Cloud and choose Set up Backend Cloud. The summary shows the size you will get: your organization's first PostgreSQL database is Free (512 MB, 10 connections), later ones start as Nano. Confirm, and the setup page follows the database until it is ready.
You can do the same with the API:
POST /v1/projects/{projectId}/backend?organizationId={organizationId} Content-Type: application/json Idempotency-Key: backend-acme-1 { "size": "nano" }Create your tables
Open PostgreSQL › SQL Editor and run one statement at a time, or save named statements under Migrations, which apply in one transaction:
create table todos ( id bigint generated always as identity primary key, title text not null, done boolean not null default false );New tables use row-level security and deny client access by default. Add policies under Backend Cloud › Policies before browser code reads them.
Deploy the app
In Hosting, choose Deploy an app, pick Web service and a size, then choose the source: a GitHub repository and branch, or Upload a .zip (up to 100 MB). DASTER inspects the code and fills in the install, build and start commands. Check them, set the port your server listens on and a health check path, then choose Review and Deploy to Development.
Before the deploy starts, DASTER checks that your organization's wallet can pay the next hour of everything you run on Hosting.
Use the database from your code
Once Backend Cloud is ready, every deployment gives the app these variables:
Variable What it is DATABASE_URLPostgreSQL through the session pooler, with sslmode=verify-fullDASTER_URLThe address of your project's data API DASTER_SERVER_KEYThe project environment's server key Pass
DATABASE_URLto your PostgreSQL driver or ORM. Or use the SDK on your server (npm install @dasterhq/daster):import { createServiceClient } from '@dasterhq/daster'; const db = createServiceClient({ projectId: process.env.DASTER_PROJECT_ID!, serverKey: process.env.DASTER_SERVER_KEY!, }); const { rows } = await db.database.select('todos', { eq: { done: false }, limit: 20 }); await db.database.insert('todos', { title: 'Ship the first version', done: false });Set
DASTER_PROJECT_IDyourself as a variable. The server key bypasses row-level security, so filter every query on the server.
What should I know before I start?
- The database is private to DASTER. All three databases accept connections only from apps hosted on DASTER today.
psql,pg_dumpor an app hosted somewhere else cannot connect yet; use the SQL Editor, the API or the data API instead. - Variables are not passed to build commands. Read settings at runtime, not while the app builds.
- Preview deployments never receive the connection, so a branch preview cannot touch your Development data.
- A full database turns read-only. Writes are refused with
database_storage_fulland reads keep working. The Usage card warns from 80 %. - Prices are not final. The pricing page explains how the plan and the wallet work.
When the app works in Development, owners and admins can use Promote to Production to run the same image in Production, without building it again. See Connect once for every variable and PostgreSQL for sizes and tabs.
DASTER is in testing and sign-up is waitlist-only. Join the waitlist and you get access 20 days after you join.
Questions about hosting a full-stack app on DASTER
Do I have to copy a connection string into my app?
No. An app hosted on DASTER receives DATABASE_URL, DASTER_URL and DASTER_SERVER_KEY at every deployment once Backend Cloud is ready. A variable you set yourself under one of these names is kept.
Can I connect to the database from my laptop?
Not yet. The poolers accept connections only from apps hosted on DASTER. Use the SQL Editor, the API or the data API to work with your data from outside.
Which database should I pick?
PostgreSQL for a new app. Pick the MongoDB-compatible Document Database or the MySQL-compatible SQL Database when your code already uses those drivers; hosted apps get MONGODB_URL or MYSQL_URL for them.
Can the frontend and the API be one service?
Yes, when one Node server serves both, as a Next.js app does. You can also run them as two web services in the same project; both receive the same connection.
How big can the database get?
Free and Nano start at 512 MB. On Nano you can add storage in 1 GB steps, up to 2 GB more. Small and Medium are not offered in Mumbai yet.