Here's a full stack app template for fly.o with Next.js / Turbo / Postgres and CI/CD with migrations.

Spent the last couple weeks deciding whether to go with fly.io, and dealing with dockerizing Next.js in an efficient manner. Make sure you follow the instructions in the README before just trying to use it.

Here’s what you get:

Makes a full fly.io deployment with two environments for development and production:

  • Next.js web app in standalone mode with a super trimmed down docker image.
  • Postgrest HA cluster on fly.io.
  • CI/CD available for two environments:
    • dev is automatically triggered on push to main branch.
    • production is manually triggered.
  • Database migrator
    • Dockerized for direct execution on fly.io so you don’t need to leak your DB credentials
    • Can be run manually as a github action.
    • Runs as the fly.io release_command when deploying the web app ensuring your migration completes before the web app starts.

Uses VSCode dev containers to provide a fully dockerized development environment:

  • Automatically launches a local postgres database for you as well as pgadmin.
  • fly.io cli installed
  • psql tools installed
  • Docker compose for dev containers
  • Customizable Dockerfile for additional apt packages
  • Scriptable tooling installation
  • aws cli installed as a convenience even though it’s not needed for this starter project

This is a fork of the T3 Stack project bootstrapped with create-t3-turbo but completely setup for Fly.io and dockerized development with dockerized Drizzle migrations.

The db-migrate package is new to this fork and not in the original T3 stack. It’s a thin Drizzle migration runner that executes stand-alone without any additional project dependencies.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.