Show HN: NextJS App Router Movie App with PostgreSQL

4 months ago 6

A Next.js App Router movie application allowing users to search, add, edit, and delete movies, backed by a PostgreSQL database.

Screenshot

After cloning the project install dependencies using package manager of your choice. We will use pnpm.

Then run the development server:

Open http://localhost:3000 with your browser to see the result.

This project uses a PostgreSQL database.

  • Create the database (for example see this Vercel guide).
  • Set up environment variables (see Environment Setup section below, for instructions on creating the .env file).
  • Visit: http://localhost:3000/api/seed, which will create all required tables and initial data.

Some routes are protected (e.g. adding a movie). You can use following username and password (this will be set by the seed endpoint above) for accessing those:

user: [email protected] pass: 123456
  • Copy the .env.example file and rename it to .env.
  • Edit .env to add your own configuration values.
  • Do not commit your .env file — it contains sensitive info.

Below is description of existing variables listed in .env.example.

  • DATABASE_URL: The PostgreSQL connection string used by the app to connect to the database.
  • SECRET_KEY: Secret key used for signing and verifying tokens or encrypting data. If not set in development, a default test-secret-key will be used.
Read Entire Article