Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Papertrail Server

Papertrail Logo

A robust backend server for a modern blog and content management system.


Features

  • User Authentication: Secure authentication powered by Better-Auth.
  • Post Management: Full CRUD operations for blog posts with support for tags, featured posts, and drafts.
  • Commenting System: Interactive comments with nested replies (threading) and moderation control.
  • Admin Tools: Built-in scripts for seeding admin accounts.
  • Type Safety: Fully written in TypeScript with Prisma for end-to-end type safety.
  • Email Integration: Integrated with Nodemailer for system notifications.

Client Repository

The frontend client for this project is available at: https://github.com/amisadman/papertrail-client


Database Design

Below is the Entity-Relationship Diagram (ERD) representing the database structure:

erDiagram
    USER ||--o{ SESSION : "has"
    USER ||--o{ ACCOUNT : "has"
    USER ||--o{ POST : "authors"
    USER ||--o{ COMMENT : "writes"
    POST ||--o{ COMMENT : "contains"
    COMMENT ||--o{ COMMENT : "replies to"

    USER {
        string id PK
        string name
        string email UK
        boolean emailVerified
        string image
        string role
        string phone
        string status
        datetime createdAt
        datetime updatedAt
    }

    SESSION {
        string id PK
        string token UK
        datetime expiresAt
        string userId FK
        string ipAddress
        string userAgent
    }

    ACCOUNT {
        string id PK
        string accountId
        string providerId
        string userId FK
        string accessToken
        string refreshToken
        datetime accessTokenExpiresAt
    }

    POST {
        string id PK
        string title
        string content
        string thumbnail
        boolean isFeatured
        enum status
        string[] tags
        int views
        string authorId FK
        datetime createdAt
        datetime updatedAt
    }

    COMMENT {
        string id PK
        string content
        string authorId FK
        string postId FK
        string parentId FK
        enum status
        datetime createdAt
        datetime updatedAt
    }

    VERIFICATION {
        string id PK
        string identifier
        string value
        datetime expiresAt
    }
Loading

Tech Stack

Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/amisadman/papertrail-server.git
    cd papertrail-server
  2. Install dependencies:

    pnpm install
  3. Setup environment variables: Create a .env file in the root directory and add your configuration (see .env.example).

  4. Generate Prisma Client:

    npx prisma generate
  5. Run database migrations:

    npx prisma migrate dev

Running the Application

  • Development Mode:

    pnpm run dev
  • Seed Admin:

    pnpm run seed:admin

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages