DEV Community

Multiple Frontends with AWS Amplify

Norris Chebl on May 18, 2020

Goal Build a React content management system that persists data (videos, images, etc.) to multiple React Native mobile apps. Utilizing ...
Collapse
 
agapaudi profile image
Mau Peon

Hi, How can you deploy different frontends with same backend. Amplify only let me use same repository with multiple branches, can I use multiple repositories?

Collapse
 
railwaygundora profile image
RailwayGunDora

That's an issue, thanks for bringing it up. You actually need to be in the same repo and have different branches there.

Collapse
 
adnanraml profile image
Adnan

I think this link answer your question
docs.amplify.aws/cli/teams/multi-f...

Collapse
 
a9udn9u profile image
Quan Gan

That link doesn't answer Mau's question.

By "deploy" if you mean running amplify publish to deploy to Amplify's static hosting then the answer is no, you can't publish frontends in different repositories. Even if the Amplify cli allows you to do that, your repos will override each other.

Thread Thread
 
adnanraml profile image
Adnan

Hi,
yes I was having the same question you have.
I think the solution is to add multiple branches in the frontend envirmoent and do the sub-domain configration with amplify framework in the console .

Collapse
 
oleksiisytar profile image
Oleksii Sytar

According to this note: Note: Whenever updating your API in your backend, make sure to copy over the new graphql files into your new frontend. Do I need to copy files every time I have made changes? Maybe we have some way to automate this?

Collapse
 
bcsgbl profile image
bcs-gbl • Edited
  1. If is started a project with "amplify init" command everyting is OK.
  2. But if started with "amplify pull" (for example on a second frontend APP), I've got this error:

ˇˇˇ
amplify pull --appId d45659npivltuns --envName test
EPERM: operation not permitted, rename 'D:\web-nodejs\test\amplify' -> 'D:\web-nodejs\test\amplify-backup'
Error: EPERM: operation not permitted, rename 'D:\web-nodejs\test\amplify' -> 'D:\web-nodejs\test\amplify-backup'
at Object.renameSync (fs.js:741:3)
ˇˇˇ

Same error if just run an "amplify pull".

Im on Windows10, latest
I tried to:

  • reinstall npm and libs, with clearing all cache, dirs, so on
  • reinstall amplify-cli
  • reinstall amplify-cli with --unsafe-perm=true prameter And try this whole workflow:
  • with admin or simple user roles,
  • different consloles,
  • in WSL2
  • different & fully clean directories,

but i got tha same error.

If I copy the first APP's amplify directory to the second, every "amplify pull" command works..
Now, I have no idea..

Collapse
 
pedroapfilho profile image
Pedro Filho

Isn’t it better to have a project only for the amplify backend?

Collapse
 
arshadcomp profile image
arshadcomp

If I have two Vue frontends for the same backend. Will amplify publish push the frontend code in same repo or different?

Collapse
 
djom202 profile image
Jonathan Olier

Why do you need to create a user model? I'm supposing that you can use the userid from Cognito.

Collapse
 
skydowx profile image
skydowx

You can use the userid from cognito. But sometimes you might want to make connections with other entities in the database. In that situation, it is useful to also make a user entity in the database.

type User @model {
...
posts: [Post]! @connection
...
}
Enter fullscreen mode Exit fullscreen mode