Skip to content
A complete authentication system built in Postgres using schemas and functions
PLpgSQL JavaScript PLSQL
Branch: master
Clone or download

Latest commit


Type Name Latest commit message Commit time
Failed to load latest commit information.

A Bit of Crazy

I'm fairly certain that the existence of this repo will cause anxiety. It's just a thought exercise - people have asked, so here it is.

This is the Postgres Authentication stuff - meaning it's a full authentication system in a box, in your DB. I flipped out one weekend and decided to see if I could do it... I could, so here it is.

Still a bit raw, but tests are passing nicely. Still need to work on a few things.


I tried to make everything as self-contained as I could. So, to install this just crack open index.js and set DB to whatever local database you want to use.

And then...

npm install
node index.js

This will execute a bulk SQL transaction against your database and will:

  • Create a schema called "membership"
  • Install pgcrypto for hashing passwords
  • Drop in the schema, tables, functions etc needed for this crazy


If you want to play around, the test db is called pg_auth and I build it on the fly. You can see all the scripts in the build/src directory - these get built and dropped into build/dist. If all you want is to check stuff out just install as above and have a good time.

This is Supposed To Be Fun

I like seeing what Postgres can do, and I'm not the world's best programmer so if you see some things that are interesting, have some fun.

You can’t perform that action at this time.