Skip to content

stiliajohny/pasteportal

Repository files navigation

Contributors Forks Stargazers Issues GPL3 License LinkedIn Ask Me Anything
DeepScan grade DeepSource Codacy Badge


Main Logo

PastePortal

A text sharing tool for developers
Frontend
Report Bug · Request Feature

Table of Contents

About The Project

PastePortal is a revolutionary new application that makes sharing text a breeze. Designed with developers in mind, PastePortal eliminates the need for the traditional copy-paste method, making it easy to share context without any additional complexity.

Whether you're working on a large project with multiple team members or simply need to share a small snippet of code, PastePortal is the perfect solution. With its user-friendly interface and powerful functionality, it's no wonder why PastePortal is quickly becoming the go-to choice for developers everywhere.

Try it out today and see the difference for yourself!

Built With


Getting Started

Prerequisites

  • Node.js 18.x or higher
  • npm or yarn
  • Supabase account (SaaS)
  • Git

Installation

  1. Clone the repository
git clone https://github.com/stiliajohny/pasteportal.git
cd pasteportal
  1. Install dependencies
npm install
  1. Set up environment variables (see Environment Variables)

  2. Run Supabase migrations (see Supabase Setup)

  3. Start the development server

npm run dev

Open http://localhost:3000 to view the application.

Environment Variables

Create a .env.local file in the root directory with the following variables:

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
ENCRYPTION_KEY=your-32-byte-encryption-key-here
NEXT_PUBLIC_ADSENSE_CLIENT_ID=ca-pub-your-adsense-client-id
NEXT_PUBLIC_VSCODE_CALLBACK_URI=vscode://your.extension.id/auth-callback

Important Notes:

  • ENCRYPTION_KEY: Must be a secure random 32-byte key (64 hex characters) or any string that will be used to derive a 32-byte key using scrypt
  • NEXT_PUBLIC_ADSENSE_CLIENT_ID: Optional. Your Google AdSense client ID (format: ca-pub-xxxxxxxxxxxxxxx). If not set, AdSense ads will not be displayed.
  • NEXT_PUBLIC_VSCODE_CALLBACK_URI: Optional. Custom VS Code callback URI (e.g., vscode://publisher.extension/auth-callback). Defaults to vscode://JohnStilia.pasteportal/auth-callback when not set.
  • Keep your encryption key secure and never commit it to version control
  • For production, use a secure method to generate and store the encryption key

Supabase Setup

  1. Create a Supabase project (if you haven't already) at supabase.com

  2. Run migrations to set up the database schema:

# Using Supabase CLI (recommended)
supabase db push

# Or manually run the SQL migration file:
# supabase/migrations/001_initial_schema.sql
  1. Verify the table was created:

The migration creates a pastes table with the following structure:

  • id (TEXT, primary key, 6-character hex)
  • paste (TEXT, encrypted content)
  • recipient_gh_username (TEXT)
  • timestamp (TIMESTAMP)
  • created_at (TIMESTAMP)

The table includes Row Level Security (RLS) policies for public read/write access.

Usage

Using the Frontend

The frontend is available at https://pasteportal.app.

You can:

  • View pastes by visiting https://pasteportal.app?id=<paste-id>
  • Manually retrieve pastes using the sidebar "Get Paste" option
  • Install as a PWA for offline access

API Documentation

Version 1 API

POST /api/v1/store-paste

Store a new paste.

Request Body:

{
  "paste": "Your text content here",
  "recipient_gh_username": "recipient"
}

Response:

{
  "response": {
    "message": "The paste was successfully inserted into the database",
    "id": "abc123",
    "timestamp": "2024-01-01T00:00:00.000Z",
    "paste": "Your text content here",
    "joke": "A random programming joke"
  }
}

GET /api/v1/get-paste?id=<paste-id>

Retrieve a paste by ID.

Response:

{
  "response": {
    "message": "The paste was successfully retrieved from the database",
    "id": "abc123",
    "paste": "Your text content here",
    "recipient_gh_username": "recipient",
    "joke": "A random programming joke"
  }
}

Deployment

Netlify Deployment

The application is configured for deployment on Netlify:

  1. Connect your repository to Netlify

  2. Set environment variables in Netlify dashboard:

    • NEXT_PUBLIC_SUPABASE_URL
    • NEXT_PUBLIC_SUPABASE_ANON_KEY
    • ENCRYPTION_KEY
    • NEXT_PUBLIC_ADSENSE_CLIENT_ID (optional)
  3. Configure custom domain pasteportal.app in Netlify dashboard

  4. Deploy - Netlify will automatically build and deploy using the netlify.toml configuration

The netlify.toml file includes:

  • Build settings
  • API route redirects
  • PWA headers
  • Security headers

Security

Encryption

  • All paste content is encrypted using AES-256-GCM before storing in the database
  • Encryption key is stored in environment variables and never exposed to clients
  • Encryption/decryption happens server-side only

Best Practices

  • Always use a strong, randomly generated encryption key
  • Never commit .env.local or encryption keys to version control
  • Use environment variables for all sensitive configuration
  • Regularly rotate encryption keys in production

Roadmap

See the open issues for a list of proposed features (and known issues).


Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GPLv3 License. See LICENSE for more information.

Contact

John Stilia - stilia.johny@gmail.com


Acknowledgements

About

PastePortal is an easy-to-use VSCode extension that allows users to access and store pastes

Topics

Resources

License

Stars

Watchers

Forks

Contributors