Code structure

With any new application, there are many ways to organize code on disk. The following structure has worked very well for my colleagues and me across multiple projects. I encourage readers to use this as a starting point and adapt as needed. If using Node.js or another supported language for your FaaS provider, this may look slightly different. Throughout this chapter, we will fill in our example coffee cupping API and will add more files as we build the application:

├── Makefile ├── README.md ├── envs/│   ├── dev │   ├── qa │   └── production ├── requirements.txt ├── serverless/ │   ├── cupping/│   ├── handler.py │   ├── lib/│   └── serverless.yml └── tests/    ├── conftest.py     ├── factories.py     ├── helpers.py     ├── test_session_model.py  └── ...

Get Serverless Design Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.