Support the ongoing development of Laravel.io →
Configuration Architecture
Last updated 1 year ago.
0
Solution

Hi Niall,

My team and I recently switched to this architecture where we have the API and front end code completely separated. So far we've done 3 medium-sized projects this way and it worked out great. Here are some basics:

API It's done in Laravel, it's got it's own subdomain at api.yoursite.com and it can be served from a separate server. Authentication type depends on the project. The only thing you have to take care of is CORS, to allow the domains of your front end app to access the API.

Web app The code is in AngularJS and it's at yoursite.com (we usually have multiple subdomains for the app too). We serve it from our server, but you can serve it from CDN if you want (we played with S3, but still decided to go with our server since the apps are not under pressure with visits and also deployment and maintenance are easier). The only issue here was SEO, but there are services for this and prerender.io works fine for now (also Google renders JS since a couple of months ago).

We played with many versions of this architecture, like rendering index on the server side for example, but decided to go with completely separate code and it's working well for us. These are just some basics, I'd be glad to go into more detail if you need some more information.

Last updated 1 year ago.
0

Thanks, I decided to deploy my client straight into my API server which is only serving a single view to load the client app.

Last updated 1 year ago.
0

marlek said:

Hi Niall,

My team and I recently switched to this architecture where we have the API and front end code completely separated. So far we've done 3 medium-sized projects this way and it worked out great. Here are some basics:

API It's done in Laravel, it's got it's own subdomain at api.yoursite.com and it can be served from a separate server. Authentication type depends on the project. The only thing you have to take care of is CORS, to allow the domains of your front end app to access the API.

Web app The code is in AngularJS and it's at yoursite.com (we usually have multiple subdomains for the app too). We serve it from our server, but you can serve it from CDN if you want (we played with S3, but still decided to go with our server since the apps are not under pressure with visits and also deployment and maintenance are easier). The only issue here was SEO, but there are services for this and prerender.io works fine for now (also Google renders JS since a couple of months ago).

We played with many versions of this architecture, like rendering index on the server side for example, but decided to go with completely separate code and it's working well for us. These are just some basics, I'd be glad to go into more detail if you need some more information.

Hi, I'm just wondering how you structure your git repos? I'm finding that everything in one repo is a little "noisy" in terms of the number of commits etc. Do you use git submodules or do you just split everything out? Thanks in advance.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.