If I was starting a green-field project, I would consider something like this.
The idea is to be modern, but as lean as possible.
Handled by Cobra and Viper from SPF13
I'm considering sqlx or gorm for this purpose. I might also skip data mapping all together.
My ideal production environment would be postgres + some sort of cache (redis maybe).
Handled by go-graphql/go-graphql
- Going to get it working with Firebase first
- Maybe add auth0 later
Just my wanting to keep business logic as a first-class concern. So technical sub-directories are to be kept at a bare minimum.
The current directory vision is:
- /awesomeproject/accounts: A domain package of awesomeproject. Fulfills gostack/module interface
- /awesomeproject/main.go: Calls gostack.NewHandler(...modules)
- This will iterate over modules, generate query and mutation types, hook up /graphql handler and such
How inter-linked your modules are, is up to you. Gostack doesn't care. But, if you need to access other packages, you need to do it from your own program and not from gostack.
- Parse for configuration file (use rootCmd lookup thingy)
- Iterate over modules to create graphql handler
- Try adding some data types and querying them from GraphiQL
- Hook up Postgres or Sqlite
- Setup http middleware
- Move CORS shit in there
- Enforce Firebase Auth here
- Login screen
- Prompt login before GraphiQL if client has no token
- Store client token in local storage or some shit