API Call are routed through plasmic server when using codegen

Hi,
Thanks for your brilliant project.
We have build a simple project with plasmic and exported project with codegen and nextjs to self-host.
Also we have a backend server that we use its APIs in our plasmic project.

When using codegen export, our API Calls are routed through plasmic servers instead of directly calling our backend.

As you can see API call is sent to data.plasmic.app instead of calling our backend directly.

We have clients that use our apps in offline environment. (Both client and backends are in local network). Is there anyway that API calls our domain directly?

(We do not use plasmic auth)

1 Like

Hi @masood_movahedi,

Currently it’s only possible if you include your own code components that perform the data fetching for you. We have some planning into non proxied data sources, but it’s not quite there yet.

Also, feel free to ask questions in our Slack Community, where our response time is a better.

I’m on the same boat, found Plasmic recently and really like it.

I found all SQL are routed via data.plasmic.app.

  • If I use Australia region supabase, a simple query of 5 row table take 2-3 seconds
  • With US region, the same query is 1.5-2s
  • Tried self host which make no change

just thought to provide some feedback here

1 Like

@fmota
Thanks.

Should we then continue with this doc?

Can we just grab plasmic official rest API data fetcher code and modify it?

Hi,

The SQL data sources are routed through data.plasmic.app, so that we can connect to databases in our server and not leaking any database information to clients. But we do see that we need to improve the performance of our data proxy. Thanks for the feedback.

Yes, the data fetching docs is a good continuation, I don’t think using plasmic official rest api data fetcher is the best option, as it could be way more work that just creating your specific data fetcher.

I found the data fetching doc as well, my skill ok with low code, far from raw code

It’d be ideal if Plasmic hosting offers region selection on functions like Vercel does, even as part of paid plans. In my test, the static part is already served from AWS Australia.

I only tried Vercel in the hope to bypass the data fetching. My profile would fit into the demographic of tinkerers, people with some code experience trying to build an internal tool quickly. I’d rather just learn Plasmic and get everything done here.

Hi @fmota
I implemented a custom simple data fetcher and it is working. Thanks.

Is there any way I can use this as data queries in page level?

Now data provided is available only in children components of my data fetcher component. If I can use it in “right panel” > “page data” > “data queries”, data would be available in all components of page.

Hi, currently it’s not possible to convert the fetcher into data queries, but you should be able to wrap your whole page with your data fetcher, this way it’s going to be available in all your page components. Also look into Querying data with code components | Learn Plasmic if you want to perform your fetches in server side using Plasmic packages.

Hi, just forgot to mention that you can use our HTTP Data Fetcher implementation too, it’s not so nice or so powerful as the data sources, but it could be helpful too.

image

@fmota Thanks.
But “HTTP Data Fetcher” requests also proxy through plasmic servers. so main problem exists.

The one that is in the image sent in the previous message doesn’t proxy through plasmic servers, you can see the implementation of it in Github. It’s still not possible to use the operation for running requests through onClick. Another thing is that even though there is no proxy, the requests are still going to be cached server side, but this is already in the application side, not in plasmic server.

@fmota Thanks. I will check it.