[go: nahoru, domu]

Skip to content

Fiber application with authentication & authorization

License

Notifications You must be signed in to change notification settings

peterdee/go-fiber-auth-2024

Repository files navigation

go-fiber-auth-2024

Authentication & authorization in Fiber (an up-to-date version of https://github.com/peterdee/go-fiber-auth)

Key features:

  • PostgreSQL
  • Redis
  • JWT
  • Additional JWT protection mechanics (fingerprinting, token pairing)
  • Gloabal error handler with custom errors

Deploy

git clone https://github.com/peterdee/go-fiber-auth-2024
cd ./go-fiber-auth-2024
gvm use go1.22
go mod download

Environment variables

ENV_SOURCE environment variable determines the origin of environment variables: file or env

If ENV_SOURCE variable is set to file, then .env file is required and the app will not launch without it

Required environment variables are located in .env.example file

Launch

Without Docker

ENV_SOURCE=file go run ./

# With AIR
ENV_SOURCE=file air

With Docker

docker run -p 2024:2024 --env-file .env -it $(docker build -q .)

With Docker Compose

docker compose up -d

License

MIT