Back to .md Directory

CLAUDE.md

Guides Claude Code on project structure, commands, architecture, and credentials for a Next.js room reservation system.

May 2, 2026
0 downloads
0 views
ai claude
View source

What this file does

Guides Claude Code on project structure, commands, architecture, and credentials for a Next.js room reservation system.

When to use it

  • Setting up Claude Code to assist with a Next.js 16 App Router project
  • Onboarding a new developer to a Prisma/PostgreSQL monorepo
  • Standardising AI assistant context for a room booking app
  • Documenting test credentials and seed data for a demo

Assumes this stack

Next.js 16React 19TypeScriptPostgreSQLPrismaNextAuth.js 5

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

SmartOffice is a room reservation system for conference and lecture rooms with an interactive horseshoe-shaped floor plan. Built with Next.js 16 (App Router), React 19, TypeScript, PostgreSQL/Prisma, and NextAuth.js 5.

Common Commands

# Development
npm run dev              # Start dev server at localhost:3000
npm run build            # Build for production (runs prisma generate first)
npm run lint             # Run ESLint

# Database
npx prisma generate      # Generate Prisma Client (also runs on npm install)
npx prisma db push       # Push schema changes to database
npx prisma studio        # Open database GUI
npx prisma migrate dev   # Create and run migrations

# Docker (recommended for quick start)
docker-compose up -d     # Start PostgreSQL + app
docker-compose down -v   # Stop and remove volumes

# Seeding
curl -X POST http://localhost:3000/api/seed  # Load test data

Architecture

Authentication Flow

  • NextAuth.js v5 with JWT strategy, configured in lib/auth.ts
  • Middleware at middleware.ts protects routes and redirects unauthenticated users
  • Credentials provider with bcrypt password hashing
  • User roles: USER and ADMIN

Database Layer

API Routes Structure

All API routes are in app/api/:

  • /api/auth/[...nextauth] - NextAuth handlers
  • /api/rooms and /api/rooms/[id] - Room CRUD (GET public, POST admin-only)
  • /api/reservations and /api/reservations/[id] - Reservation management
  • /api/users - User management (admin-only)
  • /api/seed - Database seeding endpoint
  • /api/health - Health check

Page Routes

  • /dashboard - User home after login
  • /rooms and /rooms/[id] - Room listing and details/booking
  • /floor-plan - Interactive floor visualization (4 floors, 10 rooms each)
  • /reservations - User's reservations
  • /calendar - Calendar view
  • /admin - Admin panel
  • /login, /register - Auth pages

Component Structure

  • components/layout/ - Navbar, Sidebar
  • components/ui/ - Reusable UI components
  • components/Providers.tsx - Session provider wrapper

Types

Custom TypeScript types in types/index.ts, NextAuth extensions in types/next-auth.d.ts.

Environment Variables

Required in .env:

DATABASE_URL=postgresql://user:password@localhost:5432/smartoffice
AUTH_SECRET=<min-32-char-secret>  # Generate: openssl rand -base64 32
AUTH_URL=http://localhost:3000

Test Credentials (after seeding)

  • Admin: admin@wydzial.pl / admin123
  • User: student@wydzial.pl / student123

What's inside

7 sections: overview, commands, architecture (auth, DB, API, pages, components, types), env vars, test credentials.

Change this for your project

  • Replace SmartOffice with your project name
  • Replace admin@wydzial.pl and student@wydzial.pl with your test emails
  • Replace admin123 and student123 with your test passwords
  • Replace http://localhost:3000 with your actual dev URL

Where it goes

Save as CLAUDE.md in your repository root. Claude Code reads it automatically at the start of every session.

Worth borrowing

  • Separating commands into dev, database, Docker, and seeding groups for quick reference
  • Listing test credentials directly in the file so AI can log in without asking

Related Documents