File/Folder Nextjs 前端和 AWS CDK 后端的结构
File/Folder Structure For Nextjs Frontend & AWS CDK Backend
我想知道在使用无服务器后端创建网站时是否有关于文件夹结构的最佳实践。
现在我有一个 Nextjs 前端和一个 AWS CDK 后端。我正在使用的当前文件夹结构在前端嵌入了 cdk 后端。像这样:
.next
backend
bin
lib
test
node_modules
.gitignore
.npmignore
package.json
etc...
node_modules
public
src
styles
.gitignore
next-config.js
package.json
etc.....
如您所见,前端和后端分开 node_modules(cdk 和 nextjs 都使用 typescript)并且许多包似乎是本地重复的。这样可以吗?
此外,这些目前都在同一个 git 存储库中。就 git 基于集线器的 CI/CD 而言,这是否可取?哪种文件夹结构(和 git 结构)将使开发和部署最不痛苦?
不行,本地复制不行。
我认为您可以从 AWS CDK Best Practices with special attention to Coding best practices section. Second, you can refer to AWS Solution Architect article who describes Recommended AWS CDK project structure for Python applications. By default, I understand that python is not Nextjs, though you can see find the general principles in it. Third, you can use a better way to structure AWS CDK projects around Nested Stacks 开始,将堆栈转换为库并重新使用代码。
我想知道在使用无服务器后端创建网站时是否有关于文件夹结构的最佳实践。
现在我有一个 Nextjs 前端和一个 AWS CDK 后端。我正在使用的当前文件夹结构在前端嵌入了 cdk 后端。像这样:
.next
backend
bin
lib
test
node_modules
.gitignore
.npmignore
package.json
etc...
node_modules
public
src
styles
.gitignore
next-config.js
package.json
etc.....
如您所见,前端和后端分开 node_modules(cdk 和 nextjs 都使用 typescript)并且许多包似乎是本地重复的。这样可以吗?
此外,这些目前都在同一个 git 存储库中。就 git 基于集线器的 CI/CD 而言,这是否可取?哪种文件夹结构(和 git 结构)将使开发和部署最不痛苦?
不行,本地复制不行。
我认为您可以从 AWS CDK Best Practices with special attention to Coding best practices section. Second, you can refer to AWS Solution Architect article who describes Recommended AWS CDK project structure for Python applications. By default, I understand that python is not Nextjs, though you can see find the general principles in it. Third, you can use a better way to structure AWS CDK projects around Nested Stacks 开始,将堆栈转换为库并重新使用代码。