Skip to content

Files

Latest commit

 

History

History

with-nextjs-server-actions

Getting started with Neon and Next.js Server Actions

Clone the repository

npx degit neondatabase/examples/with-nextjs-server-actions ./with-nextjs-server-actions

Run the command below to copy the .env.example file:

cp .env.example .env

Store your Neon credentials

Store your Neon credentials in your .env file.

DATABASE_URL="postgresql://neondb_owner:...@ep-...us-east-1.aws.neon.tech/neondb?sslmode=require"
  • user is the database user.
  • password is the database user’s password.
  • endpoint_hostname is the host with neon.tech as the TLD.
  • dbname is the name of the database. “neondb” is the default database created with each Neon project.
  • ?sslmode=require an optional query parameter that enforces the SSL mode while connecting to the Postgres instance for better security.

Important: To ensure the security of your data, never expose your Neon credentials to the browser.

Run the command below to install project dependencies:

npm install

Run the Next.js application using the following command:

npm run dev