Tutorial
Let's discover Uadmin in less than 30 minutes.
#
Getting StartedGet started by creating a new project.
#
Hot reloading of your go project on file changesFor this we propose you to use "reflex" go package in a way: reflex -r '\.go' -s -- sh -c "go run cmd/uadmin/main.go admin serve"
. And on file changes your project would be reloaded.
#
Generate a new project- Make sure you use go1.16.
- Please configure environment variable UADMIN_PATH that is a path to the root of your project.
- Create your project .mod file, as example you can take this file: uadmin go.mod example
- Add file cmd/{{YOUR_PROJECT_NAME}}/main.go with content similar to: example of how to configure uadmin and use it's commands.
- Add config for your project, for this please create folder: configs in the root of your project. And put there your .yml config file, you can use example from this file: example of environment
- Build your go binary with a command:
go build cmd/uadmin/main.go
. Your binary will be available in the root of your project with name "main".
#
Add new blueprint- You can add new blueprint with a name
example
using command:./main blueprint create -m 'blueprint for uadmin example' -n example
. Add model if you want. You can check how it's done here: model file and migration file - Apply all migrations:
./main migrate up
.
#
Start your admin panel- Please create superuser, so you can sign in into admin panel:
./main superuser create -n adminadmin -e admin@example.com
- Add administration panel for the model you created, you can find how to do that in this file: example of how to add administration panel for your model
- Start admin panel using command:
./main admin serve
. - Open in browser: 127.0.0.1:8080/admin and you are in the admin panel. Sign in using user credentials you created before.