A modern web application built with Next.js, featuring authentication, database management with Prisma, and a beautiful UI with Tailwind CSS.
- Framework: Next.js 15.5.5 with Turbopack
- Language: TypeScript
- Styling: Tailwind CSS 4
- Database: Prisma ORM with PostgreSQL
- Authentication: NextAuth.js
- State Management: TanStack React Query
- Package Manager: pnpm
Before you begin, ensure you have the following installed:
- Node.js (v18 or higher)
- pnpm package manager
- PostgreSQL database (or Supabase account)
-
Clone the repository
git clone <repository-url> cd pdf-editor
-
Install dependencies
pnpm install
-
Environment Setup
Create a
.envfile in the root directory:cp .env.example .env
Generate a secure secret for NextAuth:
openssl rand -base64 32
Add the generated secret to your
.envfile asNEXTAUTH_SECRET.Configure your database URLs:
DATABASE_URL: Your PostgreSQL connection stringDIRECT_URL: Direct database connection (for migrations)
You can get these from your Supabase project settings.
-
Database Setup
pnpm prisma:generate pnpm prisma:migrate pnpm prisma:seed
-
Start Development Server
pnpm dev
Open http://localhost:3000 in your browser.
pnpm dev- Start development server with Turbopackpnpm build- Build the application for productionpnpm start- Start production serverpnpm lint- Run ESLintpnpm format- Format code with Prettierpnpm prisma:generate- Generate Prisma clientpnpm prisma:migrate- Run database migrationspnpm prisma:seed- Seed the databasepnpm prisma:studio- Open Prisma Studiopnpm prisma:setup- Complete Prisma setup (generate + migrate)
src/
├── app/ # Next.js app router pages
├── components/ # Reusable React components
├── hooks/ # Custom React hooks
├── lib/ # Utility libraries and configurations
├── providers/ # React context providers
├── styles/ # Global styles
├── types/ # TypeScript type definitions
└── utils/ # Utility functions
The project uses several configuration files:
next.config.ts- Next.js configurationtailwind.config.js- Tailwind CSS configurationeslint.config.mjs- ESLint configurationprisma/schema.prisma- Database schema
User with customer role:
email-user@gmail.compassword-user1234
Follow these steps to test the authentication endpoints:
- Open Postman and create a new request
- Set method to POST
- Enter URL:
http://localhost:3000/api/auth/registration - Go to Body tab → select raw → choose JSON
- Enter the following JSON:
{
"name": "Test User",
"email": "test@example.com",
"password": "123456"
}- Send the request → should return 201 Created
- Create a new request
- Set method to POST
- Enter URL:
http://localhost:3000/api/auth/signin/credentials - Go to Body tab → select raw → choose JSON
- Enter the following JSON:
{
"email": "test@example.com",
"password": "123456"
}- Send the request → server will return session or token (if JWT is configured)
- Create a new request
- Set method to GET
- Enter URL:
http://localhost:3000/api/auth/session - Add session cookies from step B (Postman will automatically save them if Interceptor is enabled)
- Send the request → returns information about the current user
Make sure your .env file contains:
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your_long_random_secret_stringFor CredentialsProvider in NextAuth, the email and password must match your Prisma database records
- Ensure the development server is running (
pnpm dev) - Check that the database is properly configured and migrated
- Verify that the test user exists in the database before attempting login
Number: 4242 4242 4242 4242 Expiration: 12/25 CVV: 123