A Next.js App Router movie application allowing users to search, add, edit, and delete movies, backed by a PostgreSQL database.
Accompanying blog post.
After cloning the project install dependencies using package manager of your choice. We will use pnpm
.
pnpm install
Then run the development server:
pnpm dev
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: demo@gmail.com
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 defaulttest-secret-key
will be used.