Skip to content

Commit

Permalink
docs : update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fanchann committed Jan 18, 2024
1 parent 9130e03 commit 6c5549e
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 26 deletions.
124 changes: 98 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,121 @@
## What is Go-Starter?
This tool helps you to do the tedious work of setting configuration and creating layers for the REST API

## Running Go-Starter
## go-starter command
```sh
go-starter
go-starter help

┌─┐┌─┐ ┌─┐┌┬┐┌─┐┬─┐┌┬┐┌─┐┬─┐
│ ┬│ │───└─┐ │ ├─┤├┬┘ │ ├┤ ├┬┘
└─┘└─┘ └─┘ ┴ ┴ ┴┴└─ ┴ └─┘┴└─

Usage: go-starter [OPTIONS]

Options:
-f string
starter configuration file (default "starter.yaml")
help
show help message

Examples:
go-starter new Generate configuration file
go-starter Run the application
go-starter -f=configuration.yaml[default: starter.yaml] Specify a custom configuration file
```
## generate starter configuration
```sh
go-starter new

![go-starter](/assets/v2.0.gif)
┌─┐┌─┐ ┌─┐┌┬┐┌─┐┬─┐┌┬┐┌─┐┬─┐
│ ┬│ │───└─┐ │ ├─┤├┬┘ │ ├┤ ├┬┘
└─┘└─┘ └─┘ ┴ ┴ ┴┴└─ ┴ └─┘┴└─

2024/01/18 16:46:54 Success generate starter.yaml
```

## About Go-Starter
This tool adopt [gorm](https://gorm.io/)\
Database support:
`starter.yaml` is a go-starter configuration:
```yaml
version: "1"
package: your-name-app
database: database
```
database support :
- mysql
- mongodb
- postgres
## Installation

## generate structure project
```sh
go install github.com/fanchann/go-starter@latest
```
go-starter

see older version here [version](https://github.com/fanchann/go-starter/tags)
┌─┐┌─┐ ┌─┐┌┬┐┌─┐┬─┐┌┬┐┌─┐┬─┐
│ ┬│ │───└─┐ │ ├─┤├┬┘ │ ├┤ ├┬┘
└─┘└─┘ └─┘ ┴ ┴ ┴┴└─ ┴ └─┘┴└─

layer 'cmd' created successfully.
layer 'api' created successfully.
layer 'db/migrations' created successfully.
layer 'internals/config' created successfully.
layer 'internals/delivery/http' created successfully.
layer 'internals/delivery/messaging' created successfully.
layer 'internals/gateway' created successfully.
layer 'internals/models' created successfully.
layer 'internals/repository' created successfully.
layer 'internals/usecase' created successfully.
layer 'internals/helpers' created successfully.
layer 'tests' created successfully.
```

## Structure
Structure reference
- [Golang standards project layout](https://github.com/golang-standards/project-layout/)
```sh
├── app
│   ├── controllers
│   ├── domain
│   │   ├── models
│   │   └── types
│   ├── middlewares
│   ├── repositories
│   ├── routers
│   └── services
├── api
├── cmd
│   └── main.go
├── config
│   ├── postgres.go ## -> filename follows your configuration
│   └── yaml_reader.go ## -> filename follows your configuration
├── config.yaml
├── config.dev.yaml
├── db
│   └── migrations
├── docker-compose.yaml
├── go.mod
├── go.sum
└── utils
├── internals
│   ├── config
│   │   ├── mysql.go ## filename following the database
│   │   └── viper.go
│   ├── delivery
│   │   ├── http
│   │   └── messaging
│   ├── gateway
│   ├── helpers
│   │   └── error.go
│   ├── models
│   ├── repository
│   └── usecase
├── starter.yaml
└── tests

```

## About go-starter
This tool adopt \
[gorm](https://gorm.io/)\
[mongo client](https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo)\
[viper](https://pkg.go.dev/github.com/dvln/viper)

Database support:
| Database | Support |
| :---------------- | :------: |
| MySQL ||
| PostgreSQL ||
| MongoDB ||

## Installation
```sh
go install github.com/fanchann/go-starter@latest
```

see older version here [version](https://github.com/fanchann/go-starter/tags)

## Running Your App
After generating the template, enter the folder that has been generated by `go-starter`, and then add dependencies using the following command.
```sh
Expand All @@ -55,7 +127,7 @@ go mod tidy
This command will download and install the required dependencies for your project\
After success install dependencies, run app with command :
```sh
go run cmd/main.go -c {your-configuration}
go run cmd/main.go
```
## Authors

Expand Down
Binary file removed assets/v2.0.gif
Binary file not shown.

0 comments on commit 6c5549e

Please sign in to comment.