Need help splitting my app into separate frontend and backend deployments

I’m having a tough time with my current setup and need some advice. Right now everything is bundled together but I want to separate my frontend and backend into different hosting services.

My backend keeps running into issues with the current serverless setup and I think having them deployed separately would solve a lot of problems. I’m thinking about putting the frontend on a static hosting service and the backend somewhere else that can handle a traditional server setup.

Here’s what I’m trying to figure out:

  • What’s the best way to make the frontend communicate with a backend that’s hosted elsewhere?
  • How should I manage configuration and API endpoints when they’re on different domains?
  • Which hosting platforms work well for Node.js applications with Express?

I really want to get this architecture right so any tips or recommendations would be super helpful. Thanks for any guidance you can share.

hmm interesting challenge! what kind of serverless issues are you running into exactly? also curious about your current tech stack - are you using react/vue for frontend? the cors thing sam mentioned is def important but wondering if you’ve considerd using something like docker for your backend deployment too?

The separation you’re planning will definitely resolve your serverless headaches. For frontend deployment, GitHub Pages or AWS S3 with CloudFront work exceptionally well for static sites. Regarding backend hosting, I’ve had excellent results with DigitalOcean App Platform and Heroku for Express applications - both handle Node.js deployments seamlessly. For cross-domain communication, create environment-specific configuration files that store your API base URLs. In development, point to localhost, and in production, use your backend’s domain. Handle authentication carefully since cookies won’t work across domains by default - consider JWT tokens stored in localStorage instead. One critical aspect others haven’t mentioned: implement proper error handling for network requests since your frontend will now depend on external API availability. Always have fallback states and retry logic built into your API calls.

i get why ur stressing but its not that complex. netlify or vercel for frontend, railway or render for backend should do the trick. just set ur env vars for the api url and make sure to configure cors right. been smooth sailing for me!