Does the help-forum offer project reviews/review for server structure, server actions and slow SSR
Unanswered
Polar bear posted this in #help-forum
Polar bearOP
I'm still a junior and have no real senior who could review my project. I've asked on the next.js reddit but haven't found anyone
If this is allowed here -> current project: https://github.com/nkoerner93/spark
Deployed Version: https://spark-chi.vercel.app/
- How is the general project structure?
- How is the general code quality of my server actions?
https://github.com/nkoerner93/spark/tree/main/src/app/actions
- I feel like my SSR & initial load of my dashboard pages is really slow for the low amount of code I have (vercel free tier). Did i do any particular mistakes on my page or layout.tsx or SSR?
Dashboard Layout.tsx:
https://github.com/nkoerner93/spark/blob/main/src/app/dashboard/layout.tsx
Page.tsx
https://github.com/nkoerner93/spark/blob/main/src/app/dashboard/page.tsx
Associated Dashboard Card:
https://github.com/nkoerner93/spark/blob/main/src/components/ui/Dashboard_Card.tsx
Any feedback for even a single file would be appreciated since It's really hard to get senior feedback. I've attached some relevant links.
I feel like the performance is lacking on my deployed website, maybe I'm doing mistakes with my SSR/async fetches.
Can also write me anytime if you're willing to have a small chat and help a junior out.
Thanks
If this is allowed here -> current project: https://github.com/nkoerner93/spark
Deployed Version: https://spark-chi.vercel.app/
- How is the general project structure?
- How is the general code quality of my server actions?
https://github.com/nkoerner93/spark/tree/main/src/app/actions
- I feel like my SSR & initial load of my dashboard pages is really slow for the low amount of code I have (vercel free tier). Did i do any particular mistakes on my page or layout.tsx or SSR?
Dashboard Layout.tsx:
https://github.com/nkoerner93/spark/blob/main/src/app/dashboard/layout.tsx
Page.tsx
https://github.com/nkoerner93/spark/blob/main/src/app/dashboard/page.tsx
Associated Dashboard Card:
https://github.com/nkoerner93/spark/blob/main/src/components/ui/Dashboard_Card.tsx
Any feedback for even a single file would be appreciated since It's really hard to get senior feedback. I've attached some relevant links.
I feel like the performance is lacking on my deployed website, maybe I'm doing mistakes with my SSR/async fetches.
Can also write me anytime if you're willing to have a small chat and help a junior out.
Thanks
13 Replies
Later I’ll take a peak…. I think you are going to get a lot of different perspectives not that that’s a bad thing but typically you would wanna post this in #nextjs-showcase probably with all the stuff you said here. Typically the forum is for specific questions or issues.
@Polar bear I only checked codebase for anime -> ranking/seasonal
I didn't find anything wrongly implemented
only thing I noticed is that you have your fetch functions in action.ts with "use server"
you can have your fetch functions in normal util functions - "use server" is only for server actions
@James4u you can have your fetch functions in normal util functions - "use server" is only for server actions
ye, I wouldnt expose anything using 'use server' unless you very specifically want react to compile an endpoint for it.... technically someone could scrape your sight and EVENTUALLY find that endpoint and possibly expose a secret or something.
@Jboncz ye, I wouldnt expose anything using 'use server' unless you very specifically want react to compile an endpoint for it.... *technically* someone could scrape your sight and EVENTUALLY find that endpoint and possibly expose a secret or something.
Yeah, I understand your intention. Next.js doc recommends 'server-only` module in that case. I would definitely say using "use server" not to expose your secrets is from misconception even though it works as you expect
Any functions with the directive use server when nextjs does the build it exposes an endpoint to the world. If that endpoint is something your calling server side only your exposing potential attack vectors for scraping data. I’m not sure if your agreeing or disagreeing with me 😂
@Jboncz Any functions with the directive use server when nextjs does the build it exposes an endpoint to the world. If that endpoint is something your calling server side only your exposing potential attack vectors for scraping data. I’m not sure if your agreeing or disagreeing with me 😂
🤣 I think I misunderstood your previous message
I didn’t look at the code yet so I just went off your message… so I may have misunderstood too 😂 all good
I meant this function
Polar bearOP
@James4u @Jboncz First of all thanks for taking the time to reply & I'll also post it in the showcase when I've more features in the app.
Can you elaborate a little bit more on when to use server actions? I thought their main purpose is if you want to do any server-side actions (any database operations, calling external apis etc.) without having to build an extra api-route with for example express and that you can use them inside client components.
When I'm just fetching data from an external api like MyAnimeList, should i just create a basic fetch function in a util file? (since I use an API key wouldn't I expose it this way?)
Can you elaborate a little bit more on when to use server actions? I thought their main purpose is if you want to do any server-side actions (any database operations, calling external apis etc.) without having to build an extra api-route with for example express and that you can use them inside client components.
When I'm just fetching data from an external api like MyAnimeList, should i just create a basic fetch function in a util file? (since I use an API key wouldn't I expose it this way?)