Neon
Connecting to Neon Database from a DevZero workspace.
Architecture Diagram
Prerequisites
Basic knowledge of Neon DB and Neon DB branching
Creating a Branch
- Go to Your Project > Project Dashboard.
- Click on Branch , create a new branch.
- Give it a name and select Current point in time to create the branch off the current state of your main database.
Once the branch is created, please copy the connection string and add it to your user environment secrets. In this guide, it is saved as DATABASE_URL
.
Building a Todo App
For the purpose of this guide, we will be using a todo app built with nextjs that requires an environment variable called DATABASE_URL
. We will be creating a recipe for this application and we will launch a workspace based on it.
Build Steps
- install linux helper packages
- clone repo
- install nodejs
- run
npm install
- run
npm run build
: in this step, we need the database URL to be present so we can run some prisma commands that are required for manipulating the database
Launch Steps
npm start
: to start the application
Creating a Recipe for our ToDo App
When asked for repository, feel free to use https://github.com/myestery/todo-app or create a fork of it if you want to follow this guide.
We will be implementing the above steps using the recipe file below
The Recipe page has some helper snippet to guide you in generating such files
Creating a workspace
Now that we have a working recipe, we can create a workspace off it from the recipes page by clicking launch.