Appearance
Atlas Data Models
All models are defined in packages/db/schema.prisma with MongoDB as the provider. Zod types are auto-generated via zod-prisma-types.
Entity Relationship Overview
User & Auth
User
Core user record managed by Better-Auth.
| Field | Type | Notes |
|---|---|---|
id | String | MongoDB ObjectId |
email | String | Unique |
name | String | |
role | Enum | USER | ADMIN |
phone | String? | |
location | String? | |
profession | String? | |
onboardingCompleted | Boolean | Default: false |
banned | Boolean? | |
twoFactorEnabled | Boolean? |
Session
Better-Auth session tokens (cookie-based).
| Field | Type |
|---|---|
token | String (unique) |
expiresAt | DateTime |
userId | String (FK) |
ipAddress | String? |
userAgent | String? |
Account
OAuth provider accounts linked to a user (Google, Stripe).
| Field | Type |
|---|---|
accountId | String |
providerId | String |
accessToken | String? |
refreshToken | String? |
userId | String (FK) |
Credits & Billing
Billing
One-to-one per user. Tracks Chargebee subscription state.
| Field | Type | Notes |
|---|---|---|
userId | String | Unique |
chargebeeCustomerId | String? | |
chargebeeSubscriptionId | String? | |
subscriptionStatus | Enum | active | cancelled | non_renewing | paused |
subscriptionPlanId | String? |
Credit
One-to-one per user. Tracks available credits.
| Field | Type | Notes |
|---|---|---|
userId | String | Unique |
subscriptionCredits | Int | Resets each billing period |
purchasedCredits | Int | Permanent (never reset) |
creditAvailable | Int | subscriptionCredits + purchasedCredits |
CreditUsage
Tracks credit consumption per operation type.
| Field | Type |
|---|---|
creditId | String (FK) |
creditType | Enum: SEARCH | SKIPTRACE |
creditReserved | Int |
creditUsed | Int |
CreditLog
Immutable audit trail of credit changes.
| Field | Type |
|---|---|
creditId | String (FK) |
creditType | Enum |
creditBefore | Int |
creditAfter | Int |
changeAmount | Int |
timestamp | DateTime |
CreditWeight
Configurable credit cost per operation (adjustable by admin).
| Field | Type | Notes |
|---|---|---|
creditType | Enum | SEARCH | SKIPTRACE — Unique |
weight | Float | e.g., 1.0 for search, 0.5 for skiptrace |
PaymentTransaction
Each Chargebee invoice/transaction is recorded here.
| Field | Type |
|---|---|
userId | String |
chargebeeInvoiceId | String? |
chargebeeTransactionId | String? |
type | subscription | one_time_purchase | credit_adjustment |
status | success | pending | failed | refunded |
amount | Float |
creditsAdded | Int |
planId / planName | String? |
billingPeriod | String? |
transactionDate | DateTime |
Properties & Search
Properties
Cached property records from BatchData.
| Field | Type | Notes |
|---|---|---|
propertyId | String | Unique — BatchData ID |
address | String | |
city / county / state / postal_code | String | |
data | Json | Full BatchData response |
googleImages | String[] | S3 keys |
hasImageSearched | Boolean | Flag to avoid re-fetching |
PropertyDatasetPermission
Tracks which datasets a user has unlocked for a specific property.
| Field | Type |
|---|---|
userId | String |
propertyId | String |
datasets | Enum[] |
Dataset enum values: BASIC, BATCHRANK, CONTACT, DEED, DEMOGRAPHIC, FORECLOSURE, LISTING, MORTGAGE_LIENS, OWNER, PERMIT, QUICKLIST, VALUATION, DIVORCE_INFO
SavedSearch
A named saved search with filters and associated property results.
| Field | Type |
|---|---|
userId | String |
name | String |
filters | Json |
createdAt | DateTime |
lastRunAt | DateTime? |
Many-to-many with Properties.
Leads & Enrichment
Leads (Lead Group)
| Field | Type |
|---|---|
name | String |
description | String? |
totalContacts | Int |
fileName | String? |
tags | String[] |
isDeleted | Boolean |
userId | String (FK) |
Contacts
| Field | Type |
|---|---|
firstName / lastName | String? |
email / phone | String? |
company / linkedin | String? |
address, city, state, zip | String? |
isEnriched | Boolean |
enrichedAt | DateTime? |
enrichmentSource | String? |
isDivorceLead | Boolean |
engagementScore | Int? |
leadsId | String (FK) |
Enrichment
Tracks the overall enrichment (skip-trace) job for a lead group.
| Field | Type |
|---|---|
leadId | String (FK) |
status | processing | completed | failed |
totalBatches | Int |
totalLeads | Int |
EnrichmentBatchs
Individual batch within an enrichment job.
| Field | Type |
|---|---|
enrichmentId | String (FK) |
batchNumber | Int |
totalContacts | Int |
status | pending | completed | failed |
enrichedCount / skippedCount | Int |
uploadId | String? |
metadata | Json? |
Divorce Leads
DivorceLead
| Field | Type |
|---|---|
userId | String |
propertyId | String? |
leadId | String? |
state / city / zip / county | String? |
filingDate / scrapedDate | DateTime? |
owner1Name / owner2Name | String? |
owner1Phones / owner2Phones | String[] |
owner1Emails / owner2Emails | String[] |
propertyAddress | Json? |
enrichmentScore | Float? |
confidence | Float? |
status | new | viewed | ... |
rawData | Json |
Other Models
HelpCenterArticle
| Field | Type |
|---|---|
title / content | String |
slug | String (unique) |
category | Enum (6 categories) |
tags | String[] |
published | Boolean |
views | Int |
order | Int |
FeatureRequest
| Field | Type |
|---|---|
userId | String |
requestType | String |
quickSignals | String[] |
description | String? |
status | PENDING | REVIEWED | IN_PROGRESS | COMPLETED | REJECTED |
priority | LOW | MEDIUM | HIGH | CRITICAL |
adminNotes | String? |