2 months ago
Nextjs is full stack framework but missing worker that can do some longer stuff. Like AI response or automation that takes more than 15 min. I a Starter template with background jobs and cron jobs added, it will be very helpfull for nextjs developers. I currently think of folllowing:-
- Nextjs + Latest Inngest
OR
- Nextjs + Postgres/Redis(for managing jobs, que and cron job) + Custom nodejs script as worker
Pinned Solution
a month ago
15 min not nextjs limitations, it's HTTP response limit by railway But railway is persistent server. You can use sockets if you wants realtime communication for long term.
But if you just need long processing support for data update,
- you can use "Fire & Forget" stretegy
- Or use 2 deployments of nextjs repo, One for keep everything running and one for worker, use webhooks for communication, keep everything in private networking for least cost. Use same code with a small change:-
Add WORKER_URL=${{Worker instance private url}} and IS_WORKER=true. If main instance then make call to worker api, if worker then execute task and update database using private networking.
This will be in least cost(Thanks to railway private networking) and it's for your use case.
If you need long processing support along with server/client communication or your tasks are critical and you can accept for extra learning of code then you should use Nextjs with Inngest or trigger.dev . This will add cost but better observeability with no data/task loss.
3 Replies
2 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open Railway • about 2 months ago
2 months ago
I have created Nextjs with Inngest starter tamplate. It's fully self-hosted (even Inngest), with zero-config deployment. The Next.js app is pre-wired to the Inngest service. I also included an example 'Trigger Event' page so you can test the background jobs immediately. Once you are ready to write your own code you need to eject from the upstream repo and start writing your own functions for inngest.
a month ago
15 min not nextjs limitations, it's HTTP response limit by railway But railway is persistent server. You can use sockets if you wants realtime communication for long term.
But if you just need long processing support for data update,
- you can use "Fire & Forget" stretegy
- Or use 2 deployments of nextjs repo, One for keep everything running and one for worker, use webhooks for communication, keep everything in private networking for least cost. Use same code with a small change:-
Add WORKER_URL=${{Worker instance private url}} and IS_WORKER=true. If main instance then make call to worker api, if worker then execute task and update database using private networking.
This will be in least cost(Thanks to railway private networking) and it's for your use case.
If you need long processing support along with server/client communication or your tasks are critical and you can accept for extra learning of code then you should use Nextjs with Inngest or trigger.dev . This will add cost but better observeability with no data/task loss.
bilalnawaz072
15 min not nextjs limitations, it's HTTP response limit by railway But railway is persistent server. You can use sockets if you wants realtime communication for long term. But if you just need long processing support for data update, \- you can use "Fire & Forget" stretegy \- Or use 2 deployments of nextjs repo, One for keep everything running and one for worker, use webhooks for communication, keep everything in private networking for least cost. Use same code with a small change:- Add WORKER\_URL=${{Worker instance private url}} and IS\_WORKER=true. If main instance then make call to worker api, if worker then execute task and update database using private networking. This will be in least cost(Thanks to railway private networking) and it's for your use case. If you need long processing support along with server/client communication or your tasks are critical and you can accept for extra learning of code then you should use [Nextjs with Inngest](https://railway.com/deploy/nextjs-with-inngest?referralCode=InkF11&utm%5Fmedium=integration&utm%5Fsource=template&utm%5Fcampaign=generic) or [trigger.dev](http://trigger.dev) . This will add cost but better observeability with no data/task loss.
a month ago
Thanks for your advice. This seems to be working with my use cases. I got the point how railway server works.
I tried with inngest which creates a lot of bugs even using frontier ai model.
Status changed to Open brody • about 1 month ago
Status changed to Solved brody • about 1 month ago
