Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nextjs/saas-starter/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The database schema is built with Drizzle ORM and PostgreSQL. All tables are defined inlib/db/schema.ts with full TypeScript type inference.
Tables
users
Stores user account information including authentication credentials and profile data.Primary key, auto-incrementing integer
User’s display name
User’s email address. Must be unique and not null.
Hashed password for authentication
User role in the system
Timestamp when the user account was created
Timestamp when the user account was last updated
Soft delete timestamp. Null if account is active.
teams
Stores team/organization information including Stripe subscription data.Primary key, auto-incrementing integer
Team name
Timestamp when the team was created
Timestamp when the team was last updated
Stripe customer ID. Must be unique if set.
Stripe subscription ID. Must be unique if set.
Stripe product ID for the current subscription
Name of the current subscription plan
Current status of the subscription (e.g., ‘active’, ‘canceled’, ‘past_due’)
teamMembers
Junction table linking users to teams with role information.Primary key, auto-incrementing integer
Foreign key reference to
users.idForeign key reference to
teams.idUser’s role within the team
Timestamp when the user joined the team
activityLogs
Audit log tracking user and team activities.Primary key, auto-incrementing integer
Foreign key reference to
teams.idForeign key reference to
users.id. Nullable for system actions.Description of the action performed (see ActivityType enum)
Timestamp when the action occurred
IP address from which the action was performed (supports IPv4 and IPv6)
invitations
Stores pending team invitations.Primary key, auto-incrementing integer
Foreign key reference to
teams.idEmail address of the invited user
Role the invited user will have upon accepting
Foreign key reference to
users.id of the user who sent the invitationTimestamp when the invitation was sent
Invitation status (e.g., ‘pending’, ‘accepted’, ‘declined’)
TypeScript Types
Select Types
Inferred types for reading from the database.Inferred from
users table using $inferSelectInferred from
teams table using $inferSelectInferred from
teamMembers table using $inferSelectInferred from
activityLogs table using $inferSelectInferred from
invitations table using $inferSelectInsert Types
Inferred types for inserting into the database.Inferred from
users table using $inferInsert. Auto-generated fields are optional.Inferred from
teams table using $inferInsert. Auto-generated fields are optional.Inferred from
teamMembers table using $inferInsert. Auto-generated fields are optional.Inferred from
activityLogs table using $inferInsert. Auto-generated fields are optional.Inferred from
invitations table using $inferInsert. Auto-generated fields are optional.Composite Types
Extended team type with nested member data
Enums
ActivityType
Defines the possible activity types for audit logging.User account creation
User authentication
User logout
Password change
Account deletion
Account information update
New team creation
Team member removal
Team invitation sent
Team invitation accepted