Skip to content

Plock is an all in one authentication server, providing email & password, email verification codes, two-factor authentication, OAuth with social providers, and passkey authentication.

Notifications You must be signed in to change notification settings

eliottwantz/plock

Repository files navigation

Plock

Plock is an all-in-one authentication server, providing email & password, email verification codes, two-factor authentication, OAuth with social providers, and passkey authentication, with session management using cookies and bearer tokens.

Warning

N.B. This project is still in early development. It is not ready for production use yet. It currently only supports Turso and Postgres as the database. I am gradually adding support for other databases, such as SQLite and MySQL.


Table of content

Usage

Simply pull the Docker image and use it with your app:

docker pull ghcr.io/eliottwantz/plock:latest
docker run -it --rm -p 5173:5173 ghcr.io/eliottwantz/plock:latest

or with docker-compose:

services:
  plock:
    image: ghcr.io/eliottwantz/plock:latest
    ports:
      - 5173:5173
    env_file:
      - .env

Environment variables

General environment

Please check an example of the .env file in the example examples/simple

Name Description
PORT The port to listen on. Defaults to 5173.
ENV The environment to run in, either DEV or PROD
GOOGLE_CLIENT_ID The client ID of the Google OAuth provider.
GOOGLE_CLIENT_SECRET The client secret of the Google OAuth provider.
GOOGLE_AUTH_CALLBACK_URL The callback URL of the Google OAuth provider.
GITHUB_CLIENT_ID The client ID of the GitHub OAuth provider.
GITHUB_CLIENT_SECRET The client secret of the GitHub OAuth provider.
PUBLIC_AUTH_ORIGIN The origin of the Plock server.
PUBLIC_CALLBACK_URL The callback URL where you want to be redirected after authentication.
PUBLIC_LOGOUT_URL The URL where you want to be redirected after logout.
PUBLIC_SITE_NAME The name of your website.

Database environment

Depending on the DB that you are using, set these environment variables accordingly:

Tip

Use host.docker.internal instead of localhost for the DB host.

Turso / LibSQL

Name Description
DB_TYPE The database type. Must be turso.
DB_URL The URL of the turso server. Defaults to http://host.docker.internal:8080.
DB_AUTH_TOKEN The token of the turso server. Defaults to null.

PostgreSQL

Name Description
DB_TYPE The database type. Must be postgres.
DB_URL The Postgres connection URL. Defaults to postgresql://postgres:[email protected]:5432/postgres.

About

Plock is an all in one authentication server, providing email & password, email verification codes, two-factor authentication, OAuth with social providers, and passkey authentication.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages