Serverless Project Requirements - hendricksonja/serverless GitHub Wiki

Below is a sample writeup you could provide to your students as an assignment description. Feel free to adjust details to fit your course requirements and learning objectives.


Assignment: Building a Multi-Function Workflow with DigitalOcean Functions

Objective:
This assignment will introduce you to building serverless workflows using DigitalOcean Functions. You’ll create a small application or workflow composed of at least three serverless functions working together. You’ll leverage the simplicity of serverless computing to focus on the logic of your application rather than on managing infrastructure. Additionally, you are encouraged to use tools like ChatGPT to help you write, troubleshoot, and refine your functions and code.


Background

What Are Serverless Functions?
Serverless functions are small, event-driven pieces of code that run on-demand in the cloud. Instead of provisioning and managing servers, you simply write the logic you need and let the platform handle the infrastructure. Serverless functions are ideal for tasks like responding to API requests, processing data, integrating with external services, or automating periodic tasks.

Why Use Multiple Functions?
By splitting logic into multiple functions, you can:

  • Encourage modular design: each function does one thing well.
  • Easily scale different parts of your application independently.
  • Simplify updates and maintenance by dealing with small, self-contained units of code.

Assignment Requirements

  1. Number of Functions:
    Your project must incorporate at least three separate DigitalOcean Functions. Think of these functions as different "building blocks" of your workflow.

  2. Integration of Functions: Your functions should work together to create a coherent workflow or application. For example:

    • Data Ingestion Function: Fetch data from an API or user input.
    • Data Processing Function: Transform or analyze the data (e.g., filter, aggregate, or compute statistics).
    • Output/Notification Function: Store the processed results, send an email, generate a report, or provide an API endpoint that returns the processed data.

    You are free to choose any meaningful workflow as long as the functions connect logically.

  3. Use of ChatGPT: You may use ChatGPT to help:

    • Brainstorm ideas for your application workflow.
    • Write or optimize code for your functions.
    • Debug issues or errors that arise during development.

    The goal is for you to understand what’s happening, so if ChatGPT suggests code, study it and make sure you can explain how it works.

  4. Documentation and Explanation: Along with your code, include a brief write-up explaining:

    • What your workflow does: Describe the purpose of your application.
    • How the functions interact: Explain how data flows from one function to another, including triggers and dependencies.
    • Why you chose this approach: Justify your architecture or design choices.
  5. Deployment on DigitalOcean:

    • Create and deploy each function on DigitalOcean Functions.
    • Configure any necessary environment variables, secrets, or integration with external APIs.
    • Test your functions to ensure they run as expected.
  6. Demonstration: After deployment, demonstrate:

    • How to invoke the functions (e.g., via their endpoints or events).
    • Show sample input and output.
    • Confirm that the entire workflow (all three functions) operates successfully.

Example Ideas

  • Weather Data Pipeline:

    1. Fetch Weather Data: One function fetches weather data from a public API.
    2. Process & Analyze: Another function calculates temperature averages or detects patterns (e.g., upcoming rainy days).
    3. Distribute Results: A third function generates a daily report sent to a provided email address or posted to a dashboard.
  • Content Aggregator:

    1. Web Scraper: A function that gathers content (headlines, articles) from various news APIs.
    2. Content Filter: A function that filters content based on keywords or categories.
    3. Formatter & Exporter: A function that compiles the filtered articles into a summary and returns it as a JSON endpoint or sends a formatted email digest.
  • File Processing Workflow:

    1. File Ingest: A function triggers whenever a file is uploaded to object storage (e.g., DigitalOcean Spaces).
    2. Transformation: A function resizes an image or converts a text file’s formatting.
    3. Result Delivery: A function saves the processed file or updates a database record, then notifies a user or another system.

Feel free to come up with your own idea—just make sure your solution is practical and showcases how multiple functions can work together.


Grading Criteria

  • Functionality (40%): Your three or more functions run as intended and together form a coherent workflow.
  • Code Quality (20%): Code is well-structured, commented, and uses best practices suggested by ChatGPT or learned in class.
  • Documentation (20%): Clear explanation of your workflow, how each function operates, and how they interact.
  • Completeness (20%): All requirements met, deployed on DigitalOcean Functions, and demonstrated with test input/output.

Getting Started

  1. Set up your DigitalOcean Functions Environment:
    Follow DigitalOcean’s documentation to get your first function deployed.

  2. Brainstorm Your Workflow:
    Decide on what data or event you want to handle and what outcome you want to produce.

  3. Iterative Development:
    Start with one function at a time. Test each function individually before connecting them.

  4. Leverage ChatGPT:
    Ask ChatGPT for code snippets, troubleshooting advice, or best practices for serverless functions.

  5. Integrate and Test:
    Connect your functions, ensure they can pass data along, and test your workflow end-to-end.


Good luck, and have fun exploring serverless functions!