Skip to content

irabruce10/next.js-ecommerce-store

Repository files navigation

Design and develop an ecommerce store using Next.js. It should have the following:

Technologies

Next.js

Postgres.js

Jest

Playwright

Database Setup

If you don't have PostgreSQL installed yet, follow the instructions from the PostgreSQL step in UpLeveled's System Setup Instructions.

Copy the .env.example file to a new file called .env (ignored from Git) and fill in the necessary information.

Then, connect to the built-in postgres database as administrator in order to create the database:

Windows

If it asks for a password, use postgres.

psql -U postgres

macOS

psql postgres

Linux

sudo -u postgres psql

Once you have connected, run the following to create the database:

CREATE DATABASE ; CREATE USER WITH ENCRYPTED PASSWORD ''; GRANT ALL PRIVILEGES ON DATABASE TO ; \connect CREATE SCHEMA AUTHORIZATION ; Quit psql using the following command:

\q On Linux, it is best practice to create an operating system user for each database, to ensure that the operating system user can only access the single database and no other system resources. A different password is needed on Linux because passwords of operating system users cannot contain the user name. First, generate a random password and copy it:

openssl rand -hex 16 Then create the user, using the database user name from the previous section above. When you are prompted to create a password for the user, paste in the generated password.

sudo adduser Once you're ready to use the new user, reconnect using the following command.

Windows and macOS:

psql -U

Linux:

sudo -u psql -U

Run Tests

Jest

pnpm jest

Playwright

pnpm playwright test