commit e34da045bc6514ff1d1f2af0b0f45e3cf13d2c5c Author: Mason Payne Date: Wed Feb 12 22:14:44 2025 -0700 initial attempt at building Masonry diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/masonry.iml b/.idea/masonry.iml new file mode 100644 index 0000000..7ee078d --- /dev/null +++ b/.idea/masonry.iml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/cmd/cli/cli.go b/cmd/cli/cli.go new file mode 100644 index 0000000..cfceb25 --- /dev/null +++ b/cmd/cli/cli.go @@ -0,0 +1,34 @@ +package main + +import ( + "fmt" + "github.com/urfave/cli/v2" + "os" +) + +func main() { + commands := []*cli.Command{} + + app := &cli.App{ + Name: "Masonry", + Usage: "A CLI tool from building SAAS applications", + Version: "v1.0.0", + Description: "Masonry is a CLI tool for building SAAS applications", + Commands: commands, + Flags: nil, + Authors: []*cli.Author{ + { + Name: "Mason Payne", + Email: "mason@masonitestudios.com", + }, + }, + Copyright: "2025 Masonite Studios LLC", + UseShortOptionHandling: true, + } + + err := app.Run(os.Args) + if err != nil { + fmt.Println(fmt.Errorf("error running app | %w", err)) + return + } +} diff --git a/cmd/cli/commands.go b/cmd/cli/commands.go new file mode 100644 index 0000000..06ab7d0 --- /dev/null +++ b/cmd/cli/commands.go @@ -0,0 +1 @@ +package main diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..5e59770 --- /dev/null +++ b/go.mod @@ -0,0 +1,11 @@ +module masonry + +go 1.23 + +require github.com/urfave/cli/v2 v2.27.5 + +require ( + github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..c8b6c7e --- /dev/null +++ b/go.sum @@ -0,0 +1,8 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= +github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w= +github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..d987e79 --- /dev/null +++ b/readme.md @@ -0,0 +1,29 @@ +# Masonry + +Masonry is intended to be a library that provides and implements all the basics necessary to build robust, production ready web applications. + +## Features + +[ ] Authentication via SpartanAuth +[ ] Authorization via SpiceDB +[ ] Database - your pick of Turso, LibSQL, SQLite, MySQL, Postgres +[ ] Payments via Stripe with flexible product configurations and pricing +[ ] Semantic Search for RAG or application navigation +[ ] System Email templates and SMTP integration +[ ] Cross-platform, installable apps for mobile, desktop and web +[ ] Predetermined frontend frameworks and adjustable styles +[ ] Built in notification framework +[ ] Customizable calls to webhooks for any event +[ ] +[ ] +[ ] + +## Design Philosophy (changeable...) + +The goal of this project is to make building software for web and mobile applications as fast as possible while maintaining +the highest level of quality and maintainability as possible. + +* The more than can be derived from configuration the better. +* Pre-built functionality should be isolated into libraries and modules with *simple* interfaces to minimize manual coding. +* Composable applications minimizes dependencies and maximizes extensibility. +* diff --git a/templates/backend/daemon/daemon.go b/templates/backend/daemon/daemon.go new file mode 100644 index 0000000..189e9b1 --- /dev/null +++ b/templates/backend/daemon/daemon.go @@ -0,0 +1,26 @@ +package daemon + +type DaemonService interface { + Start() + Stop() +} + +type Daemon struct { + services []DaemonService +} + +func (d *Daemon) RegisterDaemonServer(service DaemonService) { + d.services = append(d.services, service) +} + +func (d *Daemon) Start() { + for _, service := range d.services { + go service.Start() + } +} + +func (d *Daemon) Stop() { + for _, service := range d.services { + service.Stop() + } +} diff --git a/templates/backend/daemon/readme.md b/templates/backend/daemon/readme.md new file mode 100644 index 0000000..27e94d9 --- /dev/null +++ b/templates/backend/daemon/readme.md @@ -0,0 +1,3 @@ +# Daemon + +A library that provides a way to register and start multiple long-running services with safe tear-down when they are done. \ No newline at end of file diff --git a/templates/backend/main.go b/templates/backend/main.go new file mode 100644 index 0000000..fe7f767 --- /dev/null +++ b/templates/backend/main.go @@ -0,0 +1,5 @@ +package main + +func main() { + +} diff --git a/templates/cli/cli.go b/templates/cli/cli.go new file mode 100644 index 0000000..0d85fa1 --- /dev/null +++ b/templates/cli/cli.go @@ -0,0 +1,38 @@ +package main + +import ( + "fmt" + "github.com/urfave/cli/v2" + "os" + "time" +) + +func main() { + commands := []*cli.Command{ + exampleCmd(), + // call your command functions from the commands.go file + } + + app := &cli.App{ + Name: "ExampleApp", + Usage: "An example CLI tool", + Version: "v1.0.0", + Description: "This is an example CLI tool", + Commands: commands, + Flags: nil, + Authors: []*cli.Author{ + { + Name: "Mason Payne", // Update this to your name + Email: "mason@masonitestudios.com", // Update this to your email + }, + }, + Copyright: fmt.Sprintf("%d Example Corp", time.Now().Year()), + UseShortOptionHandling: true, + } + + err := app.Run(os.Args) + if err != nil { + fmt.Println(fmt.Errorf("error running app | %w", err)) + return + } +} diff --git a/templates/cli/commands.go b/templates/cli/commands.go new file mode 100644 index 0000000..ba9f75b --- /dev/null +++ b/templates/cli/commands.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + "github.com/urfave/cli/v2" +) + +func exampleCmd() *cli.Command { + return &cli.Command{ + Name: "example", + Aliases: []string{"e"}, + Usage: "Run an example command", + Action: func(c *cli.Context) error { + fmt.Println("This is an example command") + return nil + }, + } +} + +// add commands here