Serverless folder structure

What is the recommended way to structure a serverless app using serverless-framework?
And in any service / how do i organise multiple functions?

BlogApp (My project folder)
	|--users/ (this is the users service)
		|--.serverless/
		|--node_modules
		|--.gitignore
		|--index.js
		|--package-lock.json
		|--package.json
		|--serverless.yml
	|--posts (this is the users service)
		|--.serverless/
		|--node_modules
		|--.gitignore
		|--index.js
		|--package-lock.json
		|--package.json
		|--serverless.yml

I tend to have the same structure. Within each service I tend to add a folder called src for my own source code within which I have a folder for functions where my event handler functions go, lib for my abstracted code that my handlers will combine together to describe the business need and test for my unit tests. But you can do it anyway you like really.

1 Like