Coder Social home page Coder Social logo

rog-golang-buddies / go-automatic-apps Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 3.0 858 KB

Generate CRUD applications automatically with the least effort and as beautiful as possible

License: Apache License 2.0

Dockerfile 2.43% Makefile 4.92% Go 65.01% HTML 1.74% TypeScript 21.07% SCSS 4.84%
crud crud-application go golang automatic-ui automatic-api

go-automatic-apps's Introduction

Go Automatic Apps (GAA)

pre-commit pre-commit.ci status

Generate CRUD applications automatically with the least effort and as beautiful as possible

Discord invite link: Go Lang Buddies Discord channel: #go-automatic-apps-discussion

How Go Automatic Apps is used? (To be done)

  1. Create a new Go project
  2. Install Go Automatic Apps dependency
  3. Define your database file (schema name and connection parameters)
  4. Define your table models (using ent.io)
  5. Instantiate Go Automatic Apps server
  6. Done

How it works? (To be done)

GAA CLI

Command line to execute actions:

  • Create a new model
  • Create migrations
  • Run migrations

GAA Server

The server that handles the CRUD UI (React) and the API.

The server does it automatically by reading the models definitions.

  1. Autogenerated UI for Create/Read/Update/Delete (CRUD) rows from a model
  2. Autogenerated API to respond to the UI actions

Contribute

Setup

  • Go 1.19

Folders

  • architecture: Documents and diagrams
  • cmd: Code for the gaa command
  • pkg: Exportable libraries
  • internal: Utility functions
  • server: Server side code

go-automatic-apps's People

Contributors

amanangira avatar dependabot[bot] avatar jmaister avatar pmoieni avatar segfault99 avatar whutchinson98 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

go-automatic-apps's Issues

[react] Create a form for a model automatically

Given the data structure information in the UI, we can generate a form automatically.

The form will show a line per field and the appropriate component for editing the data.

Data types:

  • string - input
  • bool - checkbox
  • date - date selector
  • number - input
  • etc...

[server] Graceful shutdown

Listen for SIGTERM signal.
Set a timeout duration.
When SIGTERM signal is received wait for both http and grpc servers to shutdown gracefully (both of them have a method for this).
If shutdown operations exceeds timeout duration forcefully close the servers.
Exit program.

[server] GORM to sqlx?

Anarchy0904 proposed to make this change.

@jordiburgos I saw discussions about the ORM and GORM being one possibility. We have been using GORM in our project from more than a year now. One major problem with it is that in the query conditions you refer to the database schema fields and no the Go struct fields which creates dependency outside the control of the code.
As much as I prefer ORM for Rest APIs and CRUD intensive application at this point I would suggest something like sqlx that helps in the hydration and not building too much dependency on a third library also building exactly what is required instead.

[LIB] Start the server

Create a command to start a new web server.

As a starting point, return a simple index.html

Define how CLI commands are defined

Use any library from Go to parse the command line and decide what to do.

This task is just to show how the command line works and does not require to code the commands. Printing the options is enough.

Commands:

$ gaa model migrate
$ gaa model create User
$ gaa server -P 8080

[CLI] Generate CLI executable

Build the project to generate an executable for Windows, Linux, Mac.

(Builds for other operating systems might be useful too, but not required yet)

Executable name: "gaa" or "gaa.exe"

[gRPC] Create an endpoint to get tables list

As this is the first [gRPC] task, it is needed to configure gRPC in the project.

Then, create an endpoint to return the list of tables, with its field list with types.
This info is already available coming from ent

[UI] Show the rows of a model in a page

URL: /models/<model_name>

Shows a table with all the data from a model.
The table has a column for each field of the model.

The data and column names come from a REST endpoint.

Investigate whether we should use gRPC or traditional REST

gRPC is a new way of creating backends that effectively allows you to simply call a "function" that is like a traditional REST call

More information on it can be found here Quick start guide

A huge benefit to gRPC is the speed compared to traditional REST. It also would still allow us to use a rest gateway to still have a rest api layer when the service is running. This imo is the best of both worlds as it allows for speed for those who want to use gRPC but still has the convenience of REST if you are just doing something quick

protoc build error

I get this error on make protoc. I am working on Windows, and I already installed the protoc executable.

protoc version: protoc-21.4-win64

@segfault99 do you have any idea about this?

PS C:\workspace\go-automatic-apps> make protoc
protoc -I=./proto --go_out=. --go-grpc_out=. ./proto/*.proto
'protoc-gen-go-grpc' is not recognized as an internal or external command,
operable program or batch file.
--go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1.
make: *** [Makefile:40: protoc] Error 1

[gRPC] Remove gRPC and use REST

I am investigating how to call gRPC from the browser and it takes too much work from several different libraries.

The setup requires a wrapper for Go's http server object. Then 2 build steps to generate the JavaScript code and TypeScript definitions. And make it all work...

I prefer to move to REST as gRPC is not really ready for the browser.

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.