project-layout icon indicating copy to clipboard operation
project-layout copied to clipboard

Proposal: It would be nice if there's a CLI to generate this layout

Open cyantarek opened this issue 5 years ago • 9 comments
trafficstars

cyantarek avatar Jan 06 '20 09:01 cyantarek

@cyantarek hi 🤝

I worked around this idea a few weeks (start at Nov 2019), because I need exact "lazy" solution for every new project at my current work 😉

Please note: It's non-profit "pet" project from me to myself.

So, my solution is more like create from scratch base full stack app. It means, you can create from one CLI command:

  1. REST API (or/and gRPC) with popular Go packages (included rules of project-layout);
  2. SPA with Preact/React/Vue/Svelte/etc;
  3. Embed all static files to binary ("one-file-solution");
  4. Configured (and production-ready) Docker container with this full stack app;

Yes, something like create-react-app, but for full stack apps.

At this moment, I have repository: https://github.com/create-go-app

Warning: current project status is WIP (work in progress).

Already done:

  • MVP for CLI;
  • net/http backend template;
  • Preact.js frontend template;
  • Configured Dockerfiles for templates;

Attention: docker-compose.yml is not complete, don't containerize it for production.

Huge list of features are already at my backlog (ASAP list).

If you want to help, give advice or/and review code — you're welcome! 👍

koddr avatar Jan 06 '20 10:01 koddr

@koddr hi, very cool project. I will try my best to contribute onto your project.

cyantarek avatar Jan 06 '20 11:01 cyantarek

It would be nice if there's a CLI to generate this layout

Note that the patterns and project layout from this repository are discouraged and deprecated. I would not recommend building a new project on top of this.

dominikbraun avatar Jan 07 '20 15:01 dominikbraun

@dominikbraun, deprecated? I wonder, Why? Then what project layout we will follow?

cyantarek avatar Jan 07 '20 15:01 cyantarek

Many things in this repository that are considered as "standard" are actually discouraged, especially the pkg-structure. See this: https://github.com/golang-standards/project-layout/issues/10

Then what project layout we will follow?

It entirely depends on your project. For different projects there are different layout that match best. However, there are some basic principles you need to keep in mind: https://rakyll.org/style-packages/

You can build you own structure on top of that principles. Some concrete possible structures are shown here: https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1#.ds38va3pp

dominikbraun avatar Jan 07 '20 15:01 dominikbraun

@dominikbraun thank you for actively participating in the discussion! It's great to have a wide community discussion with a diverse set of opinions. It's ok to have your own preferences, which might be different from the patterns captured in this repo, but you also need to be able to let others have their own too. Let the community members decide what works for them and what they like and what they want to use :-)

kcq avatar Mar 11 '20 05:03 kcq

@cyantarek / @koddr This is a great idea! Thanks for kicking off the discussion around it! It's also good to leverage similar capabilities in other dev stacks to learn from them and to make it even better (e.g., Yeoman in the node.js ecosystem).

kcq avatar Mar 11 '20 05:03 kcq

Se also https://github.com/golang-standards/project-template/pull/2 to add shell script to make standard layout.

0uep avatar Feb 18 '21 09:02 0uep

Hi there! I'have written a simple project to generate go projects based on this layout. Of course, it does not implements all directories. But it supports overriding plus plugins, so you can add/modify everything you want.

I'have created an issue to add to description https://github.com/golang-standards/project-layout/issues/111

insidieux avatar Mar 06 '21 19:03 insidieux