mmvergara / supadart

Typesafe queries in Supabase Flutter! Generate Flutter / Dart 🎯 classes from your Supabase schema.
https://supadart.vercel.app
MIT License
35 stars 4 forks source link

Request run on local machine #39

Closed bookshiyi closed 1 month ago

bookshiyi commented 1 month ago

Thanks for your awesome idea, could we change the project to run on local only by pure dart without .ts?

mmvergara commented 1 month ago

I'm not entirely clear on the concept. Is the idea to rewrite the generation to work locally without using the API, for offline use? The tool currently relies on ${supabaseUrl}/rest/v1/?apikey=${supabaseAnonKey} to retrieve schema data, so internet access is required. Could you please provide more details on the goal?

bookshiyi commented 1 month ago

According to my understanding,

The current code logic: cli(.dart) --config--> supadart-server(.ts) --get--> supabase-server disk <--code-- cli(.dart) <--json-- supadart-server(.ts) <--swagger-- supabase-server

Is it possible to reconstruct it into this? cli(.dart) --get--> supabase-server disk <--code-- cli(.dart) <--swagger-- supabase-server

This will facilitate custom generation rules and contribute(debug) code to generators.

mmvergara commented 1 month ago

I see, So this will probably remove the generate classes via website right? unless,, maintain dart generators and ts generators

Part of why i made it in nextjs first is:

I can see the clear benefits of what you are proposing, but i'd like to give it some thought

bookshiyi commented 1 month ago

I see, So this will probably remove the generate classes via website right? unless,, maintain dart generators and ts generators

Part of why i made it in nextjs first is:

  • Generate via web + can reuse it via serverless api
  • Im more comfortable in ts

I can see the clear benefits of what you are proposing, but i'd like to give it some thought

btw, I also think that the web is very useful for many users, which is convenient for users to get started quickly, and simple tables can easily generate dart code without any installation.

There will indeed be a lot of workload to change to local mode. If you decide to do it, I will be happy to contribute to it.

And, this project is great enough currently, it helped me a lot. I'm glad I didn't meet you later.

bookshiyi commented 1 month ago

It may be more difficult to do the type conversion part with pure dart than ts.

Is it possible that use dart to call the local ts code directly, so that the workload will be much less.

mmvergara commented 1 month ago

Is it possible that use dart to call the local ts code directly

done some research, there isn't a way afaik 😔

nzlz commented 1 month ago

made a quick PR after reading this issue https://github.com/mmvergara/supadart/pull/41, hopefully i can play a bit with the generation the coming days, not sure if it fully works for me yet.

thanks for the effort btw :) i wish this kind of stuff was suppored directly in supabase ..

mmvergara commented 1 month ago

Now i see why is this necessary. the current implementation doesnt work with supabase instances running on local machine? @bookshiyi @nzlz

nzlz commented 1 month ago

the server wont be able to fetch from private local-hosted supa instances the PR was the smallest change i could think of, but there might be better ways

bookshiyi commented 1 month ago

If some one self hosted the supabase server on local network, the supadart vercle server can not reach it.

mmvergara commented 1 month ago

Switched to dart generators. now supports local generation