Skip to content

Commit

Permalink
Merge pull request #83 from anjali-vaish/enhance/neon-db-readme-updated
Browse files Browse the repository at this point in the history
enhanced Neon DB setup in readme
  • Loading branch information
harshmangalam authored Oct 15, 2024
2 parents 4be32a1 + 307361d commit 2df623c
Showing 1 changed file with 43 additions and 15 deletions.
58 changes: 43 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,74 @@ Social media web app like Twitter build with Qwikcity
## Setup

Step 1 - Clone the repo
### Step 1 - Clone the repo

```shell
git clone https://github.com/harshmangalam/qwik-x.git
```

Step 2 - move to project
### Step 2 - move to project

```shell
cd qwik-x
```

Step 3 - Install dependencies
### Step 3 - Install dependencies

```shell
pnpm i
```

Step 4 - Copy .env.example to .env
### Step 4 - Copy .env.example to .env

```shell
cp .env.example .env
```

## Configure Neon for serverless postgresql db
## Configure Neon for Serverless PostgreSQL Database

Create free tier account https://neon.tech/
and use the db url in DRIZZLE_DATABASE_URL
Neon provides a serverless PostgreSQL that scales automatically and offers significant performance benefits. To integrate Neon with your Qwik-X app, follow these steps:

Step 7 - Create and sync schema in your database
### Step 1: Create a Neon Account

```shell
pnpm migration:push
```
- Sign up for a free tier account at [Neon](https://neon.tech/). Follow the prompts to set up your account.

Step 7 - Now start your dev server
### Step 2: Create Your Database

```shell
pnpm dev
```
- Once logged in, create a new database. Choose the appropriate region closest to your user base to minimize latency.
- After creating your database, you will be provided with a database URL. This URL is used to connect your application to the Neon database.

### Step 3: Configure Your Application

- Open the `.env` file in your project’s root directory.
- Replace the existing database URL with the one provided by Neon in the `DRIZZLE_DATABASE_URL` variable:
```
DRIZZLE_DATABASE_URL=postgres://{user}:{password}@{hostname}:{port}/{database}
```

### Step 4: Validate the Connection

- Ensure that your application can connect to the Neon database by running a simple test query or using the Drizzle ORM commands provided in your package scripts.

### Step 5: Schema Migration

- To create and sync the database schema:
```shell
pnpm migration:push
```
- This command will align your PostgreSQL schema with the current state of your application models.

### Step 6: Start Your Development Server

- Once the database is configured and the schema is in place, start your development server:
```shell
pnpm dev
```

### Troubleshooting

- If you encounter connection issues, verify the database URL and your internet connection.
- Ensure that your Neon account's security settings allow connections from your application’s IP address.

## PRs

Expand Down

0 comments on commit 2df623c

Please sign in to comment.