mmvergara / supadart

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

Request run on local machine #39

Closed bookshiyi closed 3 months ago

bookshiyi commented 3 months ago

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

mmvergara commented 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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 3 months ago

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

nzlz commented 3 months 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 3 months ago

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

mmvergara commented 3 months ago

Switched to dart generators. now supports local generation