Skip to content

Latest commit

Β 

History

History
132 lines (97 loc) Β· 3.86 KB

File metadata and controls

132 lines (97 loc) Β· 3.86 KB

LovePaste ❀️

A modern, minimal, and distraction-free paste sharing service built with Next.js 15, Tailwind CSS, and shadcn/ui.

✨ Features

  • 🎨 Clean Monochrome Design - Lots of whitespace, Inter font, subtle gray borders
  • ⚑ Instant Link Generation - Get your shareable link in milliseconds
  • πŸ“‹ One-Click Copy - Copy code or share link with smooth feedback animation
  • πŸ” Auto Language Detection - Automatically detects JavaScript, Python, TypeScript, and more
  • 🎯 Syntax Highlighting - Beautiful code highlighting with Prism.js
  • ⏰ Expiration Options - Set pastes to expire after 1 hour, 1 day, 7 days, or 30 days
  • πŸ“ Raw View - View raw content for easy curl or script usage
  • ⌨️ Keyboard Shortcuts - Press Ctrl/Cmd + S to instantly share

πŸ› οΈ Tech Stack

πŸš€ Getting Started

Prerequisites

  • Node.js 18.17 or later
  • npm, yarn, or pnpm

Installation

  1. Install dependencies:

    npm install
  2. Set up environment variables:

    cp .env.example .env.local
  3. Start the development server:

    npm run dev
  4. Open http://localhost:3000 in your browser.

πŸ“ Project Structure

zenpaste/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/paste/          # API route for creating pastes
β”‚   β”‚   β”œβ”€β”€ p/[id]/             # Dynamic route for viewing pastes
β”‚   β”‚   β”‚   β”œβ”€β”€ page.tsx        # Paste view page
β”‚   β”‚   β”‚   β”œβ”€β”€ raw/page.tsx    # Raw view page
β”‚   β”‚   β”‚   └── not-found.tsx   # 404 for missing pastes
β”‚   β”‚   β”œβ”€β”€ globals.css         # Global styles
β”‚   β”‚   β”œβ”€β”€ layout.tsx          # Root layout
β”‚   β”‚   └── page.tsx            # Home page (editor)
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ ui/                 # shadcn/ui components
β”‚   β”‚   β”œβ”€β”€ CodeEditor.tsx      # Main editor component
β”‚   β”‚   β”œβ”€β”€ CodeViewer.tsx      # Syntax highlighted viewer
β”‚   β”‚   └── CopyButton.tsx      # Copy button with animation
β”‚   └── lib/
β”‚       β”œβ”€β”€ db.ts               # Database operations
β”‚       └── utils.ts            # Utility functions
β”œβ”€β”€ .env.example                # Example environment variables
└── package.json

πŸ—„οΈ Database Setup (Supabase)

The app comes with an in-memory store for development. For production, use Supabase:

1. Create a Supabase Project

Go to supabase.com and create a new project.

2. Create the Pastes Table

Run this SQL in the Supabase SQL Editor:

CREATE TABLE pastes (
  id TEXT PRIMARY KEY,
  content TEXT NOT NULL,
  language TEXT DEFAULT 'plaintext',
  expires_at TIMESTAMPTZ,
  created_at TIMESTAMPTZ DEFAULT NOW()
);

CREATE INDEX idx_pastes_expires_at ON pastes(expires_at);

3. Configure Environment Variables

Update your .env.local:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key

4. Update the Database File

Uncomment the Supabase code in src/lib/db.ts.

πŸ“¦ Building for Production

npm run build
npm run start

🚒 Deployment

Vercel (Recommended)

  1. Push your code to GitHub
  2. Import your repository on vercel.com
  3. Add your environment variables
  4. Deploy!

πŸ“„ License

MIT License