I was wondering if there were best practices regarding folder structure when creating websites with serverless backends.
Right now I have a Nextjs frontend and an AWS CDK backend. The current folder structure I am using has the cdk backend embedded in the frontend. Something like this:
.next
backend
bin
lib
test
node_modules
.gitignore
.npmignore
package.json
etc...
node_modules
public
src
styles
.gitignore
next-config.js
package.json
etc.....
As you can see, the frontend and the backend have separate node_modules (cdk and nextjs are both using typescript) and many of the packages seem to be locally duplicated. Is this ok?
Also, these are currently both within the same git repository. Is this advisable in terms of github-based CI/CD? Which folder structure (and git structure) will make development and deployment the least painful?