Skip to content

Database Selection Guide

Navigation:


go-starter-kit supports 3 database options to fit your project's needs.

Quick Comparison

Database Best for Complexity Production ready Setup time
PostgreSQL Production apps, complex queries Medium check_circle Yes 2 min (Docker)
MySQL Broad compatibility, shared hosting Medium check_circle Yes 2 min (Docker)
SQLite Prototyping, small apps, embedded Low error Limited 0 min

Detailed Comparison

PostgreSQL (Default)

Command:

create-go-starter mon-app
# OR explicitly:
create-go-starter mon-app --database=postgres

Strengths:

  • check Advanced SQL features (JSON, arrays, full-text search)
  • check Excellent performance and reliability
  • check ACID compliant, strong data integrity
  • check Ideal for complex queries and analytics
  • check Active community and rich ecosystem

Limitations:

  • warning Requires Docker for local development
  • warning Slightly more resource-intensive than MySQL

When to use: - Production applications with complex data - Applications requiring advanced SQL features - Projects requiring strong data integrity

Docker configuration:

# Automatically included in docker-compose.yml
docker-compose up -d

DSN format:

user:password@tcp(host:5432)/dbname?sslmode=disable


MySQL/MariaDB

Command:

create-go-starter mon-app --database=mysql

Strengths:

  • check Broad compatibility and hosting support
  • check Excellent for read-heavy workloads
  • check Mature ecosystem and tooling
  • check Easy to find hosting providers

Limitations:

  • warning Fewer advanced features than PostgreSQL
  • warning Some variations between MySQL and MariaDB

When to use: - Shared hosting environments - Read-heavy applications - Teams familiar with MySQL - Need for broad hosting compatibility

Docker configuration:

# Automatically included in docker-compose.yml
docker-compose up -d

DSN format:

user:password@tcp(host:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local


SQLite

Command:

create-go-starter mon-app --database=sqlite

Strengths:

  • check Zero configuration (no server needed)
  • check Perfect for rapid prototyping
  • check Single-file database (easy backup/sharing)
  • check Ideal for testing and development
  • check Very fast for small datasets

Limitations:

  • warning Limited concurrent writes (locks entire DB)
  • warning No user/permission management
  • warning Not suitable for high-traffic production
  • warning Limited scalability

When to use: - Rapid prototyping and MVPs - Desktop applications - Embedded systems - Development and testing - Small-scale production (<100 concurrent users)

No Docker needed:

# Simply run your app, the SQLite file is created automatically
go run ./cmd/main.go
# Creates: ./my_database.db

DSN format:

./database.db


Decision Matrix

Choose PostgreSQL if:

  • center_focus_strong You're unsure (it's the default for good reason)
  • center_focus_strong You need production-grade reliability
  • center_focus_strong You have complex relational data

Choose MySQL if:

  • center_focus_strong You're using shared hosting
  • center_focus_strong Your team is well-versed in MySQL
  • center_focus_strong You have read-heavy workloads

Choose SQLite if:

  • center_focus_strong You're prototyping or building an MVP
  • center_focus_strong You want zero infrastructure
  • center_focus_strong You have a small user base (<100 concurrent)

Configuration Examples

PostgreSQL

.env.example:

# Configuration base de données (PostgreSQL)
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=monapp
DB_SSLMODE=disable

MySQL

.env.example:

# Configuration base de données (MySQL)
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=root
DB_NAME=monapp

SQLite

.env.example:

# Configuration base de données (SQLite - embarqué)
DB_NAME=monapp.db


Migration Guide

See database-migration.md for detailed instructions on migrating between databases.


Performance Considerations

PostgreSQL

  • Best for: Complex queries, ACID transactions, concurrent writes
  • Write performance: Excellent (MVCC architecture)
  • Read performance: Excellent with proper indexing
  • Connection pooling: Recommended for production

MySQL

  • Best for: Read-heavy workloads, simple queries
  • Write performance: Good (row-level locking)
  • Read performance: Excellent (query cache)
  • Connection pooling: Recommended for production

SQLite

  • Best for: Single-user scenarios, low concurrency
  • Write performance: Limited (database-level locking)
  • Read performance: Excellent for small datasets
  • Connection pooling: Not applicable (file-based)

Frequently Asked Questions

Can I change the database later?

Yes, but it requires regenerating the project with the new database flag and migrating the data. See database-migration.md for details.

Which database should I use for my SaaS?

For a production SaaS application, we recommend PostgreSQL for its reliability, ACID compliance, and advanced features. MySQL is also a good choice if you're more familiar with it.

Can I use SQLite in production?

SQLite can be used for small-scale production (<100 concurrent users), but we recommend PostgreSQL or MySQL for applications that plan to grow.

Do I need Docker?

  • PostgreSQL: Yes (for local development)
  • MySQL: Yes (for local development)
  • SQLite: No (embedded database)

What about MongoDB or NoSQL?

NoSQL support (MongoDB) has been considered but deferred to future versions. The current focus is on SQL databases with GORM support.


Additional Resources


Last updated: 2026-02-09