CLAUDE.md
Guides Claude Code on project structure, commands, architecture, and credentials for a Next.js room reservation system.
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
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:
USERandADMIN
Database Layer
- Prisma ORM with PostgreSQL
- Schema defined in prisma/schema.prisma
- Singleton pattern for Prisma client in lib/prisma.ts
- Three models:
User,Room,Reservation
API Routes Structure
All API routes are in app/api/:
/api/auth/[...nextauth]- NextAuth handlers/api/roomsand/api/rooms/[id]- Room CRUD (GET public, POST admin-only)/api/reservationsand/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/roomsand/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, Sidebarcomponents/ui/- Reusable UI componentscomponents/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
SmartOfficewith your project name - Replace
admin@wydzial.plandstudent@wydzial.plwith your test emails - Replace
admin123andstudent123with your test passwords - Replace
http://localhost:3000with 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
Code indexing for AI agents: summarization strategies and evaluation systems
Synthesises 2024-2025 research on code indexing for AI agents, covering summarisation strategies, hybrid retrieval architectures, and evaluation benchmarks.
write-script
Guides an AI through writing a YouTube video script with strict structural, language, and quiz rules for a survival channel.
Claude AI Git Workflow Integration
Recommends using the git-ai-commit CLI tool for AI-generated commit messages instead of manual ones.
Missing Business Agents Research — FLUXION 2026
Identifies 12 missing business operations agents for an indie software company and ranks them by impact and effort with €0 implementation plans.