Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f402c46
WIP: tailwindcss v4
arafays Jan 29, 2025
5aec066
WIP: react + tailwindcss done
arafays Jan 29, 2025
a9997b5
fix: correct path
arafays Jan 29, 2025
a1f55e4
update docs
arafays Jan 29, 2025
829a14d
Fixed a bug where the interupt signal was still being captured and no…
joncalhoun Feb 27, 2025
1651f2c
Fix Melkeydev#115 Pull request missing pq driver replacement
DLTADragonHawk Mar 5, 2025
e478069
more transparent error message when executing command
agungfir98 Mar 13, 2025
0625a01
docs actions update (#389)
Ujstor Apr 18, 2025
e7af940
go 1.23.0 (#390)
Ujstor Apr 18, 2025
99288d3
fix: dont install less than v4 (#391)
arafays Apr 24, 2025
d68f777
fix typos/grammar and remove duplicate text (#393)
0x4D5352 May 3, 2025
83092ca
feat: add flag completions (#395)
Ethanol48 May 3, 2025
99ce129
Fixed no git on system panic even if git flag is skip (#396)
ScaryFrogg May 17, 2025
6656177
initial implimentation
eggplannt May 27, 2025
241bb13
undo make packageName public
eggplannt May 27, 2025
fd7ef8a
hotfix
eggplannt May 27, 2025
6b34dfd
edited linter
eggplannt May 27, 2025
4294896
hotfix
eggplannt May 27, 2025
5e61afe
forgot to check if sqlc enabled
eggplannt May 27, 2025
51fbd7a
Fix docker build process (#403)
FabricSoul Jun 23, 2025
89715fb
update htmx version v2.0.5 (#406)
github-actions[bot] Jun 23, 2025
d1d5c2c
Create FUNDING.yml
Melkeydev Jun 30, 2025
5c2b505
remove duplicate 'The' word (#408)
sawatkins Jul 7, 2025
0c1cc7f
update htmx version v2.0.6 (#409)
github-actions[bot] Jul 10, 2025
1c07733
Add tailwind config for LSP support in templ files (#413)
BlueBlizzardd Jul 10, 2025
3a472b4
tailwind docker config (#407)
Ujstor Jul 10, 2025
d16fa29
Release to NPM (#414)
abelpenton Jul 17, 2025
98f8d0a
cleaned up sqlc support check
eggplannt Jul 17, 2025
6304a75
avoid breaking changes
eggplannt Jul 17, 2025
ebd54fa
ci: add npm provenance (#415)
NachoVazquez Jul 19, 2025
03bdd5b
remove tag reference from npm release (#417)
abelpenton Jul 19, 2025
81f56f8
Adding NPM Melkeydev organization scope (#418)
abelpenton Jul 19, 2025
97eadb7
Merge remote-tracking branch 'upstream/main' into sqlc
vorosdev Aug 5, 2025
d2ec813
Add sqlc documentation
vorosdev Aug 5, 2025
f89c3a3
update readme
vorosdev Aug 6, 2025
59dd672
Merge pull request #3 from vorosdev/sqlc
eggplannt Oct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [melkeydev]
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/generate-linter-advanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ jobs:
framework_matrix:
strategy:
matrix:
framework: [chi, gin, fiber, gorilla/mux, httprouter, standard-library, echo]
framework:
[chi, gin, fiber, gorilla/mux, httprouter, standard-library, echo]
driver: [postgres]
git: [commit]
advanced: [htmx, githubaction, websocket, tailwind, docker, react]
advanced: [htmx, githubaction, websocket, tailwind, docker, react, sqlc]

runs-on: ubuntu-latest
steps:
Expand All @@ -20,7 +21,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
go-version: "1.23.x"

- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4
Expand All @@ -39,12 +40,18 @@ jobs:

- if: ${{ matrix.advanced == 'htmx' || matrix.advanced == 'tailwind' }}
name: Install Templ & gen templates
run: |
run: |
go install github.com/a-h/templ/cmd/templ@latest
/home/runner/go/bin/templ generate -path ${{ env.PROJECT_DIRECTORY }}
$(go env GOPATH)/bin/templ generate -path ${{ env.PROJECT_DIRECTORY }}

- if: ${{ matrix.advanced == 'sqlc'}}
name: Install Sqlc & gen code
run: |
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
$(go env GOPATH)/bin/sqlc generate -f ${{ env.PROJECT_DIRECTORY }}/sqlc.yaml

- name: golangci-lint
run: |
run: |
cd ${{ env.PROJECT_DIRECTORY }}
golangci-lint run

Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: npm-publish

on:
workflow_call:
inputs:
tag:
description: "Release tag to publish (e.g., v1.0.0)"
required: true
type: string
workflow_dispatch:
inputs:
tag:
description: "Release tag to publish (e.g., v1.0.0)"
required: true
type: string

jobs:
npm-publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: "https://registry.npmjs.org"

- name: Download release assets
run: |
TAG="${{ inputs.tag }}"
VERSION=${TAG#v}
mkdir -p dist
gh release download "$TAG" --dir dist
echo "VERSION=$VERSION" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create npm packages
run: |
chmod +x ./scripts/create-npm-packages.sh
./scripts/create-npm-packages.sh "$VERSION"

- name: Publish platform-specific packages to npm
run: |
for platform_dir in platform-packages/go-blueprint-*; do
if [ -d "$platform_dir" ]; then
cd "$platform_dir"
npm publish --provenance --access public
cd - > /dev/null
fi
done

- name: Publish main package to npm
run: |
cd npm-package
npm publish --provenance --access public

16 changes: 13 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21.1'
-
name: Run GoReleaser
go-version: "1.21.1"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5.0.0
with:
distribution: goreleaser
Expand All @@ -27,3 +26,14 @@ jobs:
workdir: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

npm-publish:
needs: goreleaser
permissions:
contents: read
id-token: write
uses: ./.github/workflows/npm-publish.yml
with:
tag: ${{ github.ref_name }}
secrets: inherit

21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ gives the option to integrate with one of the more popular Go frameworks (and th
Install
</h2>

### Go Install
```bash
go install github.com/melkeydev/go-blueprint@latest
```
Expand All @@ -55,6 +56,16 @@ don't forget to update
source ~/.zshrc
```

### NPM Install
```bash
npm install -g @melkeydev/go-blueprint
```

### Homebrew Install
```bash
brew install go-blueprint
```

Then in a new terminal run:

```bash
Expand Down Expand Up @@ -126,6 +137,7 @@ You can now use the `--advanced` flag when running the `create` command to get a
- [Tailwind](https://tailwindcss.com/) css framework
- Docker configuration for go project
- [React](https://react.dev/) frontend written in TypeScript, including an example fetch request to the backend
- [SQLC](https://sqlc.dev/) for generating type-safe Go code from SQL queries

Note: Selecting Tailwind option will automatically select HTMX unless React is explicitly selected

Expand Down Expand Up @@ -203,10 +215,17 @@ React:
go-blueprint create --advanced --feature react
```

SQLC:

```bash
go-blueprint create --advanced --feature sqlc
```


Or all features at once:

```bash
go-blueprint create --name my-project --framework chi --driver mysql --advanced --feature htmx --feature githubaction --feature websocket --feature tailwind --feature docker --git commit --feature react
go-blueprint create --name my-project --framework chi --driver mysql --advanced --feature htmx --feature githubaction --feature websocket --feature tailwind --feature docker --git commit --feature react --feature sqlc
```

<p align="center">
Expand Down
23 changes: 18 additions & 5 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/melkeydev/go-blueprint/cmd/ui/textinput"
"github.com/melkeydev/go-blueprint/cmd/utils"
"github.com/spf13/cobra"
"slices"
)

const logo = `
Expand Down Expand Up @@ -52,6 +53,11 @@ func init() {
createCmd.Flags().BoolP("advanced", "a", false, "Get prompts for advanced features")
createCmd.Flags().Var(&advancedFeatures, "feature", fmt.Sprintf("Advanced feature to use. Allowed values: %s", strings.Join(flags.AllowedAdvancedFeatures, ", ")))
createCmd.Flags().VarP(&flagGit, "git", "g", fmt.Sprintf("Git to use. Allowed values: %s", strings.Join(flags.AllowedGitsOptions, ", ")))

utils.RegisterStaticCompletions(createCmd, "framework", flags.AllowedProjectTypes)
utils.RegisterStaticCompletions(createCmd, "driver", flags.AllowedDBDrivers)
utils.RegisterStaticCompletions(createCmd, "feature", flags.AllowedAdvancedFeatures)
utils.RegisterStaticCompletions(createCmd, "git", flags.AllowedGitsOptions)
}

type Options struct {
Expand Down Expand Up @@ -113,7 +119,7 @@ var createCmd = &cobra.Command{
GitOptions: flagGit,
}

steps := steps.InitSteps(flagFramework, flagDBDriver)
optionSteps := steps.InitSteps(flagFramework, flagDBDriver)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the rename here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I needed to use the 'steps' package later

fmt.Printf("%s\n", logoStyle.Render(logo))

// Advanced option steps:
Expand Down Expand Up @@ -155,7 +161,7 @@ var createCmd = &cobra.Command{

if project.ProjectType == "" {
isInteractive = true
step := steps.Steps["framework"]
step := optionSteps.Steps["framework"]
tprogram = tea.NewProgram(multiInput.InitialModelMulti(step.Options, options.ProjectType, step.Headers, project))
if _, err := tprogram.Run(); err != nil {
cobra.CheckErr(textinput.CreateErrorInputModel(err).Err())
Expand All @@ -175,7 +181,7 @@ var createCmd = &cobra.Command{

if project.DBDriver == "" {
isInteractive = true
step := steps.Steps["driver"]
step := optionSteps.Steps["driver"]
tprogram = tea.NewProgram(multiInput.InitialModelMulti(step.Options, options.DBDriver, step.Headers, project))
if _, err := tprogram.Run(); err != nil {
cobra.CheckErr(textinput.CreateErrorInputModel(err).Err())
Expand All @@ -202,7 +208,14 @@ var createCmd = &cobra.Command{
}
} else {
isInteractive = true
step := steps.Steps["advanced"]
step := optionSteps.Steps["advanced"]
sqlcSupportedDrivers := []flags.Database{flags.Postgres, flags.MySql, flags.Sqlite}

if !slices.Contains(sqlcSupportedDrivers, project.DBDriver) {
step.Options = slices.DeleteFunc(step.Options, func(s steps.Item) bool {
return s.Flag == "Sqlc"
})
}
tprogram = tea.NewProgram((multiSelect.InitialModelMultiSelect(step.Options, options.Advanced, step.Headers, project)))
if _, err := tprogram.Run(); err != nil {
cobra.CheckErr(textinput.CreateErrorInputModel(err).Err())
Expand All @@ -224,7 +237,7 @@ var createCmd = &cobra.Command{

if project.GitOptions == "" {
isInteractive = true
step := steps.Steps["git"]
step := optionSteps.Steps["git"]
tprogram = tea.NewProgram(multiInput.InitialModelMulti(step.Options, options.Git, step.Headers, project))
if _, err := tprogram.Run(); err != nil {
cobra.CheckErr(textinput.CreateErrorInputModel(err).Err())
Expand Down
3 changes: 2 additions & 1 deletion cmd/flags/advancedFeatures.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ const (
Tailwind string = "tailwind"
React string = "react"
Docker string = "docker"
Sqlc string = "sqlc"
)

var AllowedAdvancedFeatures = []string{string(React), string(Htmx), string(GoProjectWorkflow), string(Websocket), string(Tailwind), string(Docker)}
var AllowedAdvancedFeatures = []string{string(React), string(Htmx), string(GoProjectWorkflow), string(Websocket), string(Tailwind), string(Docker), string(Sqlc)}

func (f AdvancedFeatures) String() string {
return strings.Join(f, ",")
Expand Down
Loading
Loading