Categorygithub.com/dekunt/uadmin
modulepackage
0.1.0-rc.1
Repository: https://github.com/dekunt/uadmin.git
Documentation: pkg.go.dev

# README

uAdmin the Golang Web Framework

Easy to use, blazing fast and secure.

go report card GoDoc codecov Build Status License: MIT

Originally open source by IntegrityNet Solutions and Services

For Documentation:

Social Media:

Screenshots

Dashboard Menu

Dashboard  

Log

Log  

Login Form

Login Form  

Features

  • API configuration
  • Authentication and Permissions
  • Clean and sharp UI
  • Dashboard customization
  • Database schema migration
  • Image cropping
  • IP address and port configuration
  • Log feature that keeps track of many things in your app
  • Multilingual translation
  • MySQL Database Support
  • Offers FREE hosting for your app while you are developing by using a single command: uadmin publish
  • Pretty good security features (SSL, 2-Factor Authentication, Password Reset, Hash Salt, Database Encryption)
  • Public access to media
  • Self relation of foreign key/many2many
  • Sending an email from your app by establishing an email configuration
  • Tag support for fields
  • Validation for user input

Minimum requirements

Operating SystemArchitecturesNotes
FreeBSD 10.3 or lateramd64, 386Debian GNU/kFreeBSD not supported
Linux 2.6.23 or later with glibcamd64, 386, arm, arm64, s390x, ppc64leCentOS/RHEL 5.x not supported. Install from source for other libc.
macOS 10.10 or lateramd64Use the clang or gcc that comes with Xcode for cgo support.
Windows 7, Server 2008 R2 or lateramd64, 386Use MinGW gcc. No need for cygwin or msys.
  • A C compiler is required only if you plan to use cgo.
  • You only need to install the command line tools for Xcode. If you have already installed Xcode 4.3+, you can install it from the Components tab of the Downloads preferences panel.

Hardware

  • RAM - minimum 256MB
  • CPU - minimum 2GHz

Software

  • Go Version 1.10.3 or later

Installation

$ go get -u github.com/uadmin/uadmin/...

To test if your installation is fine, run the uadmin command line:

$ uadmin
Usage: uadmin COMMAND [-e email] [-d domain]
This tools allows you to publish your project online

Commands:
  publish         This publishes your project online
  prepare         Generates folders and prepares static and templates
  version         Shows the version of uAdmin

Arguments:
  -e, --email     Your email. This is required for you to be able to maintain your project.
  -d, --domain    You can choose your domain name which will customize your URL

Get full documentation online:
https://uadmin.io/docs/

Your First App

Let's build your first app which is a Todo list. First, we will create a folder for your project and prepare it.

$ mkdir -p ~/go/src/github.com/your_name/todo
$ cd ~/go/src/github.com/your_name/todo
$ uadmin prepare
[   OK   ]   Created: /home/abdullah/go/src/github.com/uadmin/todo1/models
[   OK   ]   Created: /home/abdullah/go/src/github.com/uadmin/todo1/api
[   OK   ]   Created: /home/abdullah/go/src/github.com/uadmin/todo1/views
[   OK   ]   Created: /home/abdullah/go/src/github.com/uadmin/todo1/media
[   OK   ]   Created: /home/abdullah/go/src/github.com/uadmin/todo1/static
[   OK   ]   Created: /home/abdullah/go/src/github.com/uadmin/todo1/templates

Now use your code editor to create main.go and put this code inside it.

package main

import (
	"github.com/uadmin/uadmin"
	"time"
)

type Todo struct {
	uadmin.Model
	Name        string
	Description string `uadmin:"html"`
	TargetDate  time.Time
	Progress    int `uadmin:"progress_bar"`
}

func main() {
	uadmin.Register(Todo{})
	uadmin.StartServer()
}

Now to run your code:

$ go build; ./todo
[   OK   ]   Initializing DB: [9/9]
[   OK   ]   Initializing Languages: [185/185]
[  INFO  ]   Auto generated admin user. Username: admin, Password: admin.
[   OK   ]   Server Started: http://0.0.0.0:8080
         ___       __          _
  __  __/   | ____/ /___ ___  (_)___
 / / / / /| |/ __  / __  __ \/ / __ \
/ /_/ / ___ / /_/ / / / / / / / / / /
\__,_/_/  |_\__,_/_/ /_/ /_/_/_/ /_/

Publish your app

To take your app live, it is simple:

$ uadmin publish
Enter your email: [email protected]
Your project will be published to https://my-proj.uadmin.io
Enter the name of your sub-domain (my-proj) [auto]: my-app
Did you change the default port from 8080?
This is the port you have in uadmin.Port = 8080
Enter the port that your server run on [8080]:
[   OK   ]   Compressing [420/420]
[   OK   ]   Your application has been uploaded
[   OK   ]   Application installed succesfully
[   OK   ]   Your Project has been published to https://my-app.uadmin.io/

Quick Reference

Overriding Save Function

func (m *Model)Save(){
	//business logic
	uadmin.Save(m)
}

Validation

func (v Validate) Validate() (ret map[string]string) {
  ret = map[string]string{}
  if v.Name != "test" {
    ret["Name"] = "Error name not found"
  }
  return
}

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
Package helper is a micro package with helper functions for uAdmin.

# Functions

AdminPage !.
All fetches all object in the database.
ClearDB clears the db object.
Count return the count of records in a table based on a filter.
Delete records from database.
DeleteList !.
Filter fetches records from the database.
FilterBuilder chnages a map filter into a query.
GenerateBase32 generates a base64 string of length length.
GenerateBase64 generates a base64 string of length length.
Get fetches the first record from the database.
GetDB returns a pointer to the DB.
GetID !.
GetString returns string representation on an instance of a model.
GetUserFromRequest returns a user from a request.
IsAuthenticated returns if the http.Request is authenticated or not.
JSONMarshal Generates JSON format from an object.
Login return *User and a bool for Is OTP Required.
Login2FA login using username, password and otp for users with OTPRequired = true.
Logout logs out a user.
NewModel creates a new model from a model name.
NewModelArray creates a new model from a model name.
Preload !.
Register is used to register models to uadmin.
RegisterInlines is a function to register a model as an inline for another model Parameters: =========== model (struct instance): Is the model that you want to add inlines to.
ReturnJSON returns json to the client.
Save saves the object in the database.
SendEmail sends email using system configured variables.
StartSecureServer !.
StartServer !.
Tf is a function for translating strings into any given language Parameters: =========== path (string): This is where to get the translation from.
Trail prints to the log.
Translate is used to get a translation from a multilingual fields.
Update !.
UploadImageHandler handles files sent from Tiny MCE's photo uploader.

# Constants

Reporting Levels.
Reporting Levels.
Reporting Levels.
Reporting Levels.
Version number as per Semantic Versioning 2.0.0 (semver.org).
Reporting Levels.
Reporting Levels.

# Variables

BindIP is the IP the application listens to.
CookieTimeout is the timeout of a login cookie in seconds.
CustomTranslation !.
Database is the active Database settings.
DebugDB prints all SQL statements going to DB.
EmailFrom email from.
EmailPassword !.
EmailSMTPServer !.
EmailSMTPServerPort !.
EmailUsername !.
EncryptKey is a key for encyption and decryption of data in the DB.
LogAdd adds a log when a record is added.
LogDelete adds a log when a record is deleted.
LogEdit adds a log when a record is edited.
LogRead adds a log when a record is read.
MaxImageHeight !.
MaxImageWidth !.
MaxUploadFileSize is the maximum upload file size in bytes.
OTPAlgorithm is the hashing algorithm of OTP.
OTPDigits is the number of degits for the OTP.
OTPPeriod is the number of seconds for the OTP to change.
OTPSkew is the number of minutes to search around the OTP.
PageLength is the list view max number of records.
Port is the port used for http or https server.
PublicMedia allows public access to media handler without authentication.
ReportingLevel is the standard reporting level.
ReportTimeStamp set this to true to hav a time stamp in your logs.
RootURL is where the listener is mapped to.
Salt is extra salt added to password hashing.
Schema is the gblobal schema of the system.
SiteName is the name of the website that shows on title and dashboard.
Theme is the name of the theme used in uAdmin.

# Structs

Choice is a struct for list choices.
DashboardMenu !.
DBSettings !.
F is a field.
GroupPermission !.
Language !.
Log !.
Model is the standard struct to be embedded in any other struct to make it a model for uadmin.
ModelSchema for a form.
Session !.
User !.
UserGroup !.
UserPermission !.

# Interfaces

HideInDashboarder used to check if a model should be hidden in dashboard.

# Type aliases

Action !.