Why I'm Using Express Instead of NextJS

แชร์
ฝัง

ความคิดเห็น • 240

  • @joshtriedcoding
    @joshtriedcoding  ปีที่แล้ว +118

    Was aware you could self-host NextJS, what I didn't know is that it would just act like a regular nodejs server then. Thanks for sharing, you learn something new every day

    • @TheIpicon
      @TheIpicon ปีที่แล้ว +2

      Can’t wait to see more of your stuff!
      Great job, keep going 💪

    • @Vampirat3
      @Vampirat3 ปีที่แล้ว +2

      I would assume the package has to be installed via NPM or something similar.
      Although resolved , I highly agree on your points , good video bro.

    • @jason_v12345
      @jason_v12345 ปีที่แล้ว

      You can, but I think the API routes are still separately scoped, so you'll still need Redis if you want to persist data across different routes.

    • @manchao1416
      @manchao1416 ปีที่แล้ว +3

      What does self hosting actually mean? Deploying it to a VPS?

    • @TheIpicon
      @TheIpicon ปีที่แล้ว +3

      @@manchao1416 an an actual machine, like heroku or digitalocean, and then you don’t have any execution timeout in your api endpoints

  • @codinginflow
    @codinginflow ปีที่แล้ว +52

    I recently ran a poll on the NextJS Subreddit and the majority of people were using a separate server. One big reason there was simple separation of concerns.

    • @codinginflow
      @codinginflow ปีที่แล้ว +3

      Grüße aus Deutschland btw

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว +7

      Interesting, thanks for sharing. Would've actually expected that, the web is not actually moving as fast as it might seem from Vercel. Cheers, Grüße zurück :)

    • @quintennn
      @quintennn 4 หลายเดือนก่อน

      That would indeed also be my main reason.

    • @tuananhdo1870
      @tuananhdo1870 3 หลายเดือนก่อน

      one big reason there was code sharing and type safse from BE to FE

  • @Tszyu01
    @Tszyu01 ปีที่แล้ว +65

    In actual production you would almost always have dedicated api services via express, spring, .NET, etc that are vertically or horizontally scaled, fronted by api gateways and waf, distributed and or edge cacheing, observable via open telemetry and application logging, alerts via pager duty.This concept of having production grade APIs within SSR ui frameworks is a concept pushed by cloud providers like vercel that maintain these frameworks to have you put everything into cloud functions. Just because you can put an api into a ssr framework doesn’t mean you should.

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว +14

      Your approach is definitely common practice in production. However I see nothing wrong with a production app using NextJS built in API routes, many things are done right, scaling is easy and it’s also worked well for me in the past

    • @andrews13
      @andrews13 8 หลายเดือนก่อน

      True

  • @mcgruff0972
    @mcgruff0972 ปีที่แล้ว +77

    I would like to point out that you can still use Nextjs and express together. Yes Nextjs is a full stack framework but that doesn’t mean you can’t use both here(unless you don’t have a front end). Virtually you would be running react but now you still get all the file base routing system, hosting ……etc you’ll just hit the express backend routes instead of the server less routes problem solved. Hell you could even use a hybrid approach and use Nextjs for all of your light request and express for your heavy request.

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว +33

      Great explanation. The latter hybrid approach is exactly what I'm doing, just offloading the heavy, long-lasting tasks to express and handling everything else over serverless. Its working very well, thanks for sharing

    • @domw2391
      @domw2391 ปีที่แล้ว +1

      just regard next js as backend for frontend to call express endpoint

    • @ReactWala
      @ReactWala ปีที่แล้ว

      @@domw2391 Can you elaborate what you said?

    • @ReactWala
      @ReactWala ปีที่แล้ว +1

      @@domw2391 ok

    • @tbfromsd
      @tbfromsd ปีที่แล้ว +2

      ​@@joshtriedcodingI just jumped into NextJS 13.4 from a MERN stack. Yesterday I fired up Next on Node in a docker container with sleep infinity. But I still notice odd I assume caching issues even when my server is continuously running it seems like there is a cold start when I navigate to different resource, even some that are a basic page with no props. The computing resource it currently has available are more than I would like to pay for at Digitalocean. I still assume I have screwed something up in config.

  • @owenwexler7214
    @owenwexler7214 ปีที่แล้ว +20

    I’m using NextJS for the frontend with an Express backend and two Express microservices but using the NextJS routes as a proxy to the backend services so I can hide API keys in server-side environment variables. I am going to have a mobile app hitting the backend too so definitely can’t have the backend and web frontend on one server for that.

    • @juststudying1019
      @juststudying1019 2 หลายเดือนก่อน

      NextJS API routes are just good for simple web apps, but in most cases I will do the same express backend or nest js.

  • @amershboul9107
    @amershboul9107 ปีที่แล้ว +2

    i start watching your videos recently and they are very useful, keep going we support you👏

  • @ozzyfromspace
    @ozzyfromspace ปีที่แล้ว +2

    I had this exact issue of stateless function calls while working on a dashboard for a startup as a contractor. I ultimately deployed a standalone go server, same difference. Nice video!

    • @adamsarazin8373
      @adamsarazin8373 หลายเดือนก่อน

      What issues? The time for the first call?

  • @zygote396
    @zygote396 ปีที่แล้ว +37

    I was under the impression you could just self-host a NextJS server and have those routes available 24/7, can someone clarify for me?

    • @Zihad
      @Zihad ปีที่แล้ว +15

      yes you can, I've done it before. using NextJS doesn't necessarily mean you have to use it as serverless, you can just use it in a "server-full" way, you're going to need a server for running the Express server anyway. but if you want to keep everything else serverless, then I can understand why you might want to go for something like this.

    • @TheIpicon
      @TheIpicon ปีที่แล้ว

      You impressing is right, they’re available 24/7. What he meant in the video, is each time any of your endpoints get hit, it can run as much as 60 second PER request(in the pro plan)

    • @TerryMitchell
      @TerryMitchell ปีที่แล้ว

      Agreed! I have A NextJS app with an Express server to handle Web Sockets and it's working perfectly. Can't host on Vercel, however.

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว +1

      That's possible, the Vercel team has instructions on how to achieve that. As far as I know, all you need is a node server and you're golden

    • @HenriqueNewsted
      @HenriqueNewsted ปีที่แล้ว +3

      @@Zihad It doens't even need to be an Express erver, you can use a plain Node server.

  • @WebDevCody
    @WebDevCody ปีที่แล้ว +2

    Could you clarify for me, you needed a stateful deployment because you’re running replicate on the machine itself, or are you just interacting with the replicate api which is taking too long?

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว +2

      Just interacting with their API, not self hosting it. It works super well for subsequent requests, the first ones sometime take exceptionally long though

    • @WebDevCody
      @WebDevCody ปีที่แล้ว +1

      @@joshtriedcoding that’s strange, their api must dynamically spin up a machine for your use or something and tear it down later. Not sure why it would take so long

  • @tommoore8266
    @tommoore8266 ปีที่แล้ว +1

    I'm coming to a similar point of realisation now as I want to integrate GPT-4 into my app at some point in the future. I've got two possible solutions:
    1. Using Next api routes for requests that you know will be quick and an express server for requests that will take a while.
    2. If the slow request is done based on a user input (like requesting to generate a blog) then why not fetch on the frontend, that doesn't have a timeout limit?

  • @timesizes
    @timesizes ปีที่แล้ว +3

    In my opinion and like you mentioned in video you have to use whats best for the current project or what the client requests 😅. For my current project some sort of portfolio combined with booking or request system for photographer i started to use api routes. For my last project I had to use Spring boot due to legacy system restrictions. Honstly a simple express server would be more and sufficient and for my upcoming project i will use nestjs. So you see its important to stay open and learn new frameworks and not restrict to one technology. Altough nestjs is a good fullstack framework its not the tool for all use cases. Same goes for other tools like express, angular and so on. If you are familiar with the basic concepts you wont have much problems to switch and learn new things. At the end these are just tools you have to pick the best/most suited for the current project. Thats the point which seperates "good" from "bad" developer. The ability to stay flexible, learn new cocepts and adopt the concepts if nessecary

  • @owl3379
    @owl3379 ปีที่แล้ว

    Hey Josh! Could you explain in a Video what kind of Stack you will use then primary? Because React doenst give any official stuff anymore for stand alone if i understand right?

  • @jamescbender43081
    @jamescbender43081 9 หลายเดือนก่อน +5

    The bigger issue for me is that I need to treat the back end and front end differently. I need to scale them differently, my clients need to deploy them to different logical zones, and I need to have different security policies for the front end and back end. I'll use the Next routes for "locally convenient" things for my application, but most of the functionality must be separate.

  • @mrfran1
    @mrfran1 ปีที่แล้ว +8

    But shouldn’t NextJS be agnostic of what type of backend infra are you using? Like you could dockerize the NextJS app and deploy to something else different than Vercel/AWS?

    • @tuananhdo1870
      @tuananhdo1870 3 หลายเดือนก่อน

      this mean using Nextjs and to write an backend

  • @avi7278
    @avi7278 ปีที่แล้ว +1

    Hi Josh, what camera are you using now versus your first video? Nice screen background btw :)

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว

      It’s the same actually. Just tweaked some settings, it’s the Nikon D750. It’s not meant for video at all tho

  • @tamalefrank5830
    @tamalefrank5830 ปีที่แล้ว +9

    I can definitely relate to this, down here in Africa where the internet is quite slow in so many places, building a fully NextJS powered ecommerce website may not be user-friendly. The servers usually time out before all the information is retrieved for the user..

  • @TheSocialDeveloper
    @TheSocialDeveloper ปีที่แล้ว +34

    I think you’re confusing deployment infrastructure with framework capabilities. You can 100% use NextJs and websockets.
    NextJs api does build to severless functions by default but you can containerized NextJs and host it on a PaaS and still get all the benefits you mentioned.

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว +5

      Interesting, didn't know that. Thanks for sharing

    • @Billiam112
      @Billiam112 ปีที่แล้ว +5

      @@joshtriedcoding Perhaps we can see the self hosted version as a video soon... ;)

    • @aizensoskue3880
      @aizensoskue3880 ปีที่แล้ว

      yes you still can use nextjs for infrastructure and not use serverless functions but i wont recommend it nestjs will be a better choice

    • @TheSocialDeveloper
      @TheSocialDeveloper ปีที่แล้ว

      @@aizensoskue3880 I agree there’s better alternatives for sure. NextJs is a lightweight backend to vs more dedicated frameworks like NestJs. I was more so addressing the idea that you “can’t” do it along with the other things he mentioned. Severless cold starts have less to do with the development framework and more to do with the infrastructure of the application as a whole.

    • @okie9025
      @okie9025 ปีที่แล้ว +1

      you can, but should you? I think it's easier, more maintainable and potentially more performant to just have a separate backend and avoid any backend logic in NextJS.

  • @dyto2287
    @dyto2287 ปีที่แล้ว +8

    I think people don't know what NextJS truly is when talking about Backend. It's a BFF (Backend For Frontend) and should not be a primary API for the product.

    • @ukaszrozewicz7488
      @ukaszrozewicz7488 ปีที่แล้ว

      Why?

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว +2

      I've seen many people base their core API around Next API endpoints and don't see anything wrong with that. Just depends on what you expect from you API and what it should handle

    • @dyto2287
      @dyto2287 ปีที่แล้ว +6

      @@joshtriedcoding Modeling core API based on your frontend framework is a terrible choice. You might need to add another frontend like mobile, desktop or browser extension. Or maybe you will redesign your frontend entirely. It is easier to rewrite frontend and harder to rewrite backend for a running real business.
      I would say the only way writing your API around Next could be viable is for a weekend side-project or youtube tutorial 🤣

    • @mdtron
      @mdtron ปีที่แล้ว +1

      @@dyto2287 I always use next API endpoints but not for the core logic of my application but rather to hide my database url's and api keys e.t.c.. SO it acts like middleman/reverse proxy to the real API.

    • @jason_v12345
      @jason_v12345 ปีที่แล้ว

      The coupling that exists between an API and the frontend depends on implementation. If you commit to returning only domain data from your Next.JS API routes, you don't lose the ability to serve multiple front end clients.

  • @kirillanisimov6968
    @kirillanisimov6968 ปีที่แล้ว

    You can use edge functions and stream responses for generating blog post articles.

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว +1

      Yeah, if the response takes too long they’ll time out tho

  • @antoniocestari5775
    @antoniocestari5775 ปีที่แล้ว +2

    Well the first 2:
    - Timeout: I think most serverless funct providers limits this. The time is higher if you pay more. I'm not saying that this vercel time is good, just that is a common concern if you plan to use serverless anyway and it depends on your code exec time.
    - The industry is using a lot of REST and that's supposed to be stateless. It's also a known limitation of serverless but it's great for REST
    Now for the third one, cold starts. If you have a server that gets a request every hour you won't probably want to pay the whole hour for that, so you'll probably choose a cheap plan and those could include cold starts as well. So it's basically a providers/money thing

  • @goldenknowledge5914
    @goldenknowledge5914 ปีที่แล้ว

    Josh this is a really good explanation 👏

  • @juj1988
    @juj1988 ปีที่แล้ว

    Hey josh, do you have next express-js basic app structure?

  • @thedevminer
    @thedevminer ปีที่แล้ว +45

    I think this video should've been titled "Why I Don't Use NextJS API Routes For This Project". Express doesn't handle WebSockets either...

    • @blackpurple9163
      @blackpurple9163 ปีที่แล้ว +6

      Then there wouldn't be as many views as with this title, it's all marketing, but people like you make it much better, at least you're making corrections a beginner like me would never know, I am a complete novice at MERN stack and all these details are learnt during live projects, which are very difficult to find when you're unemployed, thank you for pointing out the facts

    • @heberjulio6303
      @heberjulio6303 ปีที่แล้ว +2

      Express can handle websockets. I once worked on a project with that.
      Express is powerfull and adptable to anything.

    • @OmgImAlexis
      @OmgImAlexis ปีที่แล้ว +1

      Huh? Yeah it can handle websockts?
      Websockets aren’t some magic thing. They’re just a type of http upgrade.

    • @thedevminer
      @thedevminer ปีที่แล้ว

      It can't handle WebSockets on it's own, you have to use an extra package. I don't count this as handling WebSockets since it's the other package doing it.

  • @leroypowell-louis499
    @leroypowell-louis499 6 หลายเดือนก่อน

    Nextjs doesn’t allow you get images uploaded to the public directory after running next build. I learnt this the hard way after building an e-commerce application that required new product image uploads. I later had to completely delete the api routes and moved the entire database to an express server and that worked superbly through api calls in the next is app, all newly uploaded images didn’t get 404 errors when being fetched.

  • @abhisycvirat
    @abhisycvirat 5 หลายเดือนก่อน +1

    If we use express, should we go with pages routes or app router? Does it even matter?

  • @LearningwithJS-ei3ci
    @LearningwithJS-ei3ci ปีที่แล้ว

    No web sockets so that’s the reason I can’t send a blob url from a audio input to the api in nextjs and try to read/convert it to a file to send it elsewhere?????

  • @aaaronme
    @aaaronme ปีที่แล้ว

    I am using AWS for websockets, works really well, data which I need to keep like connections etc is just store with a TTL in dynamodb

  • @okie9025
    @okie9025 ปีที่แล้ว +34

    Next tries to be a jack of all trades with its API routes, and Vercel is pushing hard to turn entire stacks into just Next and nothing else. However, I think a lot of devs are calling Next out on this and are realizing that Next really isn't that great for backend at all. I personally think Next is great to increase performance by using SSR/SSG, but you should almost always make your backend in a separate project.

    • @whatyoumissed9994
      @whatyoumissed9994 11 หลายเดือนก่อน +1

      yes its also good for maintainance. kind of some microservices pattern, i think next follow monolithic

    • @rodrigopolanco8434
      @rodrigopolanco8434 7 หลายเดือนก่อน

      Im doing the frontend in nextjs and the backend in django, there is a database of the chat history and store messages on postgre on the backend, how could I connect a database made on postgre with nextjs, maybe with vercel ?

    • @NewTypeStarling
      @NewTypeStarling 7 หลายเดือนก่อน

      ​@@rodrigopolanco8434you dont connect it. You just fetch the data in next

    • @Terminus265
      @Terminus265 6 หลายเดือนก่อน

      @@rodrigopolanco8434 Did you try prisma?

    • @Svish_
      @Svish_ 5 หลายเดือนก่อน

      @@whatyoumissed9994 Most "microservice" and separate backends I've seen around are actually just distributed monoliths that are actually much _worse_ to maintain. I think a whole bunch of projects would've been a lot easier to deal with and probably a whole lot cheaper too if devs just stopped clinging to their favorite "stacks" so much and just started to keep things simple.

  • @b3rking
    @b3rking ปีที่แล้ว

    Great. Explanation. Thanks josh!

  • @Brocollipy
    @Brocollipy ปีที่แล้ว

    Excellent video thanks for the info.

  • @user-og4tu6ui4h
    @user-og4tu6ui4h 2 หลายเดือนก่อน

    Shall we expect a nextjs frontend and express backend project from u soon?

  • @sealone777
    @sealone777 ปีที่แล้ว +1

    Curious if you used NestJS and what you think about it.

  • @martapfahl940
    @martapfahl940 5 หลายเดือนก่อน

    I also created my own fastAPI backend in python. I think it's also good in terms of separation of conerns.

  • @haneenmahdin7647
    @haneenmahdin7647 ปีที่แล้ว +1

    The websocket issue was the reason why I had to move over from using Nextjs to express for one my favourite personal projects.

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว +2

      Yeah that’s a solid reason to switch. It’s possible through serverless if you’re fine with paying someone else for their infrastructure, but there’s something nice about managing websockets yourself too

    • @haneenmahdin7647
      @haneenmahdin7647 ปีที่แล้ว

      @@joshtriedcoding Yeah, I felt like I had more control and was easier to work with Socket outside of the serverless environment.

    • @srenmadsen2602
      @srenmadsen2602 ปีที่แล้ว +2

      I agree that handling Websocket solutions yourself has a nicer feel to it.
      However, scalability could become an issue.
      You'll have concurrent connections limits, possibly memory leak issues and a few other big headaches...
      All problems that are solvable, sure, but they take time, expertise and infrastructure.
      The paid realtime technology services aim for those headaches to bring to them, not you.

  • @shayanalijalbani9894
    @shayanalijalbani9894 ปีที่แล้ว

    Can you share that blog generator project?

  • @jm_rusty
    @jm_rusty ปีที่แล้ว +1

    You can deploy NextJS to Digital Ocean and it wouldn't be a serverless deployment while still having access to the API routes.

  • @MaxProgramming
    @MaxProgramming ปีที่แล้ว +12

    I started learning NestJS a couple days ago and I am really liking it compared to Express

    • @jonasls
      @jonasls ปีที่แล้ว +1

      Also trying it out for small tool at work, seems good - reminds me of Django

    • @MaxProgramming
      @MaxProgramming ปีที่แล้ว +2

      @@jonasls yeah I've done quite django, flask, fastapi. The method directives remind me of Flask and FastAPI.
      The reason I like it is because it has a good structure and is opinionated. Unlike express which is un opinionated

    • @radimhof
      @radimhof ปีที่แล้ว +3

      I like fastify

    • @eshw23
      @eshw23 ปีที่แล้ว +1

      I am to, im using it for my capstone project in my coding bootcamp(Flatiron school), it seems really cool, love how it is built in with Typescript and fully compatable, and I really like the structure and architecture, makes me feel more organized with my backend, especially since I want to potentially scale this project.

    • @MaxProgramming
      @MaxProgramming ปีที่แล้ว +1

      @@radimhof That's nice too. But I like Nest because it is much opinionated. Also I use Nest with Fastify

  • @TheIpicon
    @TheIpicon ปีที่แล้ว +5

    ok, regarding your points:
    1. the first one I have nothing to add on, yeah the timeout sucks.
    2. here you said you should use something like in memory DB like Redis, this is an awful solution. In the docs Next suggest that you use a 3rd third service for real time communication(e.g your WebSockets) like Pusher. Pusher solves your 2nd point.
    3. cold start sucks, this is why It's recommended to move into the new Edge runtime. It has no cold starts with better performance and less expansive. Notice that when I say Edge I don't mean the location of Edge, this can stay regional (as it should if it communicates with a DB), I only talk about the RUNTIME.
    I've talked about the edge infrastructure with Theo and he released a new video about it couple days ago.

    • @vim55k
      @vim55k ปีที่แล้ว +2

      Why would I pay for websockets?

    • @vim55k
      @vim55k ปีที่แล้ว

      Does edge handle websockets?

    • @TheIpicon
      @TheIpicon ปีที่แล้ว

      @@vim55k no, you can think of it as “steroid lambdas”, but they don’t even run on node

    • @TheIpicon
      @TheIpicon ปีที่แล้ว

      @@vim55k because of the same reason you might pay for auth providers, hosted CDN’a, cloud infrastructure, external load balancer(e.g Redis from upstash)

    • @TheIpicon
      @TheIpicon ปีที่แล้ว

      @@vim55k it’s your deal to what to pay for, but usually SaaS are worth, and the time you spend managing all your websockets infra in your express up(maybe you want to add encryption to it) might not be worth it relative to using something easy and reliable as Pusher

  • @JackHartwig
    @JackHartwig ปีที่แล้ว

    What do you use for user authentication if you choose to use express?

    • @singakhorus7314
      @singakhorus7314 ปีที่แล้ว +4

      Passport js is a great package for handling user authentication

  • @dawitminale2775
    @dawitminale2775 6 หลายเดือนก่อน +1

    could you pls make a project video on express + next.js

  • @shantanu_kumar
    @shantanu_kumar 8 หลายเดือนก่อน

    Do you have any resources on integrating Express js backend with Next js 13 and adding authentication (w/o Next Auth, the tokens, etc. is generated on Express backend

    • @Shashanksoni98
      @Shashanksoni98 4 หลายเดือนก่อน

      Did you find anything useful to solve this issue?

    • @bibekkoirala352
      @bibekkoirala352 2 หลายเดือนก่อน

      Do mention if you found it

  • @eduardabramovich1216
    @eduardabramovich1216 9 หลายเดือนก่อน

    what about express vs fastify?

  • @stanleycoffey
    @stanleycoffey ปีที่แล้ว

    as for the timeout why not just push the job to queue and poll it ?

  • @eduardlucaci7369
    @eduardlucaci7369 ปีที่แล้ว +3

    can you present how to combine React with Express server? In specially SSR part.

    • @Bruno-ke1uh
      @Bruno-ke1uh ปีที่แล้ว

      did you find a solution? i'm stuck with the same.

    • @eduardlucaci7369
      @eduardlucaci7369 ปีที่แล้ว

      @@Bruno-ke1uh no

    • @harshitsharma7874
      @harshitsharma7874 ปีที่แล้ว

      Hey why you dont use nextjs with a custom server which serves nextjs and api

  • @HaifengZhu-pn3uq
    @HaifengZhu-pn3uq 2 หลายเดือนก่อน

    hi, Josh, which one is more popular, nextjs full stack or MERN?

  • @Sina-bn2xd
    @Sina-bn2xd ปีที่แล้ว

    it really depends on the use cases

  • @mckaythomas9764
    @mckaythomas9764 3 หลายเดือนก่อน

    Do route handlers not take care of these issues? I was under the impression that of Next 13 route handlers in API routes could help with web hooks, web sockets, or SSE. I have not tired it however.

  • @livecode247
    @livecode247 ปีที่แล้ว

    Another great video Josh! A lot of people just use a particular tech blindly without comparing the use cases and the pros and cons for a particular use case.
    Btw, edge functions have lesser cold start durations, don't they? I remember Theo mentioning something about this on his latest video.

    • @user-gf9ri4wj5h
      @user-gf9ri4wj5h ปีที่แล้ว +2

      I think we should only doing frontend with next js 😂

  • @BRP-Moto-Tips
    @BRP-Moto-Tips ปีที่แล้ว +1

    i just stomped my head with the size limit on cloud functions whilst using puppeteer and an aws lambda adapter :(( wouldve been great to come across this video earlier today lol

  • @1Wheelerdealer
    @1Wheelerdealer 6 หลายเดือนก่อน +1

    Why don’t you use redux for state management? There’s plenty of good libraries to use next and express.

  • @sadkebab
    @sadkebab ปีที่แล้ว +7

    Hi Josh, why don't you use fastify instead of express?

    • @el.bromas
      @el.bromas ปีที่แล้ว +2

      Hi sad, instead, can you say why do you use fastify?

    • @sadkebab
      @sadkebab ปีที่แล้ว +1

      @@el.bromas I started because of performance, most benchmarks stated that its 3-4 times faster than express... but I ended up liking it for the ecosystem since integrating useful feature is low effort thanks to official and community plugins like autoload, oauth2, rate-limit and so on.
      But tbh I don't know how the express ecosystem compares to fastify's one at the moment, I have not been using it for a while.

    • @sadkebab
      @sadkebab ปีที่แล้ว +1

      @@el.bromas and please, refer to me as kebab thank you uwu

    • @jotaroisdarius1918
      @jotaroisdarius1918 ปีที่แล้ว +2

      @@el.bromas it's faster than express, and express hardly receives any updates

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว +2

      Looked into it just recently. Doesn't seem too different syntactically so I'll probably give it a good shot in the future

  • @sathishkannan6600
    @sathishkannan6600 ปีที่แล้ว +3

    I think aws has server less web sockets for like 15 minutes.

  • @vim55k
    @vim55k ปีที่แล้ว

    What about edge?

  • @danialarshad92
    @danialarshad92 11 หลายเดือนก่อน

    If we use express for backend, then what’s the point of using nextjs for frontend instead of pure reactjs?

    • @Gardel1337
      @Gardel1337 10 หลายเดือนก่อน

      SSR for example

  • @snivels
    @snivels ปีที่แล้ว

    You don't have to use NextJS serverless, though?

  • @oktayaltunkaya9019
    @oktayaltunkaya9019 11 วันที่ผ่านมา

    Is it possible to use express and next together

  • @user-re8lt2gy3g
    @user-re8lt2gy3g 11 หลายเดือนก่อน

    Use netlify functions?

  • @muhammedozalp
    @muhammedozalp 8 หลายเดือนก่อน

    Thanks for that useful content

  • @AbuBakr1
    @AbuBakr1 2 หลายเดือนก่อน

    Title: why i am using express; Him: he went on to explain server side function

  • @bhatvikrant
    @bhatvikrant ปีที่แล้ว +1

    Also bandwidth on vercel is expensive

  • @sylensdrake9706
    @sylensdrake9706 ปีที่แล้ว

    haven't worked with nextjs. can't you just serve your nextjs project on a classic server, just as you would do with express, php or ruby?

  • @gogoikabir
    @gogoikabir ปีที่แล้ว +3

    I love NextJs but for backend I prefer Laravel or Express....

  • @ahmedakermi
    @ahmedakermi ปีที่แล้ว +1

    how can use
    nextauth with express

  • @leguizbsit3162
    @leguizbsit3162 ปีที่แล้ว

    Hello Sir, how do you know about this can you give me a tip thankyou

  • @yoz0__
    @yoz0__ ปีที่แล้ว

    Why not fastify tho?

  • @mathysbordel
    @mathysbordel ปีที่แล้ว +2

    this video is about infra/host providers limits, not next js limits

  • @viniciusataidedealbuquerqu2837
    @viniciusataidedealbuquerqu2837 ปีที่แล้ว +2

    the three things blurred made me angry. even if you didnt blur that I would keep listening for the reasons you know

  • @yousafwazir3167
    @yousafwazir3167 ปีที่แล้ว +3

    Thank you for this insight

  • @racheta9
    @racheta9 8 หลายเดือนก่อน

    so why don't you host the app yourself instead of using Vercel?

  • @kimbapslayer1995
    @kimbapslayer1995 ปีที่แล้ว

    Then you have to deploy express apps am I right!?

  • @axelramirezludewig306
    @axelramirezludewig306 ปีที่แล้ว

    This content with comments about a real product you're building are really useful. Great!

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว

      Very happy to hear that. Thank you man

  • @pkingo1
    @pkingo1 หลายเดือนก่อน

    This is only true if not using self-hosted services right?

  • @snatvb
    @snatvb ปีที่แล้ว +1

    so, you can do it with nextjs, but you need to deploy it on different place - not vercel
    nextjs != vercel

  • @zheil9152
    @zheil9152 ปีที่แล้ว

    And express is going to fix this… how?

  • @Dev-Siri
    @Dev-Siri ปีที่แล้ว

    did you delete my comment or is youtube doing something funny?
    i cant see me previous comment anymore.

  • @ixixix-vw2rq
    @ixixix-vw2rq ปีที่แล้ว

    I don’t use the NextJS API because of modularity

  • @pearlv1760
    @pearlv1760 2 หลายเดือนก่อน

    Why can't we use node js for this

  • @iiWeDaBeast
    @iiWeDaBeast ปีที่แล้ว

    Use the edge! Timeout is 30 seconds and streaming time is infinite.

  • @faiznarutobest
    @faiznarutobest ปีที่แล้ว

    I think the best title should be “why i shouldnt use vercel”?

  • @Salah-YT
    @Salah-YT ปีที่แล้ว +1

    so u mean MERN is better? I'm sorry just talking not enough so better show us an example please bro for people beginners like me I got confused bro so I'm ok with NextJS and MERN but not professional yet but now I do not know what u talking about how u use Express and where so better by tutorial so I'm on tutorial hell anyway I love it 🙂

  • @mirkullink3185
    @mirkullink3185 ปีที่แล้ว

    Do you use NestJs?

  • @frazuppi4897
    @frazuppi4897 ปีที่แล้ว +1

    I guess you run out of arguments and you are making things up still my man

  • @CodingPhase
    @CodingPhase ปีที่แล้ว

    Yeah next js is not for everything... people think every time a new framework is popular everyone needs to be using them.

  • @breezycodes
    @breezycodes ปีที่แล้ว +81

    NestJs? Anyone?

    • @jaroslavhuss7813
      @jaroslavhuss7813 ปีที่แล้ว +6

      Me... absolutely me... I have all of my projects built with Nest

    • @breezycodes
      @breezycodes ปีที่แล้ว +2

      ​@@jaroslavhuss7813I implore you to give strapiCMS a try as well 😊

    • @ongkay250
      @ongkay250 ปีที่แล้ว +1

      @@breezycodes strapiCMS limited role

    • @freshhorizonswithjakub
      @freshhorizonswithjakub ปีที่แล้ว +4

      Why use nestjs for personal projects? Isnt it bloated?

    • @breezycodes
      @breezycodes ปีที่แล้ว +4

      @jakub3914 I know it looks that way from the outside. Once you give it a try, you will see that it takes like an hour to get your Middleware and endpoints created in vanilla Expressjs... but only minutes in nestjs. Plus they have a CLI that is awesome for scaffolding API resources etc... sockets, authorization is a breeze to setup.. things that would take hours in expressjs takes just minutes in nestjs.. btw, nestjs uses expressjs/fastify under the hood

  • @yalcinozer4434
    @yalcinozer4434 6 หลายเดือนก่อน +1

    Great points. Developers should always get on the hyped train. I spent a few weeks learning it and decided to stick with React/Express combination.

  • @ahmedkaram3829
    @ahmedkaram3829 ปีที่แล้ว

    josh !! what this is about

  • @odysseos12
    @odysseos12 ปีที่แล้ว

    pm2 start npm -- start
    No?

  • @ayukalvieri3154
    @ayukalvieri3154 6 หลายเดือนก่อน

    There problem I have with nextjs is this, hosting a nextjs app on another plattform other than vercel may require you to create a custom server. This is not very good. Doing so will remove some of NextJs very important features like Automatic static optimization. So pages a no longer pre rendered and others. Meanwhile, all these features are what make NextJs this popular. I find this as a huge red flag cuz am force to stick with vercel.

  • @user-tu4om4ro5f
    @user-tu4om4ro5f ปีที่แล้ว +2

    Please refrain from developing an AI-powered blog generator.
    Creating an AI blog generator may seem appealing, as it promises to save time and effort in content creation. However, there are several reasons to reconsider this idea.
    Blogs are meant to express personal thoughts and opinions in an authentic way. By relying solely on AI, the content may lack the human touch that readers value. Human-authored blogs establish deeper connections with the audience, fostering engagement and relatability.
    An AI blog generator could contribute to the proliferation of low-quality or irrelevant content. Without human oversight, the generated articles may lack accuracy, coherence, and originality. Maintaining the integrity of the blogosphere requires human judgment and expertise.
    Building a successful blog involves nurturing a loyal readership and fostering a community. AI cannot respond to comments, engage in discussions, or adapt to readers' needs. Human interaction is essential for a vibrant and engaged readership.
    Ethical concerns surround the use of AI in content generation. There is a risk of propagating biased or misleading information. Adhering to ethical guidelines, respecting privacy, and avoiding plagiarism requires human judgment.
    In conclusion, prioritize human creativity, authenticity, and meaningful engagement in blogging. Embracing unique perspectives, insights, and interactions fosters a valuable blogging community. Avoid relying solely on AI for content generation.

    • @cm3462
      @cm3462 6 หลายเดือนก่อน

      🤣

  • @jmoast
    @jmoast ปีที่แล้ว

    I don't understand. So you're saying use Express instead of NextJs because you can use Express with a serverless environement? Using Express still doesn't fix the issue of web sockets you were describing though. Not sure what this has to do with Express vs NextJs

  • @samnmeje3486
    @samnmeje3486 ปีที่แล้ว

    Next jw serverless Just making things complicated 😔.

  • @lostin8159
    @lostin8159 ปีที่แล้ว +3

    Real developers use api routes, express and cms at the same time. 😎
    My opinion is that I "serverless/edge" makes me confused¹ and I just want to have a client and an api, that separation is just way easier for me.
    I can deploy my client on Vercel/Netlify and an api on a few dollar vps.
    ¹I don't have enough knowledge about serverless functions (or whatever that is, what happens when you deploy api routes to vercel) it makes me feel powerless and I want to know exactly what I'm doing. I'm also scared of limits or pricing, like getting spammed and having to pay a few thousand dollars cuz it was scaling /infinitely/, but the price of scaling is 400x higher, because Vercel.
    TLDR: me dum dum, I do everything primitive, because feel safe

    • @FranzAllanSee
      @FranzAllanSee ปีที่แล้ว +2

      Real devs dont use JS in the backend. PHP all the way!!! 😎😂

    • @cloudkungfu
      @cloudkungfu ปีที่แล้ว +2

      @@FranzAllanSee realer devs do everything in assembly 👨‍💻

    • @name_less227
      @name_less227 ปีที่แล้ว

      @@FranzAllanSee PHP is making a come back.

  • @andronikussimarmata3672
    @andronikussimarmata3672 8 หลายเดือนก่อน

    So you are comparing a server-based Express.js to a serverless Next.js instead of a server-based Next.js ? Hmm. 🤔 Since your channel is called 'Josh Tried Coding,' I can forgive it

  • @SanderCokart
    @SanderCokart ปีที่แล้ว +1

    Still can use next api. Just don't run on the edge

    • @joshtriedcoding
      @joshtriedcoding  ปีที่แล้ว +2

      It's not about the runtime, more so the fact that I assumed NextJS to always be serverless

    • @SanderCokart
      @SanderCokart ปีที่แล้ว

      @@joshtriedcoding haha

  • @OmgImAlexis
    @OmgImAlexis ปีที่แล้ว +2

    This should be titled “I’ve never actually looked into nextjs and think Vercel is the only host” 🤦‍♀️
    You don’t need to use Vercel.
    You don’t need to use serverless.
    You can use websockets.
    If you need to stream data you can still use sse for serverless.

  • @dinmavric5504
    @dinmavric5504 10 หลายเดือนก่อน

    are you really comparing a full blown framework with express? very bad comparison

  • @jcs184
    @jcs184 ปีที่แล้ว

    Bro confused "deployment" with "framework". If you don't host on Vercel, you're not limited to those things. So, yeah, you could very well use Nextjs here.

    • @manchao1416
      @manchao1416 ปีที่แล้ว

      I have a containerised NextJS app running on AWS App Runner, is it running serverless or is it not?

    • @jcs184
      @jcs184 ปีที่แล้ว

      @@manchao1416 I believe it’s not serverless. To run nextjs as serverless you need to deploy it in a specific way like vercel does.

  • @gordonfreimann
    @gordonfreimann ปีที่แล้ว

    too spesific

  • @Sam-dh7fr
    @Sam-dh7fr ปีที่แล้ว +1

    I think it's best to delete this video. It's quite misleading (not intentionally), but still.

    • @matiastika1329
      @matiastika1329 ปีที่แล้ว +2

      I've actually learnt a lot on the debate that this video generated. I don't think deleting but probably responding with another short video summarizing the debate

    • @Bruno-ke1uh
      @Bruno-ke1uh ปีที่แล้ว

      @@matiastika1329 same

  • @davifreitas4857
    @davifreitas4857 ปีที่แล้ว

    In other words, if you are building a real application, you need a backend and not next API routes

    • @jcs184
      @jcs184 ปีที่แล้ว +1

      Absolutely wrong.

    • @mithatercan
      @mithatercan ปีที่แล้ว

      @@jcs184 Agree!