Database Schema
Person Model
The core data model for the Person App. Each person record stores comprehensive contact and biographical information.
model Person {
id Int @id @default(autoincrement())
name String
email String @unique
phone String?
address String?
bio String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}Field Descriptions
id
Int @id @default(autoincrement())
Unique primary key, auto-incremented on each new record.
name
String
Person's full name - required field.
String @unique
Unique email address - required and enforced at database level.
phone
String?
Optional phone number (? indicates nullable field).
address
String?
Optional street address or location.
bio
String?
Optional biographical information or description.
createdAt
DateTime @default(now())
Automatic timestamp when record is created.
updatedAt
DateTime @updatedAt
Automatic timestamp updated on every record modification.
Prisma Configuration
This application uses PostgreSQL as the database provider with Prisma ORM for type-safe database access.
datasource db {
provider = "postgresql"
}
generator client {
provider = "prisma-client"
output = "../lib/generated/prisma"
}Neon PostgreSQL Database
This application is configured to use Neon, a serverless PostgreSQL database platform. Neon provides auto-scaling, connection pooling, and automatic backups without requiring infrastructure management.
Key Neon Features
- Serverless: Automatic scaling with zero downtime
- Connection Pooling: Built-in pooler endpoint for Vercel deployments
- Auto-Backups: Automatic daily backups with point-in-time recovery
- Multi-Region: Deploy across multiple regions for low latency
Connection Strings
Neon provides two connection endpoints:
Use the pooler endpoint for serverless deployments (Vercel).
Environment Setup
Key Features
- Type Safety: Prisma client provides full TypeScript type inference
- Automatic Migrations: Database schema changes tracked and versioned
- Query Builder: Intuitive API for complex database operations
- Validation: Email uniqueness and required fields enforced at database level
- Timestamps: Automatic tracking of creation and modification times
Getting Started
The database is automatically provisioned and ready to use. All CRUD operations are handled through Next.js Server Actions, providing a seamless integration between frontend and database.
← Back to Person Directory