Skip to content

Easy to use ephemeral postgres hypervisor for educational environments

Notifications You must be signed in to change notification settings

sad-pixel/pglite-hypervisor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pglite-hypervisor

PostgreSQL server providing ephemeral per-user databases for educational environments.

What it does

Each user connecting to this server gets their own isolated, in-memory PostgreSQL database. When they disconnect, their database is destroyed. Each database is initialized from a SQL dump file based on the username.

Installation

git clone https://github.com/sad-pixel/pglite-hypervisor.git
cd pglite-hypervisor
bun install

Usage

bun start

With options:

bun start --port 5433 --dump-dir ./my_dumps --debug

Options

  • -p, --port - Port to listen on (default: 5432)
  • -h, --host - Host to bind to (default: 127.0.0.1)
  • -d, --dump-dir - Directory containing SQL dump files (default: ./db_dumps)
  • -v, --debug - Enable debug logging
  • --help - Show help message

SQL Dump Files

Place SQL dump files in the dump directory named as <username>.sql

Example:

db_dumps/
  dataset1.sql
  dataset2.sql
  eshop.sql

Connecting

psql -h 127.0.0.1 -p 5432 -U <username> -d postgres

Password must match the username.

Example:

psql -h 127.0.0.1 -p 5432 -U student1 -d postgres
# Password: student1

How it works

  1. Client connects with username
  2. Server creates a new PGlite instance in memory
  3. Server loads <username>.sql from the dump directory
  4. Client can query their isolated database
  5. When client disconnects, database is destroyed

License

The included SQL dump files (eshop.sql, flis.sql, lis.sql, and university.sql) are copyright IIT Madras and may only be used for educational purposes.

The code is under MIT license subject to the statement below:

Copyright 2026 Ishan Das Sharma

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Easy to use ephemeral postgres hypervisor for educational environments

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published