Hosting Your Database with Render Platform

Marickian
By -
0
Hosting Your Database with Render Platform

Hosting Your Database with Render Platform

In the following guide, we're going to cover how to host our database using Planetscale. However, I've decided to create an additional guide on how to host our database on the Render platform, which is another free option we can use.

Keep in mind that the free hobby instance we're going to use on Render expires in 90 days. So, that's something to be aware of.

Step-by-Step Guide

1. Sign Up for Render

First, you'll need to sign up for a Render account. It's free and, as far as I remember, they don't ask for a credit card, so it should be straightforward.

2. Create a New Postgres Instance

Once you have your account, go to the dashboard and look for the "New" button. Here, create a new Postgres instance:

Create a new Postgres instance
Provide a name (e.g., "test")
Choose the free option
Click on "Create Database"

3. Retrieve the External Database URL

After the instance is ready, scroll down and look for the external database URL. This is usually found under "Connect an external connection." Look for the URL that starts with "Postgres" and copy it.

4. Update Your Project

Navigate back to your project and update the .env file with the new database URL:

DATABASE_URL=<copied_url>

In the schema.prisma file, change the provider from SQLite to Postgres. You should get a suggestion once you remove SQLite. Make sure to choose the Postgres option and save both files.

provider = "postgres"

5. Push to Render Platform

Stop the development server and run the following command to push your database to the Render platform:

npx prisma db push

Once the command is executed, restart your server. At this point, all your data will be located on the cloud.

Conclusion

By following these steps, you can successfully host your database on the Render platform. This provides a free and straightforward alternative to Planetscale, with the added convenience of not requiring a credit card for signup.

Post a Comment

0Comments

Post a Comment (0)