Getting StartedChoosing Your Database

Choosing Your Database

Aerostack provides native, high-fidelity integration with two powerful database solutions. Choosing the right one depends on your data model, consistency requirements, and existing infrastructure.

Comparison at a Glance

FeatureCloudflare D1Neon PostgreSQL
TypeSQLite (SQL)PostgreSQL (SQL)
RuntimeNative Edge (Isolates)External (TCP/HTTP)
ConsistencyStrong (within region)Strong
ScalabilityGlobal (Read Replication)Serverless (Autoscaling)
Best ForHigh-performance simple schemasComplex relations, JSONB, Extensions

Cloudflare D1 (SQLite)

D1 is Cloudflare’s native serverless SQL database. It is built on SQLite and is optimized for low-latency access from Aerostack.

When to choose D1:

  • You need the lowest possible latency (database and code run in the same isolate).
  • Your application involves simple relational data or caching.
  • You want a fully integrated stack with zero external dependencies.

Neon PostgreSQL

Neon is a serverless PostgreSQL database with a separation of storage and compute.

When to choose Neon:

  • You need full PostgreSQL compatibility (PostGIS, pg_vector, etc.).
  • Your data model is complex and relies heavily on joins or JSONB.
  • You want to leverage Neon’s instant branching for development and staging environments.

Branching Power: Use aerostack db:neon create my-branch to instantly clone your database for a feature branch.


Initializing Your Choice

When you start a new project with the Aerostack CLI, you can specify your database choice:

# For Cloudflare D1 (Default)
aerostack init my-app --db=d1
 
# For Neon PostgreSQL
aerostack init my-app --db=neon

If you don’t provide the flag, the CLI will guide you through an interactive selection.