12 Factor App

Twelve Factor App methodology

Backing Services

Backing services are external resources that your application depends on. These services can range from caching solutions like Redis to email providers, object storage services, and more. For instance, we integrated Redis as a caching service in our application to store the visitor count. Other typical backing services include:

  • SMTP services for sending emails
  • S3 integrations for storing images
  • Managed databases and search engines

Your application should be designed to interact with these backing services as attached resources. This means that regardless of whether the service is hosted locally, on a managed cloud platform, or as a cloud-native service, the integration remains consistent. The application code should remain unchanged when switching between different deployment environments.

Key Point

The concept of treating backing services as attached resources enables seamless scaling and flexibility. Simply update configuration details to point your application to a new instance without modifying any code logic.

Redis as a Backing Service Example

Consider Redis, which we use as a caching layer:

  • Local Instance: You might run Redis on your local machine during development.
  • Cloud Deployment: In a production environment, Redis might be hosted on a cloud provider like AWS or Azure.
  • Managed Service: Alternatively, you could use a managed Redis service offered by various vendors.

Despite these variations, your application logic remains the same. You only need to update the connection settings to point to the chosen Redis instance.

Implementation Hint

Ensure that all your backing services are configurable via environment variables or external configurations. This decouples service specifics from your application code, enhancing portability and maintainability.

Why This Architecture Matters

By decoupling applications from the specific implementations of backing services, you gain flexibility and resilience in your deployment. Whether scaling up in cloud environments or switching service providers, your application's core functionality remains intact.

For more detailed insights and integration guidelines, explore comprehensive examples and further documentation on working with backing services.

Additional Resources

This approach not only simplifies deployments but also enhances the maintainability of your system by following best practices for service-oriented design.

Watch Video

Watch video content

Previous
Processes
Next
Config