spartan-ng / spartan

Cutting-edge tools powering Angular full-stack development.
https://spartan.ng
MIT License
1.48k stars 156 forks source link

RFC: spartan/stack Nx plugin #15

Open goetzrobin opened 1 year ago

goetzrobin commented 1 year ago

Which scope/s are relevant/related to the feature request?

Don't know / other

Information

The goal is to set up a spartan project with a single CLI command.

I would say it should be as easy as

npx create-nx-workspace --preset=spartan

or something similar.

This would do the following:

  1. Create Nx workspace with libs/apps
  2. Configure AnalogJs with Tailwind & tRPC (this could be done with the Analog preset)
  3. Install Drizzle
  4. Add a .env file with the DB connection placeholder
  5. Do something with supabase? (Not sure about this one since all we use it for right now is as our infrastructure provider for the DB)
  6. Add a basic template that showcases the functionality

Another idea is to add a docker-compose.yml file that spins up a local Postgres DB?

Describe any alternatives/workarounds you're currently using

You can run

npx create-nx-workspace --preset=@analogjs/platform:app

and opt into tailwind and tRPC, which get's you half way there.

Then you need to manually install Drizzle and set it up. You need to set up a Supabase account. You need to download the Postgres docker image and run the container locally or set up the supabase CLI.

I would be willing to submit a PR to fix this issue

lcatania commented 1 year ago

I'm unsure if incorporating a 'host service' as a default is feasible. As a potential user of the Spartan stack, I would like it more if it had a platform-agnostic approach.Maybe explain in the docs what I need to change to setup different providers and tell the user "this is where you configure your database and you can use every provider of your choice if you have x,y,z"

goetzrobin commented 1 year ago

@lcatania I do think that's a very valid point! While that's the origin of the project I think a default vendor lock in is too much!

lcatania commented 1 year ago

I dont know enough about Nx but a convenient way could be to have some 'providers' that the user could select when generating the project and the default is no provider. So the user can select Supabase, Railway, Turso or whatever preset is supported out of the box.

Kinda like create-t3: image

DominikPieper commented 11 months ago

@goetzrobin do you want some help with this? :-) Are the points still valid or does anything changed?

goetzrobin commented 10 months ago

Here is what I am thinking right now about how the flow should be:

  1. Create Nx workspace
  2. Configure AnalogJs with Tailwind
  3. Add spartan tRPC (not sure if this will be kept inside the Analog preset as the tRPC package was moved to spartan)
  4. Install Drizzle
  5. Add a .env file with the DB connection placeholder
  6. Add ng-signal-forms, ngxtension, @tanstack/angular-query-experimental
  7. Add a basic template that showcases the functionality (install whatever spartan/ui primitives are necessary)

Happy to discuss all of this! I feel like it would be cool to make things flexible by adding prompting as described by @lcatania, but this is what I consider an ideal first flow.

Let me know what you think about this @DominikPieper. I still owe you some more info on the tRPC integration and am also happy to discuss my reasoning behind each of ng-signal-forms, ngxtension, @tanstack/angular-query-experimental

goetzrobin commented 10 months ago

@DominikPieper here is a good example of what I want the spartan stack to be like from the NextJs community: https://kirimase.dev