The APIs for the Unbind platform.
- Go 1.24 or higher
- Docker Compose
- Dex IDP binary installed in $PATH
- Clone the repository
- Run
docker-compose up -d
to start dependencies (postgres, redis, etc.) - Run
./startdex.sh
to start dex IDP - Reference config/config.go for environment variables, place them in a
.env
file
go run cmd/api
to start the API- Visit
http://localhost:8089/docs
for API documentation
- Visit
go run cmd/oauth2server
to start the OAuth2 servergo run cmd/cli
to execute CLI commands
Unbind relies on code generation for some components:
./ent
- Generated by ent framework- Various interfaces, generated with ifacemaker
./mocks
- Generated with mockery
Run go generate ./...
to re-generate ent code and interfaces.
Install mockery and run mockery
to re-generate mocks.
- Huma - REST API Framework
- ent - Entity framework for GO
- go-redis - Redis client
- ifacemaker - Automatically generates interfaces from structs
- mockery - Automatically creates mocks based on
.mockery.yaml
Bootsrap superuser:
/app/cli user:create --email=EMAIL --password=PASSWORD
/app/cli group:create --name=superuser --description="Superuser Group"
/app/cli group:add-user --email=EMAIL --group-name=superuser
/app/cli group:grant-permission --group-name=superuser --resource-type=system --resource-id="*" --action=admin
/app/cli group:grant-permission --group-name=superuser --resource-type=team --resource-id="*" --action=admin
/app/cli sync:group-to-k8s
- Make schema change in
./ent/schema
- Re-generate
go generate ./ent/...
- Make a versioned migration
make migrate NAME=your_migration_name
If you edit a migration sql file manually, be sure to re-generate the checksum make migrate-checksum