This tool automates the setup of a Go backend project using Gin and GORM with PostgreSQL database.
To use this tool, make sure you have Go installed on your system. Then, follow these steps:
-
Clone this repository or copy the
setup.goscript to your local machine. -
Run the following commands to install the CLI tool:
sudo chmod +x ./setup.sh./setup.shTo create a new Go project with Gin and GORM, run the following command:
go-create-project new <project-name>Replace <project-name> with your desired project name.
This command will set up a new project directory, initialize the Go module, install dependencies, create a .env file, and generate the necessary files for a Gin and GORM-based project using PostgreSQL.
Make sure to set the DATABASE_URL environment variable in the .env file with your PostgreSQL connection string before running the project.
The .env file in your project directory should contain the following environment variable:
DATABASE_URL=host=localhost user=postgres dbname=<project-name>_db sslmode=disable password=yourpasswordMake sure is your actual project name after creating the project.