Skip to content

Commit

Permalink
examples: move Postgres example (#73531)
Browse files Browse the repository at this point in the history
This has a new home, with an updated template.

https://github.com/vercel/postgres-next-starter
  • Loading branch information
leerob authored Dec 4, 2024
1 parent eaf71ee commit fb12264
Show file tree
Hide file tree
Showing 17 changed files with 1 addition and 688 deletions.
64 changes: 1 addition & 63 deletions examples/with-postgres/README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,3 @@
# Postgres.js Example

An example using [Postgres.js](https://github.com/porsager/postgres) in a Next.js project.

## Deploy your own

Once you have access to [the environment variables you'll need](#configure-environment-variables), deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-postgres&project-name=with-postgres&repository-name=with-postgres&env=DATABASE_URL&envDescription=Required%20to%20connect%20the%20app%20with%20Postgres)

## How to use

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:

```bash
npx create-next-app --example with-postgres with-postgres-app
```

```bash
yarn create next-app --example with-postgres with-postgres-app
```

```bash
pnpm create next-app --example with-postgres with-postgres-app
```

## Configuration

### Set up a Postgres database

Set up a Postgres database locally or use your favorite provider.

### Configure environment variables

Copy the `.env.local.example` file in this directory to `.env.local` (this will be ignored by Git):

```bash
cp .env.local.example .env.local
```

Set the `DATABASE_URL` variable in `.env.local` to the connection uri of your postgres database.

### Apply migrations

To setup up the migrations, use:

```bash
npm run migrate:up
# or
yarn migrate:up
```

### Start Next.js in development mode

```bash
npm run dev
# or
yarn dev
```

Your app should now be up and running on [http://localhost:3000](http://localhost:3000)! If it doesn't work, post on [GitHub discussions](https://github.com/vercel/next.js/discussions).

## Deploy on Vercel

Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
This example has moved: https://github.com/vercel/postgres-next-starter
8 changes: 0 additions & 8 deletions examples/with-postgres/ley.config.js

This file was deleted.

5 changes: 0 additions & 5 deletions examples/with-postgres/lib/db.ts

This file was deleted.

35 changes: 0 additions & 35 deletions examples/with-postgres/lib/todos.ts

This file was deleted.

15 changes: 0 additions & 15 deletions examples/with-postgres/migrations/000-todos.js

This file was deleted.

5 changes: 0 additions & 5 deletions examples/with-postgres/next-env.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions examples/with-postgres/next.config.js

This file was deleted.

25 changes: 0 additions & 25 deletions examples/with-postgres/package.json

This file was deleted.

7 changes: 0 additions & 7 deletions examples/with-postgres/pages/_app.tsx

This file was deleted.

23 changes: 0 additions & 23 deletions examples/with-postgres/pages/api/todos.ts

This file was deleted.

175 changes: 0 additions & 175 deletions examples/with-postgres/pages/index.tsx

This file was deleted.

Binary file removed examples/with-postgres/public/favicon.ico
Binary file not shown.
4 changes: 0 additions & 4 deletions examples/with-postgres/public/vercel.svg

This file was deleted.

Loading

0 comments on commit fb12264

Please # to comment.