readyGo: Go based project for readily available code
Jiten Palaparthi
Golang & Rust Consultant | Architect | Microservices & Cloud Expert | Corporate Trainer | AI & ML Enthusiast
Github: https://github.com/JitenPalaparthi/readyGo/tree/master
What is readyGo?
A Simple configuration gives you a working project.
- readyGo is a command line interface( probably the name of readyGo CLI would be rgo) application, it is designed to scaffold creation of different types of go based projects.readyGo is designed for developers in mind. Ideally readyGo should provide ready to use application code. The code is generated based on configurations provided by the end user i.e "The great developer :)".
- By version 1 release, it will support http, grpc, CloudEvents template engines with various databases (sql/no sql), pub-sub and CloudEvents plugins and probably even more.
What made me to start this project?
A brief history of my work in general: I get ideas like anyone else. Start developing that idea, create a workspace, working on the project , by the time I am done with structure ,CRUD operations and even more repetitive logic/code, I loose most my time and then park the project aside. This made me understand that we should not loose time for repetitive tasks.So readyGo.
The current state of the project:
- Give a config file with fewer details like model fields etc .. readyGo gives you a working REST API with MongoDb as the back end.
- The config file is self explanatory. Here is a sample one .Note: This will change in future
{ "project":"example", "type":"http", "port":"50054", "dbType":"mongo", "models":[ { "name":"person", "fields":[ { "name":"id", "type":"string" }, { "name":"name", "type":"string", "isKey":true }, { "name":"email", "type":"string", "validateExp":"[a-zA-Z0-9]", "isKey":true }, { "name":"mobile", "type":"string" }, { "name":"status", "type":"string" }, { "name":"last_Modified", "type":"string" } ] } ]
}
From the above config ,
- I want a http based project with mongo as the database.The service runs on port 50054.
- There is only one model named person.Yes can create any number of models.
- readyGo creates, all CRUD operations, and also pagination related get queries, extended get queries , required validations , handlers.
- All these are defined through interfaces. User can plug-out one db and plug-in the another db at any point of time without making changes to the code.
- Here is the running http-mongo (rest) application with simple config file.
The Architecture
There are mainly three components for any template engine in this project.
- Static Files : Static files are configurable for each type of the project like http, grpc etc. What static files to be copied .Example : helper.go , database.go are copied for mongo db project.
- Directories : The list of the directories for each type of the project. Example: database, handler ,interfaces are some of the directories for http-mongo project type.
- Templates : Based on the type of the project output , templates to be created. Example: main.go,handlers.go, interfaces.go, models.go are all are created based on the templates.
You only need to define in the template_config.json file which directories, static files and templates to be created for particular type of the project, the rest readyGo does and it gives you a working project.
What about my business logic ?
readGo cooks for you.As your business logic varies , you have to add the required spices according your taste but one thing .. readyGo is not a template engine, it gives you a working project.
What about the further development ?
- I spend time to reach version 1 at the earliest, possibly by end of 2020. Yes , there are bugs (though I have not added any issues in github). Lots of work in progress. Looking at the open hands/community for the contribution. Here is the Github link..
https://github.com/JitenPalaparthi/readyGo/tree/master
Disclaimer: Content is created by Jiten and typos are created by keyboard :) Stay tuned.
Enterprise Data Architect | Shaping tomorrow with data today.
4 年Great initiative Jiten! I still remember our first project collaborations in 2005 ;)