scaffold

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DotEnvTemplate = `` /* 276-byte string literal not displayed */
View Source
const GitIgnoreTemplate = `` /* 168-byte string literal not displayed */
View Source
const GoModTemplate = `module {{ .ModulePath }}

go 1.26

require (
	github.com/GoHyperrr/hyperrr v0.3.0
	github.com/GoHyperrr/mdk v0.3.0
)
`
View Source
const HyperrrYmlTemplate = `` /* 485-byte string literal not displayed */
View Source
const ImportsGoTemplate = `// Code generated by hyperrr. DO NOT EDIT.
package main

import (
{{- range .Modules }}
	_ "{{ .Resolve }}"
{{- end }}
)
`
View Source
const MainGoTemplate = `` /* 594-byte string literal not displayed */
View Source
const MakefileTemplate = `build:
	go run github.com/GoHyperrr/hyperrr/cmd/hyperrr@latest build

run: build
	./bin/hyperrr server

tidy:
	go mod tidy
`
View Source
const ReadmeTemplate = `# {{ .ProjectName }}

This is an AI-Native commerce engine built with **Hyperrr**.

## Getting Started

1. **Install dependencies**:
   ` + "```bash" + `
   go mod tidy
   ` + "```" + `

2. **Generate resolver codes**:
   ` + "```bash" + `
   # This will aggregate all module schemas, run gqlgen, and compile your local binary
   go run github.com/GoHyperrr/hyperrr/cmd/hyperrr@latest build
   ` + "```" + `

3. **Start the server**:
   ` + "```bash" + `
   ./bin/hyperrr server
   ` + "```" + `

## Project Structure

- ` + "`cmd/server/`" + `: Contains the entry point and imports setup for active modules.
- ` + "`configs/`" + `: Application configuration files (` + "`hyperrr.yml`" + `).
- ` + "`modules/`" + `: Put your custom project-specific modules here.
- ` + "`api/graph/`" + `: Custom GraphQL schema extensions and code-generated files.
`
View Source
const SchemaGraphqlsTemplate = `` /* 166-byte string literal not displayed */

Variables

View Source
var Presets = map[string]Preset{
	"commerce-full": {
		Name:        "commerce-full",
		Description: "Full e-commerce capabilities with authentication, cart, catalog, order processing, and payment integrations.",
		Modules: []ModuleInfo{
			{ID: "auth.apikey", Resolve: "github.com/GoHyperrr/auth/apikey"},
			{ID: "auth.emailpass", Resolve: "github.com/GoHyperrr/auth/emailpass"},
			{ID: "commerce.product", Resolve: "github.com/GoHyperrr/commerce/product"},
			{ID: "commerce.store", Resolve: "github.com/GoHyperrr/commerce/store"},
			{ID: "commerce.customer", Resolve: "github.com/GoHyperrr/commerce/customer"},
			{ID: "commerce.cart", Resolve: "github.com/GoHyperrr/commerce/cart"},
			{ID: "commerce.order", Resolve: "github.com/GoHyperrr/commerce/order"},
			{ID: "commerce.payments", Resolve: "github.com/GoHyperrr/commerce/payments"},
			{ID: "commerce.taxonomy", Resolve: "github.com/GoHyperrr/commerce/taxonomy"},
			{ID: "commerce.seo", Resolve: "github.com/GoHyperrr/commerce/seo"},
			{ID: "commerce.notification", Resolve: "github.com/GoHyperrr/notification"},
		},
	},
	"commerce-minimal": {
		Name:        "commerce-minimal",
		Description: "Minimal storefront setup with key modules: key authentication, products, cart, and orders.",
		Modules: []ModuleInfo{
			{ID: "auth.apikey", Resolve: "github.com/GoHyperrr/auth/apikey"},
			{ID: "commerce.product", Resolve: "github.com/GoHyperrr/commerce/product"},
			{ID: "commerce.cart", Resolve: "github.com/GoHyperrr/commerce/cart"},
			{ID: "commerce.order", Resolve: "github.com/GoHyperrr/commerce/order"},
		},
	},
	"auth-only": {
		Name:        "auth-only",
		Description: "API authentication foundation including key/token management and basic credentials.",
		Modules: []ModuleInfo{
			{ID: "auth.apikey", Resolve: "github.com/GoHyperrr/auth/apikey"},
			{ID: "auth.emailpass", Resolve: "github.com/GoHyperrr/auth/emailpass"},
		},
	},
	"bare": {
		Name:        "bare",
		Description: "A blank slate template with zero pre-loaded modules.",
		Modules:     []ModuleInfo{},
	},
}

Functions

func CreateModule

func CreateModule(cfg *ModuleScaffoldConfig) error

func GetModuleName

func GetModuleName(dir string) (string, error)

GetModuleName extracts the module name defined in a go.mod file.

func Run

func Run(cfg *ScaffoldConfig) error

Types

type ModuleInfo

type ModuleInfo struct {
	ID      string
	Resolve string
}

func ResolveModule

func ResolveModule(name string) (ModuleInfo, bool)

ResolveModule takes a module ID or shorthand name and resolves it to a standard package URL and ID.

type ModuleScaffoldConfig

type ModuleScaffoldConfig struct {
	ModuleName  string
	ProjectRoot string
	IsWorkspace bool // true if we have a go.work at root
}

ModuleScaffoldConfig holds inputs for creating a new custom module.

type Preset

type Preset struct {
	Name        string
	Description string
	Modules     []ModuleInfo
}

type ScaffoldConfig

type ScaffoldConfig struct {
	ProjectName      string
	ProjectPath      string
	ModulePath       string
	PresetName       string
	DBDriver         string
	DBDSN            string
	EventBusProvider string
	Modules          []ModuleInfo
	SkipGit          bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL