[Yandex Cloud documentation](../../index.md) > [Tutorials](../index.md) > [Serverless technologies](index.md) > Serverless-based backend > Web application on SourceCraft Sites and Yandex Cloud Functions

# Web application on SourceCraft Sites and Yandex Cloud Functions

This guide demonstrates an example of deploying a simple web application using various services and tools:

- Frontend: Static website on [SourceCraft Sites](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/sites).
- Backend: [Yandex Cloud Functions](../../functions/concepts/function.md) cloud function combined with a [Yandex API Gateway](../../api-gateway/concepts/index.md) gateway.
- Storing and working with code: [SourceCraft](https://sourcecraft.dev/portal/docs/en/) repository.
- Creating Yandex Cloud resources: [SourceCraft CI/CD](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/ci-cd) and [SourceCraft service connections](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/service-connections) to Yandex Cloud.

This web application is suitable for development and prototyping, or for a pet project. Advantages of this approach:

- There is no need to set up a virtual machine or a server for either the frontend or the backend.
- Free hosting on [SourceCraft Sites](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/sites) with HTTPS access (no need to upload your own TLS certificate).
- The [free tier](../../billing/concepts/serverless-free-tier.md) for **Yandex Cloud Functions** and **Yandex API Gateway** allows you to use them at no cost under light workloads.
- Free access to SourceCraft features for working with code and CI/CD under the **SourceCraft Free** [pricing plan](https://sourcecraft.dev/portal/docs/en/sourcecraft/pricing#src-plans).

{% note info %}

A web application (website) is published based on files hosted in a public [repository](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/#repos) belonging to a public SourceCraft [organization](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/#org).

You can confirm ownership of a SourceCraft Sites website in [Yandex Webmaster](https://webmaster.yandex.ru). For more information, see [Questions about SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/qa/sourcecraft-sites#verify-site-owner).

{% endnote %}

To create a web app:

1. [Get ready to work](#prepare).
1. [Clone](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/repo-clone) (`git clone https://git@git.sourcecraft.dev/examples/sourcecraft-sites-web-app.git`) or [fork](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/fork-work#create-fork) the [repository](https://sourcecraft.dev/examples/sourcecraft-sites-web-app) into your organization on SourceCraft.
1. [Create a service connection](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/service-connections) named `default-service-connection`.
1. [Manually run](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/run-workflow-manually) the `create-resources` workflow on the `master` branch.
1. [Test your application](#test).

If you no longer need the resources you have created, [delete](#clear-out) them and [unpublish](#delete) the website.

## Getting started {#prepare}

1. Sign up for Yandex Cloud and create a [billing account](../../billing/concepts/billing-account.md):
   1. Navigate to the [management console](https://console.yandex.cloud) and log in to Yandex Cloud or create a new account.
   1. On the **[Yandex Cloud Billing](https://center.yandex.cloud/billing/accounts)** page, make sure you have a billing account linked and it has the `ACTIVE` or `TRIAL_ACTIVE` [status](../../billing/concepts/billing-account-statuses.md). If you do not have a billing account, [create one](../../billing/quickstart/index.md) and [link](../../billing/operations/pin-cloud.md) a cloud to it.
   
   If you have an active billing account, you can create or select a [folder](../../resource-manager/concepts/resources-hierarchy.md#folder) for your infrastructure on the [cloud page](https://console.yandex.cloud/cloud).
   
   [Learn more about clouds and folders here](../../resource-manager/concepts/resources-hierarchy.md).
1. Authenticate in SourceCraft on the service [home page](https://sourcecraft.dev) or [sign up](https://sourcecraft.dev/portal/docs/en/sourcecraft/quickstart#registration).

### Required paid resources {#paid-resources}

The cost of web application infrastructure support includes:
* Cost of using the gateway (see [Yandex API Gateway pricing](../../api-gateway/pricing.md)).
* Cost of using a cloud function ([Yandex Cloud Functions pricing](../../functions/pricing.md)).

## Testing the application {#test}

To open the application, navigate to the following URL in your browser: `https://<organization_slug>.sourcecraft.site/<repository_name>`. If everything was set up correctly, you will see an input field for a name and a button on the page that opens. Enter a name and click the button; a greeting line should then appear below.

## Deleting Yandex Cloud resources {#clear-out}

You can delete the resources (the gateway and the cloud function) using one of the following methods:

* Manually in the Yandex Cloud console ([delete the function](../../functions/operations/function/function-delete.md), [delete the API gateway](../../api-gateway/operations/api-gw-delete.md)).
* [Manually](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/run-workflow-manually) run the `delete-resources` workflow in the repository.

## Unpublishing a website {#delete}

To unpublish a website, simply perform one of the following actions:

* Making a repository or organization private.
* Removing the `.sourcecraft/sites.yaml` file from the repository's main branch.

## Useful links {#see-also}

[Connecting to a Managed Service for YDB database from a Python function in Yandex Cloud Functions](connect-from-cf.md)