Create a Database
Learn how to set up a database for your Tailar project. Choose from PostgreSQL, MySQL, or MongoDB.
Tailar is a production-ready Next.js foundation. The CLI setup wizard composes templates, modules, and providers into code you own, including auth, billing, email, and database.
Last updated
Overview
Before installing the database feature, you need to set up a database instance. This guide will walk you through setting up databases with different providers. Once your database is ready, you can install the database feature using:
PostgreSQL
PostgreSQL is a powerful, open-source relational database. We recommend using Neon for a quick and easy setup.
Step 1: Create a Neon Account
Visit neon.tech and sign up for a free account.
Step 2: Create a New Project
After signing in, create a new project. Choose a name and select a region closest to your users.
Step 3: Get Your Connection String
Once your project is created, Neon will provide you with a connection string. It will look like this:
1postgresql://username:password@ep-xxx-xxx.region.aws.neon.tech/neondb?sslmode=requireStep 4: Add to Environment Variables
Add the connection string to your `.env` file:
1DATABASE_URL="postgresql://username:password@ep-xxx-xxx.region.aws.neon.tech/neondb?sslmode=require"Next Steps
Now you can install the database feature. See the Database module documentation for installation instructions.
Provider Documentation
MySQL
MySQL is a popular open-source relational database management system. You can use providers like PlanetScale or AWS RDS.
Step 1: Choose a Provider
Select a MySQL provider. PlanetScale offers a free tier and is great for development.
Step 2: Create a Database
Follow your provider's instructions to create a new database instance.
Step 3: Get Your Connection String
Your connection string will look like this:
1mysql://username:password@host:port/databaseStep 4: Add to Environment Variables
Add the connection string to your `.env` file:
1DATABASE_URL="mysql://username:password@host:port/database"Next Steps
Now you can install the database feature. See the Database module documentation for installation instructions.
Provider Documentation
MongoDB
MongoDB is a NoSQL document database. You can use MongoDB Atlas for a managed solution.
Step 1: Create a MongoDB Atlas Account
Visit MongoDB Atlas and sign up for a free account.
Step 2: Create a Cluster
Create a new cluster. The free tier (M0) is perfect for development.
Step 3: Configure Network Access
Add your IP address to the network access list, or allow access from anywhere (0.0.0.0/0) for development.
Step 4: Create a Database User
Create a database user with a username and password. Save these credentials securely.
Step 5: Get Your Connection String
Click "Connect" on your cluster and choose "Connect your application". Your connection string will look like this:
1mongodb+srv://username:password@cluster.mongodb.net/database?retryWrites=true&w=majorityStep 6: Add to Environment Variables
Add the connection string to your `.env` file:
1DATABASE_URL="mongodb+srv://username:password@cluster.mongodb.net/database?retryWrites=true&w=majority"Next Steps
Now you can install the database feature. See the Database module documentation for installation instructions.