Goxygen: Generate a Web project with Go and Angular, React or Vue

Goxygen: Generate a modern Web project with Go and Angular, React, or Vue in seconds šŸŽ²

Goxygen aims at saving your time while setting up a new project. It creates a skeleton of an application with all configuration done for you. You can start implementing your business logic straight away. Goxygen generates back end Go code, connects it with front end components, provides a Dockerfile for the application and creates docker-compose files for convenient run in development and production environments.

Supported Technologies
Front EndAngularReactVue
Back EndGo


You need to have Go 1.11 or newer on your machine.

How to use

Go 1.17 and later:

go run github.com/shpota/goxygen@latest init my-app

Older versions of Go

Go 1.16

Set the GO111MODULE environment variable to auto.

export GO111MODULE=auto


go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app

Go 1.11 - 1.15


go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app

his generates a project in my-app folder.

By default, it will use React and MongoDB. You can select a different front end framework and a database using --frontend and --db flags. For instance, this command will create a project with Vue and PostgreSQL:

go run github.com/shpota/goxygen@latest init --frontend vue --db postgres my-app

The --frontend flag accepts angular, react and vue. The --db flag accepts mongo, mysql and postgres.

The generated project is ready to run with docker-compose:

cd my-app
docker-compose up

After the build is completed, the application is accessible on http://localhost:8080.

Structure of a generated project (React/MongoDB example)

ā”œā”€ā”€ server                   # Go project files
ā”‚   ā”œā”€ā”€ db                   # MongoDB communications
ā”‚   ā”œā”€ā”€ model                # domain objects
ā”‚   ā”œā”€ā”€ web                  # REST APIs, web server
ā”‚   ā”œā”€ā”€ server.go            # the starting point of the server
ā”‚   ā””ā”€ā”€ go.mod               # server dependencies
ā”œā”€ā”€ webapp
ā”‚   ā”œā”€ā”€ public               # icons, static files, and index.html
ā”‚   ā”œā”€ā”€ src
ā”‚   ā”‚   ā”œā”€ā”€ App.js           # the main React component
ā”‚   ā”‚   ā”œā”€ā”€ App.css          # App component-specific styles
ā”‚   ā”‚   ā”œā”€ā”€ index.js         # the entry point of the application
ā”‚   ā”‚   ā””ā”€ā”€ index.css        # global styles
ā”‚   ā”œā”€ā”€ package.json         # front end dependencies
ā”‚   ā”œā”€ā”€ .env.development     # holds API endpoint for dev environment
ā”‚   ā””ā”€ā”€ .env.production      # API endpoint for prod environment
ā”œā”€ā”€ Dockerfile               # builds back end and front end together
ā”œā”€ā”€ docker-compose.yml       # prod environment deployment descriptor
ā”œā”€ā”€ docker-compose-dev.yml   # runs local MongoDB for development needs
ā”œā”€ā”€ init-db.js               # creates a MongoDB collection with test data
ā”œā”€ā”€ .dockerignore            # specifies files ignored in Docker builds
ā”œā”€ā”€ .gitignore
ā””ā”€ā”€ README.md                # guide on how to use the generated repo


Files such as unit tests or sample components are not included here for simplicity.


Goxygen generates a basic structure of a project and doesn't force you to use a specific set of tools. That's why it doesn't bring unneeded dependencies to your project. It uses only a database driver on the back end side and axios in React and Vue projects. Angular projects use only Angular specific libraries.

Source: https://github.com

#go #golang #angular #react #vue 

Goxygen: Generate a Web project with Go and Angular, React or Vue
1.50 GEEK