MCPSERV.CLUB
Pastefy

Pastefy

Self-Hosted

Share code snippets securely and effortlessly

Active(85)
361stars
0views
Updated 10 days ago

Overview

Discover what makes Pastefy powerful

Pastefy is a lightweight, open‑source paste‑bin service that exposes a RESTful API and a modern web UI for storing, sharing, and previewing code snippets. It is designed to be dropped into a developer workflow: you can `curl` files directly, embed it in IDE extensions, or consume its API from any language. The core idea is to provide a self‑hosted alternative to GitHub Gists or Pastebin with richer preview capabilities (Markdown, Mermaid, SVG, CSV, GeoJSON, etc.) and a developer‑friendly SDK ecosystem.

Backend

Frontend

Database

Containerization

Overview

Pastefy is a lightweight, open‑source paste‑bin service that exposes a RESTful API and a modern web UI for storing, sharing, and previewing code snippets. It is designed to be dropped into a developer workflow: you can curl files directly, embed it in IDE extensions, or consume its API from any language. The core idea is to provide a self‑hosted alternative to GitHub Gists or Pastebin with richer preview capabilities (Markdown, Mermaid, SVG, CSV, GeoJSON, etc.) and a developer‑friendly SDK ecosystem.

Technical Stack & Architecture

  • Backend: Java 21, Spring Boot 3, Maven. The API layer is a conventional REST controller exposing endpoints for CRUD operations on pastes, authentication flows, and webhooks. Security is handled by Spring Security with OAuth2/OpenID Connect support; the app can integrate with providers like Google, GitHub, Discord, Twitch, or a custom OIDC endpoint.
  • Frontend: React (Vite) with TypeScript. The UI is a single‑page application that consumes the same API endpoints, providing raw previews, syntax highlighting via PrismJS, and a copy‑to‑clipboard button. The frontend is built into static assets that the backend serves as a resource bundle.
  • Database: PostgreSQL is the default relational store, accessed via Spring Data JPA. The schema contains tables for users, pastes, and folders; the data model is intentionally simple to keep deployment overhead low.
  • Containerization: A Dockerfile for both backend and frontend is provided; a single‑image build produces a lightweight JAR with embedded static assets, enabling docker run or Docker‑Compose setups. A “container‑less” build path is also documented, allowing developers to run the app directly from a JDK or IDE.

Core Capabilities & APIs

  • Paste CRUD: Create, read (raw or rendered), update, delete. Pasting via curl -F f=@file.txt https://pastefy.app is supported out of the box.
  • User Management: OAuth2 authentication, folder organization, and activity tracking. Users can view, fork, or delete their pastes through the UI or API.
  • Rich Previews: The backend automatically detects file extensions and serves a preview component. Supported formats include Markdown, Mermaid diagrams, SVG, CSV tables, GeoJSON maps, Diff views, iCalendar files, regex syntax highlighting, and Asciinema recordings.
  • SDKs: Official client libraries exist for JavaScript/TypeScript, Java, and Go, simplifying integration. The API is documented on docs.pastefy.app/api/ with example payloads and error handling guidelines.
  • Extensibility: Webhooks can be configured for paste events; the SDKs expose event streams. Extensions for VS Code and Raycast allow developers to create, edit, or fetch pastes directly from their editor.

Deployment & Infrastructure

Pastefy is engineered for quick, low‑overhead deployment:

  • Docker: A single image runs the backend and serves static assets. Compose files expose environment variables for database connection, OAuth clients, and feature flags.
  • Container‑Less: Developers can clone the repo, build the frontend with npm, package the backend with Maven, and run the JAR directly. This is ideal for CI pipelines or local debugging.
  • Scalability: The stateless backend can be horizontally scaled behind a load balancer. PostgreSQL remains the single source of truth; replicas or read‑replicas can be added for high availability.
  • Resource Footprint: A minimal instance (2 GB RAM, 1 CPU) is sufficient for a small team; the image size stays below 200 MB, making it suitable for edge deployments.

Integration & Extensibility

  • OAuth Providers: Configure multiple providers simultaneously via environment variables (OAUTH2_GITHUB_CLIENT_ID, etc.). Custom OIDC endpoints are supported with additional auth endpoint URLs.
  • Webhooks: Expose JSON payloads for paste creation, update, and deletion. These can trigger CI jobs, Slack notifications, or other services.
  • Plugins: The frontend is built with a plugin‑friendly architecture; custom renderers can be added by extending the React component tree. The backend’s service layer is modular, allowing additional processors (e.g., virus scanning) to be injected.
  • CLI & SDK: The Java, Go, and JS SDKs provide typed interfaces for all API endpoints, making it trivial to integrate Pastefy into build scripts or IDE extensions.

Developer Experience

  • Configuration: All settings are exposed as environment variables; the docs provide a comprehensive list and examples. A .env.example file is shipped for quick starts.
  • Documentation: The official docs are organized by feature (API, self‑hosting, extensions) and include code snippets for common tasks. The API docs are auto‑generated from OpenAPI annotations.
  • Community & Support: Hosted on GitHub with an active issue tracker. The project encourages contributions, especially to the SDKs and preview components. Community discussions are available on Discord and GitHub Discussions.

Use Cases

  • Internal Knowledge Base: Teams can host a private Pastefy instance to store code snippets, configuration files, or troubleshooting logs with fine‑grained access control.
  • CI/CD Pipelines: Automated jobs can upload logs or artifacts to Pastefy via the

Open SourceReady to get started?

Join the community and start self-hosting Pastefy today