medusajs / nextjs-starter-medusa

A performant frontend ecommerce starter template with Next.js 15 and Medusa.
https://next.medusajs.com/
MIT License
1.81k stars 507 forks source link

GET requests very slow when adding product to a cart #250

Closed Saadchr closed 10 months ago

Saadchr commented 10 months ago

Hello,

2024-02-02 10 15 44

GET requests are very slow when adding product to a cart. The experience in next.medusajs.com is very snappy compared to my local environment (even in development , using npm run start for both the front end and admin, + using redis cache and events)

I wonder if it's because of my supabase free tier.

What is the stack used next.medusajs.com? How can I do to make it as fast?

Thanks

VariableVic commented 10 months ago

Hey @Saadchr,

Have you tried running everything locally (Next.js server, Medusa server with npx medusa develop, redis-server, postgres db)? Generally speaking, this should result in faster performance the your are showing in your video, depending on your machine ofc.

I have no experience working with Supabase, so I don't know if that could be the bottleneck.

The demo stack is:

On a side note, the middleware.ts in the current version is a bit buggy. I'm working on a better version and some cache improvements, which might benefit your case. But even then, the performance in your video is slower than what it should be.

Saadchr commented 10 months ago

Hello,

I've subscribed to a supabase pro plan and the issue is still the same. I've compared to a postgresql instance on railway and I've come to the conclusion that Supabase is actually the bottleneck as the experience with postgresql turns out to be significantly better I've contacted the supabase team to find the origin of the issue.

Thanks