ZNEWS

3 Mar 2025

node.js next.js vercel

Hacker News like platform where you can create accounts, post links, upvote and downvote posts, and comment on posts.

znews

Features

PostgreSQL Database

db schema
DBML Schema
Enum vote_enum {
  up
  down
}
 
Table user {
  id integer [primary key, increment]
  username varchar [unique, not null]
  email varchar [unique, not null]
  password varchar [not null]
  created_at timestamp [default: 'now()']
}
 
Table post {
  id integer [primary key]
  title varchar [not null]
  link text [not null]
  user_id integer [not null]
  created_at timestamp [default: 'now()']
}
 
Table comment {
  id integer [primary key]
  created_at timestamp [default: 'now()']
  post_id integer [not null]
  user_id integer [not null]
  comment text [not null]
  parent_id integer
}
 
Table vote {
  id integer [primary key]
  post_id integer [not null]
  user_id integer [not null]
  created_at timestamp [default: 'now()']
  vote vote_enum [default: null]
}
 
// Relationships (Foreign Keys)
 
Ref: post.user_id > user.id 
Ref: comment.post_id > post.id [delete: cascade]
Ref: comment.user_id > user.id
Ref: comment.parent_id > comment.id
Ref: vote.post_id > post.id
Ref: vote.user_id > user.id
 

Packages


Links


©zsphinx2026