Running the Jiffy generator creates a set of files that comprise a working backend services application. Jiffy generates the following source code tree when provided with a model-file describing a simple ‘Person’ entity.
FirstApp
├── appobj
│ ├── appconf.go
│ ├── appobj.go
| └── lead_set_get.go
├── controllers
│ ├── authc.go
│ ├── controllerfuncs.go
│ ├── groupauthc.go
│ ├── person_relationsc.go
│ ├── personc.go
│ ├── usrc.go
│ ├── usr_groupc.go
│ └── ext
│ ├── extc_interfaces.go
│ └── personc_ext.go
├── group
│ ├── gmcl
│ │ ├── gmclient.go
│ ├── gmcom
│ │ ├── gmcache.go
│ │ ├── gmclsrv.go
│ │ ├── gmerrors.go
│ │ └── gmomap.go
│ └── gmsrv
│ ├── gmprocessors.go
│ ├── gmprotocol_senders.go
│ ├── gmserver.go
│ └── gmtxrx.go
├── jwtkeys
│ ├── ecdsa256
│ │ ├── ecdsa.priv.pem
│ │ └── ecdsa.pub.pem
│ ├── ecdsa384
│ │ ├── ecdsa384.priv.pem
│ │ └── ecdsa384.pub.pem
│ ├── ecdsa521
│ │ ├── ecdsa521.priv.pem
│ │ └── ecdsa521.pub.pem
│ ├── rsa256
│ │ ├── rsa.priv.pem
│ │ └── rsa.pub.pem
│ ├── rsa384
│ │ ├── rsa384.priv.pem
│ │ └── rsa384.pub.pem
│ └── rsa512
│ ├── rsa512.priv.pem
│ └── rsa512.pub.pem
├── middleware
│ └── requireuser.go
├── models
│ ├── authm.go
│ ├── errors.go
│ ├── group_authm.go
│ ├── modelfuncs.go
│ ├── personm_ext.go
│ ├── personm.go
│ ├── servicesm.go
│ ├── usr_groupm.go
│ ├── usrm.go
│ └── ext
│ └── model_ext_interfaces.go
├── util
│ └── strings.go
├── .dev.config.json
├── .prd.config.json
├── main_test.go
└── main.go
Incoming service requests are handled by a mux, which validates / authenticates the request, and then matches it to a route. The selected route passes the request to a controller specific to the entity-type, where the incoming information is mapped into a go struct matching the entity declaration. The controller then calls the appropriate model method for the http operation and entity-type combination, passing it the entity structure. The model handler passes the entity struct through a member-field validation layer, and then to the model’s interface to the underlying sqac ORM. The database request is handled by the ORM, and then the response is passed from the model back to the controller where it is marshaled into a JSON payload and sent back to the caller in the response-writer’s body.
Jiffy applications contain an embedded leader-based group-membership sub-system that is used for interprocess communication when the generated jiffy application is deployed as multiple processes.
See the Group Membership section of this document for a detailed overview of the group-membership subsystem.
There are more elegant ways to express certain aspects of the generated application. The coding style has been deliberately kept as simple and straight-forward as possible in order to facilitate easier understanding and adjustment of the generated code.
** Using something like etcd to replace the group-membership and app-server-level caching may make sense in Kubernetes-style deployments. In the future, jiffy may move to the etcd model for all deployments.