ferrisup 0.2.5

A versatile Rust project bootstrapping tool - start anywhere, scale anywhere
Documentation
# {{project_name}}

A Rust serverless function created with FerrisUp targeting {{cloud_provider}}.

## Project Structure

```
{{project_name}}/
├── src/
│   └── main.rs         # Main function code
├── Cargo.toml          # Rust dependencies
{{#if (eq cloud_provider "aws")}}
├── template.yml        # AWS SAM template
└── Makefile            # Build and deployment commands
{{/if}}
{{#if (eq cloud_provider "gcp")}}
├── cloudbuild.yaml     # Google Cloud Build configuration
└── Dockerfile          # Container configuration
{{/if}}
{{#if (eq cloud_provider "azure")}}
├── host.json           # Azure Functions host configuration
└── function.json       # Function trigger configuration
{{/if}}
{{#if (eq cloud_provider "vercel")}}
└── vercel.json         # Vercel deployment configuration
{{/if}}
{{#if (eq cloud_provider "netlify")}}
└── netlify.toml        # Netlify deployment configuration
{{/if}}
```

## Getting Started

### Prerequisites

- Rust and Cargo (latest stable version)
{{#if (eq cloud_provider "aws")}}
- [AWS CLI](https://aws.amazon.com/cli/) - For deploying to AWS Lambda
- [Cargo Lambda](https://github.com/cargo-lambda/cargo-lambda) - For local testing and deployment
{{/if}}
{{#if (eq cloud_provider "gcp")}}
- [Google Cloud SDK](https://cloud.google.com/sdk/docs/install) - For deploying to Google Cloud Functions
{{/if}}
{{#if (eq cloud_provider "azure")}}
- [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) - For deploying to Azure Functions
- [Azure Functions Core Tools](https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local) - For local testing
{{/if}}
{{#if (eq cloud_provider "vercel")}}
- [Vercel CLI](https://vercel.com/docs/cli) - For deploying to Vercel
{{/if}}
{{#if (eq cloud_provider "netlify")}}
- [Netlify CLI](https://www.netlify.com/products/cli/) - For deploying to Netlify
{{/if}}

## Local Development

{{#if (eq cloud_provider "aws")}}
### AWS Lambda

To test your AWS Lambda function locally:

1. Install Cargo Lambda:
   ```bash
   cargo install cargo-lambda
   ```

2. Run the function locally:
   ```bash
   cargo lambda watch
   ```

3. Make HTTP requests to your function:
   ```bash
   curl -X POST "http://localhost:9000/lambda-url/{{project_name}}" -d '{"name": "world"}'
   ```
{{/if}}

{{#if (eq cloud_provider "gcp")}}
### GCP Cloud Functions

For Google Cloud Functions, you can test locally with the Functions Framework:

1. Build your function:
   ```bash
   cargo build --release
   ```

2. Use Docker to test:
   ```bash
   docker build -t {{project_name}} .
   docker run -p 8080:8080 {{project_name}}
   ```

3. Make HTTP requests to your function:
   ```bash
   curl -X POST "http://localhost:8080" -d '{"name": "world"}'
   ```
{{/if}}

{{#if (eq cloud_provider "azure")}}
### Azure Functions

For Azure Functions, you can test locally with Azure Functions Core Tools:

1. Start your function app:
   ```bash
   func start
   ```

2. Make HTTP requests to your function:
   ```bash
   curl -X POST "http://localhost:7071/api/{{project_name}}" -d '{"name": "world"}'
   ```
{{/if}}

{{#if (eq cloud_provider "vercel")}}
### Vercel Functions

For Vercel Functions, you can test locally with Vercel CLI:

1. Start development server:
   ```bash
   vercel dev
   ```

2. Make HTTP requests to your function:
   ```bash
   curl -X POST "http://localhost:3000/api/{{project_name}}" -d '{"name": "world"}'
   ```
{{/if}}

{{#if (eq cloud_provider "netlify")}}
### Netlify Functions

For Netlify Functions, you can test locally with Netlify CLI:

1. Start development server:
   ```bash
   netlify dev
   ```

2. Make HTTP requests to your function:
   ```bash
   curl -X POST "http://localhost:8888/.netlify/functions/{{project_name}}" -d '{"name": "world"}'
   ```
{{/if}}

## Deployment

{{#if (eq cloud_provider "aws")}}
### AWS Lambda

To deploy your AWS Lambda function:

1. Configure AWS credentials:
   ```bash
   aws configure
   ```

2. Deploy with Cargo Lambda:
   ```bash
   cargo lambda deploy
   ```
{{/if}}

{{#if (eq cloud_provider "gcp")}}
### GCP Cloud Functions

To deploy your Google Cloud Function:

1. Configure GCP credentials:
   ```bash
   gcloud auth login
   ```

2. Deploy to GCP:
   ```bash
   gcloud functions deploy {{project_name}} \
     --runtime=rust \
     --trigger-http \
     --allow-unauthenticated
   ```
{{/if}}

{{#if (eq cloud_provider "azure")}}
### Azure Functions

To deploy your Azure Function:

1. Configure Azure credentials:
   ```bash
   az login
   ```

2. Deploy to Azure:
   ```bash
   func azure functionapp publish your-function-app
   ```
{{/if}}

{{#if (eq cloud_provider "vercel")}}
### Vercel Functions

To deploy your Vercel Function:

1. Deploy to Vercel:
   ```bash
   vercel
   ```
{{/if}}

{{#if (eq cloud_provider "netlify")}}
### Netlify Functions

To deploy your Netlify Function:

1. Deploy to Netlify:
   ```bash
   netlify deploy --prod
   ```
{{/if}}

## Additional Resources

{{#if (eq cloud_provider "aws")}}
- [AWS Lambda Documentation](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html)
- [Cargo Lambda GitHub](https://github.com/cargo-lambda/cargo-lambda)
- [AWS SDK for Rust](https://github.com/awslabs/aws-sdk-rust)
{{/if}}

{{#if (eq cloud_provider "gcp")}}
- [Google Cloud Functions Documentation](https://cloud.google.com/functions/docs)
- [Google Cloud Rust SDK](https://github.com/googleapis/google-cloud-rust)
{{/if}}

{{#if (eq cloud_provider "azure")}}
- [Azure Functions Documentation](https://docs.microsoft.com/en-us/azure/azure-functions/)
- [Azure SDK for Rust](https://github.com/Azure/azure-sdk-for-rust)
{{/if}}

{{#if (eq cloud_provider "vercel")}}
- [Vercel Serverless Functions Documentation](https://vercel.com/docs/functions/serverless-functions)
- [Vercel Rust Runtime](https://github.com/vercel-community/rust)
{{/if}}

{{#if (eq cloud_provider "netlify")}}
- [Netlify Functions Documentation](https://docs.netlify.com/functions/overview/)
- [Netlify Rust Functions Example](https://github.com/netlify/rust-functions-example)
{{/if}}