DEV Community

Cover image for Neon Meets `create-t3-app`: The PostgreSQL Solution for Modern Developers
Jose Carlos Toscano
Jose Carlos Toscano

Posted on

Neon Meets `create-t3-app`: The PostgreSQL Solution for Modern Developers

This is a submission for the Neon Open Source Starter Kit Challenge : Ultimate Starter Kit

My Kit

As developers, we understand the importance of having a reliable and flexible starter kit to kickstart our projects. The create-t3-app CLI tool has become a beloved choice for many in the developer community, boasting over 24.7k stars on GitHub. This popularity is a testament to its effectiveness in helping developers build full-stack TypeScript applications with ease. Instead of starting from scratch to create a new CLI tool, it makes perfect sense to build on top of such a well-established and widely adopted project.

That's why we're excited to introduce a powerful enhancement to create-t3-app—one that preserves its versatility while integrating Neon as a robust PostgreSQL database provider, offering developers an additional, seamless solution for serverless PostgreSQL.

create neon-t3 GIF

Why We Forked create-t3-app

The open-source nature of create-t3-app allows it to evolve alongside the needs of the community. Our team saw an opportunity to build upon this amazing foundation by integrating Neon as a database provider. The goal of our fork was not to diverge from the original project but to contribute an enhancement that we hope will eventually be merged back into the main repository.

Two-Part Challenge Submission

Our challenge submission for the Neon Open Source Starter Kit Challenge consists of two distinct parts:

  1. create-neon-t3 CLI alternative

We created a fork of the original create-t3-app called create-neon-t3, which sets Neon as the default database provider. This fork is accessible as an npm package through:



npm create neon-t3


Enter fullscreen mode Exit fullscreen mode

This version is tailored for developers who already know they'll be using a PostgreSQL database in a serverless environment. It retains all the original flexibility of create-t3-app, allowing you to scaffold your Next.js project with built-in authorization and type safety (while optional, tRPC hugely recommended) while defaulting to Neon as the database provider.

2.A Pull Request to the Original Project

  • The second part of our submission is a pull request to the original create-t3-app project. Our aim is to contribute this enhancement back to the community, ensuring that the tool continues to serve the evolving needs of developers.

  • The original create-t3-app offered PlanetScale as the primary database option for MySQL users. However, with PlanetScale's recent deprecation of their free tier, the community needs a strong alternative—especially for those who prefer to build on PostgreSQL. Neon, designed for serverless environments and with its very generous free tier, is the perfect fit for this role.

Check out the PR here:

feat: Neon as database Provider #1976

Closes # 1930

With PlanetScale's recent deprecation of their free tier, the community needs a strong alternative—especially for those who prefer to build on PostgreSQL. Neon, designed for serverless environments and with its very generous free tier, is the perfect fit for this role.

Why Neon? Neon offers a modern, serverless PostgreSQL solution that is perfectly aligned with the needs of developers who prioritize performance, scalability, and simplicity.

I tried using Supabase (lot's of connection issues) and Vercel's Storage (seamless integration, but they're missing all the extra tools that other DB providers offer)

With Neon, you get:

  • Serverless PostgreSQL: Seamless scaling without the need for managing servers.
  • Cost Efficiency: A free tier that supports developers from prototyping to production.
  • Developer-Friendly: A modern approach to database management, making it easy to integrate into existing workflows.

✅ Checklist

  • [x] I have followed every step in the contributing guide (updated 2022-10-06).
  • [x] The PR title follows the convention we established conventional-commit
  • [x] I performed a functional test on my final commit

Changelog

  • Adds Neon as a database provider: Introduced Neon as an option for PostgreSQL
  • Updates CLI Prompts: Added a new option to select Neon as the database provider during the setup process.
  • Configuration Files: Generated all necessary configuration files for Prisma and Drizzle ORM when Neon is selected, ensuring seamless integration with Neon's serverless PostgreSQL.

Screenshots

Screenshot 2024-09-01 at 2 11 25 p m

💯

(still WIP to fit to their contribution guidelines)

Why Neon?

Neon offers a modern, serverless PostgreSQL solution that is perfectly aligned with the needs of developers who prioritize performance, scalability, and simplicity.

With Neon, you get:

  • Serverless PostgreSQL: Seamless scaling without the need for managing servers.
  • Cost Efficiency: A free tier that supports developers from prototyping to production.
  • Developer-Friendly: A modern approach to database management, making it easy to integrate into existing workflows.

How to Use the CLI Tool

Our CLI tool retains the simplicity and flexibility of the original create-t3-app while offering Neon as the default database provider. Here’s how you can use it to kickstart your next project:

  • Step 1: Install and Run the CLI To get started, you can run the CLI directly from npm:


npm create neon-t3@latest


Enter fullscreen mode Exit fullscreen mode

This will pull the latest version of the CLI

Pro Tip here: If the package is called "create-neon-t3", why can it be run with npm create neon-t3?
This is because of the Package Naming Convention:
The package name "create-neon-t3" follows a common convention where packages designed to scaffold new projects start with create-. When you run npm create neon-t3, npm looks for a package named "create-neon-t3" to initialize a new project.
The @latest tag ensures that the latest version of the package is used.

  • Step 2: Choose Your Project Options
    The CLI will guide you through a series of prompts to configure your new project. Since Neon is set as the default database provider, that won't be part of these prompts:

  • Step 3: Set Up Your Environment
    Once you’ve completed the setup, the CLI will generate a .env file for your project. This file will include the necessary environment variables for connecting to your Neon database.

For example:

env



# Database Connection String
DATABASE_URL="postgresql://postgres:password@localhost:5432/myapp"

# Next Auth Settings
NEXTAUTH_SECRET="your-secret"
NEXTAUTH_URL="http://localhost:3000"


Enter fullscreen mode Exit fullscreen mode
  • Step 4: Create and connect your Neon project
    Proceed to connect your Neon's project by simply configuring your database URL available on your Neon dashboard.

  • Step 5: Start Building
    With everything set up, you can begin building your application immediately. The CLI has taken care of configuring the database, authentication, and other essential settings, allowing you to focus on writing code.



npm run dev


Enter fullscreen mode Exit fullscreen mode

Scaffolded app preview

Together, we can continue to build the ultimate open-source starter kit—one that adapts to the needs of the community and supports developers at every stage of their journey. Happy coding!

Link to Kit

GitHub logo JoseCToscano / create-neon-t3

The best way to start a full-stack, typesafe Next.js app

Logo for T3

create-neon-t3

Scaffolded app preview

Interactive CLI to start a full-stack, typesafe Next.js app, with database on Neon

Why We Forked create-t3-app

The open-source nature of create-t3-app allows it to evolve alongside the needs of the community. Our team saw an opportunity to build upon this amazing foundation by integrating Neon as a database provider. The goal of our fork was not to diverge from the original project but to contribute an enhancement that we hope will eventually be merged back into the main repository.

  • The original create-t3-app offered PlanetScale as the primary database option for MySQL users. However, with PlanetScale's recent deprecation of their free tier, the community needs a strong alternative—especially for those who prefer to build on PostgreSQL. Neon, designed for serverless environments and with its very generous free tier, is the perfect fit for this role.

Why Neon?

Neon offers a modern, serverless PostgreSQL solution that is perfectly aligned with…




Your Journey

The Bigger Picture: Contributing Back to the Community

Our intention with this fork is to contribute something valuable back to the open-source community. By integrating Neon into the create-t3-app tool, we hope to offer developers another robust option for building with PostgreSQL. This enhancement is not just about adding a new feature—it’s about ensuring that the tool continues to grow in ways that serve the needs of its users.

We deliberately chose not to remove any other database providers on the pull request to the original project, such as PlanetScale, to maintain the CLI's versatility and ensure a smooth integration process. Our hope is that by keeping the tool open and adaptable, it will encourage more developers to contribute and ultimately lead to this enhancement being merged into the original project.

Conclusion

The integration of Neon into the create-t3-app CLI tool is just the beginning. We believe that this enhancement will empower developers to build even more powerful applications with the tools they love. Whether you're already a fan of create-t3-app or just discovering it, we invite you to try out this new version and see how Neon can elevate your development experience.

Top comments (3)

Collapse
 
bobbyiliev profile image
Bobby Iliev

Awesome!

Collapse
 
edgar_ossiel profile image
Edgar Ossiel

Nice job!!

Collapse
 
sivakumarbalu profile image
SivakumarBalu

Must to have!