Skip to content

Data Model

Korta uses PostgreSQL with Prisma ORM. The data model is intentionally small and centered around users and shortened URLs.

Field Type Required Notes
id Int Yes Primary key, auto-increment.
email String Yes Unique user email.
password String | null No Present for email/password users.
googleId String | null No Unique Google OAuth identifier.
name String | null No Display name.
apiKey String | null No Unique integration key for X-API-Key.
isVerified Boolean Yes Email verification state.
verificationToken String | null No Temporary token for email verification flow.
createdAt DateTime Yes Auto-set on create.
updatedAt DateTime Yes Auto-updated on changes.
Field Type Required Notes
id Int Yes Primary key, auto-increment.
originalUrl String Yes Destination URL.
shortId String Yes Unique short slug.
clicks Int Yes Click counter, default 0.
userId Int | null No Owner user id (nullable for anonymous/public links).
createdAt DateTime Yes Auto-set on create.
updatedAt DateTime Yes Auto-updated on changes.
  • User (1) -> (N) Url: A user can own many shortened URLs.
  • Url (N) -> (0..1) User: A URL may belong to a user, or be anonymous (userId = null).
  • User.email is unique.
  • User.googleId is unique when present.
  • User.apiKey is unique when present.
  • Url.shortId is globally unique.