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:

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 with HTTPS access (no need to upload your own TLS certificate).
  • The free tier 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.

Note

A web application (website) is published based on files hosted in a public repository belonging to a public SourceCraft organization.

You can confirm ownership of a SourceCraft Sites website in Yandex Webmaster. For more information, see Questions about SourceCraft.

To create a web app:

  1. Get ready to work.
  2. Clone (git clone https://git@git.sourcecraft.dev/examples/sourcecraft-sites-web-app.git) or fork the repository into your organization on SourceCraft.
  3. Create a service connection named default-service-connection.
  4. Manually run the create-resources workflow on the master branch.
  5. Test your application.

If you no longer need the resources you have created, delete them and unpublish the website.

Getting started

  1. Authenticate in SourceCraft on the service home page or sign up.

The cost of web application infrastructure support includes:

Testing the application

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

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

Unpublishing a website

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

Connecting to a Managed Service for YDB database from a Python function in Yandex Cloud Functions