Skip to content

alexfqc/next-auth-tasks

Repository files navigation

🧪 Fullstack App with Next.js, PostgreSQL, Prisma, Vitest and Playwright

This project is a fullstack web application built with:

  • Next.js (App Router)
  • 💾 PostgreSQL via Docker
  • 🔍 Prisma for database access
  • 📬 React Hook Form and Zod for validation
  • 🧪 Vitest for unit tests
  • 🎭 Playwright for end-to-end testing

📦 Prerequisites


🚀 Getting Started

1. Clone the repository

git clone git@github.com:alexfqc/next-auth-tasks.git
cd next-auth-tasks

2. Install dependencies

npm install

3. Copy the environment file and configure it

cp sample.ev .env

Create the file .env.test and add the env vars

DATABASE_URL="postgresql://postgres:postgres@localhost:5433/test_db"
IS_TEST=true

Create the file .env.playwright and add the env var

DATABASE_URL="postgresql://postgres:postgres@localhost:5434/playwright"
IS_TEST=true

4. Start PostgreSQL (and pgAdmin) with Docker

docker compose up -d

This will spin up:

  • postgres_dev (port 5432)
  • postgres_test (port 5433)
  • postgres_playwright (port 5434)
  • pgadmin (port 5050)

5. Push the Prisma schema to the database

npx prisma db push

Generate the Prisma Client:

npx prisma generate

🧑‍💻 Run the Application

npm run dev

Visit http://localhost:3000 to access the app.

🧪 Run Unit Tests

✅ Server-side tests

npm run test:server

✅ UI tests

npm run test:ui

🧭 Run End-to-End Tests (Playwright)

1. Run the development server SPECIFIC FOR E2E TESTS (it runs over playwright database)

  npm run run:e2e

2. Run the Playwright tests

  npm run test:e2e

🛠 Tips

Access pgAdmin at http://localhost:5050

Email: admin@admin.com

Password: admin

Hostnames (Connections tab):

postgres_dev → port 5432 → username postgres → password postgres → maintenance database dev_db

postgres_test → port 5432 → username postgres → password postgres → maintenance database test_db

postgres_playwright → port 5432 → username postgres → password postgres → maintenance database playwright

If prisma db push fails, ensure Docker is running and .env is properly set.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors