Skip to content

Latest commit

Β 

History

History
92 lines (65 loc) Β· 4.12 KB

File metadata and controls

92 lines (65 loc) Β· 4.12 KB

πŸš€ @maevsi/postgraphile

A blazing-fast GraphQL API layer for PostgreSQL, powering the Vibetype event community platform.

Overview

This is a production-ready PostGraphile v5 server that automatically generates a powerful GraphQL API directly from your PostgreSQL schema. It's a core service of the Vibetype platform, seamlessly converting database changes into a secure, performant GraphQL interface.

✨ Key Features

  • πŸ”„ Auto-Generated GraphQL API: Full CRUD operations from your PostgreSQL schema
  • 🌍 PostGIS Support: Built-in geospatial capabilities with @graphile/postgis
  • πŸ” JWT Authentication: ES256 ECDSA-signed tokens with claim-based authorization
  • ⚑ Grafast Optimizations: Deep SQL query optimization and N+1 prevention
  • 🎨 Amber Preset: Sensible defaults for a modern development experience
  • πŸ“¦ TypeScript Ready: Full type safety from database to API
  • 🐳 Docker Native: Containerized with automatic pnpm setup

Quick Start

Prerequisites

Node.js, PostgreSQL with Vibetype schema migrations applied via sqitch, and pnpm.

Development

pnpm install    # Install dependencies
pnpm run lint   # Lint code

# Docker
docker build -t maevsi/postgraphile .

Architecture

This service is part of the Vibetype platform, an event community ecosystem:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Frontend (Nuxt)                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ GraphQL
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     GraphQL API (PostGraphile)              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ SQL queries and mutations
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Database (PostgreSQL)                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ SQL schema
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Migrations (Sqitch)                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

See maevsi/stack for the full Docker setup.

Project Structure

src/
β”œβ”€β”€ graphile.config.ts    # Main PostGraphile configuration
β”œβ”€β”€ graphile.ts           # Scripted logic
└── environment.ts        # Type-safe environment utilities

Authentication

Authentication uses ES256 (ECDSA) for signing JWTs; tokens use postgraphile as both issuer and audience and are represented in PostgreSQL by the composite type vibetype.jwt.

The signing keys and related secrets are best configured via environment variables in maevsi/stack.

Docker

The included docker-entrypoint.sh automatically:

  • Loads environment variables from /run/environment-variables (Docker secrets)
  • Installs dependencies in development mode
  • Passes control to the postgraphile command

Resources


Questions or Issues? Open an issue, we're here to help!