Skip to content
ParsaJRPublic

About

A generic pastebin service that you can own, powered by FastAPI & Vue.JS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Pastore

A pastebin service that you can actually own.

Scroll down the README for some pretty gifs

Table of Contents

Too long, didn't read

  • A good looking web client, powered by Vue.JS & Nuxt UI
  • Beautiful syntax highlighting, powered by Shiki
  • Automatic language detecting powered by Flourite
  • Administration capabilities
  • Opt-in caching, powered by Redis.py
  • Metric exporter

Web-client

Pastore provides a simple, client-side web interface, which is served by the FastAPI app. Pastore's Web-app stands on the shoulder of Vue.JS & Nuxt UI

Syntax highlighting

Pastore's web client provides a simple yet beautiful syntax highlighting, powered by Shiki and Flourite

Administration

Just navigate to /admin, and then, things are easy to discover.

Caching

The application is able to use Redis as its caching solution, if you provide the needed configuration.

Metrics

The application is able to export some useful metrics, useful for getting an insight. refer to configuration section to see how to set it up.

Configuration

Pastore can be configured through environment variables. All configuration variables must be prefixed with PASTORE_.

During development, you can also use a .env file in the project's root directory. Environment variables take precedence over values defined in the .env file.

Variable Default Description
PASTORE_APP_NAME Pastore Application name. It will be displayed on your webapp.
PASTORE_DEVELOPMENT false Enable development mode.
PASTORE_INITIAL_ADMIN_PASSWORD None Initial administrator password. Must include number and letter

Database

Pastore uses PostgreSQL as its primary database. You'll need to set most of these variables:

Variable Default Description
PASTORE_DATABASE_HOST localhost PostgreSQL server hostname or IP address.
PASTORE_DATABASE_PORT 5432 PostgreSQL server port.
PASTORE_DATABASE_USERNAME postgres Database username.
PASTORE_DATABASE_PASSWORD secret Database password.
PASTORE_DATABASE_NAME pasted Database name.

Redis Caching

Redis is an optional dependency. If caching is not required, you can leave it disabled and run Pastore without Redis.

Variable Default Description
PASTORE_REDIS_ENABLED false Enable Redis-backed caching.
PASTORE_REDIS_HOST localhost Redis server hostname or IP address.
PASTORE_REDIS_PORT 6379 Redis server port.
PASTORE_REDIS_PASSWORD Empty Redis authentication password.

Metrics

Pastore can expose application metrics through a Prometheus-compatible metrics endpoint. The authentication of the metrics endpoint is based on the simple HTTP Basic Auth method.

Variable Default Description
PASTORE_METRICS_ENABLED false Enable the metrics endpoint.
PASTORE_METRICS_USERNAME Empty Username for HTTP Basic Authentication.
PASTORE_METRICS_PASSWORD Empty Password for HTTP Basic Authentication.

Authentication

Pastore uses JWT for authentication. Used for signing the tokens.

Variable Default Description
PASTORE_JWT_SECRET Automatically generated Secret used for signing JWTs.
PASTORE_JWT_TTL 604800(7 days!) JWT expiration time in seconds.

Important: It is recommended to explicitly configure PASTORE_JWT_SECRET in production. Otherwise, a new secret will be generated whenever the application starts, invalidating previously issued tokens.

Logging

Variable Default Description
PASTORE_LOG_ENABLED true Enable application logging.
PASTORE_LOG_STRUCTURED false Enable structured logging.
PASTORE_LOG_LEVEL Debug Minimum logging level. Available options are Info and Debug

Example

Here is an example .env file with some commonly configured options:

PASTORE_DEVELOPMENT=false

# Initial administrator account
PASTORE_INITIAL_ADMIN_PASSWORD=change-me

# Database
PASTORE_DATABASE_HOST=localhost
PASTORE_DATABASE_PORT=5432
PASTORE_DATABASE_USERNAME=postgres
PASTORE_DATABASE_PASSWORD=your-database-password
PASTORE_DATABASE_NAME=pasted

# Redis (optional)
PASTORE_REDIS_ENABLED=true
PASTORE_REDIS_HOST=localhost
PASTORE_REDIS_PORT=6379

# Authentication
PASTORE_JWT_SECRET=replace-with-a-long-random-secret

# Prometheus metrics (optional)
PASTORE_METRICS_ENABLED=true
PASTORE_METRICS_USERNAME=prometheus
PASTORE_METRICS_PASSWORD=change-me

Deployment

Pastore currently provides a ready-to-ship docker images at Dockerhub.

Docker-compose

Use the docker-compose.yaml file to setup the service. Follow the instructions below:

  1. Run the prestart.sh script. It sets up the migration for the database schema:
docker compose run --rm api bash prestart.sh
  1. Then, run the compose template in detached mode:
docker compose run -d

The compose template defines two services:

  • A PostgreSQL database container db which stores all the persistent data.

  • Api service which runs the Pastore api and hosts its front-end client.

After that, your service is ready to be served at port 8080. You can serve it either directly, or by using a reverse proxy like Caddy or Nginx.

Development

Make sure to install the following dependencies:

This project uses uv and pnpm as a package manager toolkit for back-end and front-end sides, respectively.

Also, just, the command runner, defines some common development tasks to help you get started.

All three of these should automatically be installed by mise.

  1. Install the project's dependencies:
mise install
  1. Use the justfile to help you get started:
just setup-api

just setup-db

just run-api

See the complete list of commands using just --list.

Preview

ezgif-8d9e6ab0af591b68

About

A generic pastebin service that you can own, powered by FastAPI & Vue.JS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages