Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Deploy a static HTML site and learn how to host frontend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a static HTML site with Code Capsules, we've provided an example application, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Frontend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, a URL link will appear in the URL section in the "Details" tab. Click the link, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other .
Host and set up auto deployments from a specified GitHub repo branch for a Vue application.
Deploy a Vue application and learn how to host frontend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a Vue application with Code Capsules, we've provided an example application, which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
A guide on how to deploy an HTML5 template from GitHub.
Deploy an HTML5 template and learn how to host frontend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy an HTML5 template to Code Capsules, we'll be using a template from . Head over to the HTML5 UP site and download the zip file for any template you find there. Unzip this template file in your preferred working directory on your local machine.
Publish a Svelte application by linking directly to your GitHub repo.
Deploy a Svelte application and learn how to host frontend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a Svelte application with Code Capsules, we've provided an example application, which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
Publish a bootstrap site using its source code on GitHub.
Deploy a Bootstrap site and learn how to host frontend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a Bootstrap site with Code Capsules, we've provided an example application, which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
Link a React GitHub repo to a PaaS provider to enable auto deployments.
Deploy a React application and learn how to host frontend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a React application with Code Capsules, we've provided an example application, which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
A guide to deploying a Django MongoDB application from GitHub.
Deploy a Django MongoDB application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a Django MongoDB application with Code Capsules, we've provided an example application which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination
Press "Next".
Leave "Build Command" and the "Static content folder path" blank.
Click "Create Capsule".


Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Frontend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Press "Next".
Type npm run build in "Build Command" and dist in "Static Content Folder Path".
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, a URL link will appear in the URL section in the "Details" tab. Click the link, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.
Sign in to GitHub and create a repository for the template site you downloaded.
We'll need to push the unzipped template files to your newly created repository for Code Capsules to deploy the template site from your GitHub account. To do this, initialize a git repository in the project's root folder on your machine by running the command git init from a terminal window while in the root folder.
Before you can push to GitHub, you need to add the untracked files to your local repository. Run git add -A in a terminal window from the project's root folder to do so. After adding the files, commit your changes by running git commit -m "Initial app commit".
Run the command below to set the remote repository for your local repo. Be sure to replace <YOUR-REMOTE-GITHUB-URL> with the actual URL for your remote repository.
Push the unzipped files to your remote repository by running git push origin main.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the top right of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Frontend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Press "Next".
Leave "Build Command" and the "Static content folder path" blank.
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, a URL link will appear in the URL section in the "Details" tab. Click the link, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Frontend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Press "Next".
Type npm run build in "Build Command" and public in "Static Content Folder Path".
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, a URL link will appear in the URL section in the "Details" tab. Click the link, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Frontend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Press "Next".
Leave the "Build command" and "Static content folder path" blank.
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, a URL link will appear in the URL section in the "Details" tab. Click the link, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Frontend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Press "Next".
Type npm run build in "Build Command" and build in "Static Content Folder Path".
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, a URL link will appear in the URL section in the "Details" tab. Click the link, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.
A provides the server for hosting an application on Code Capsules.
Navigate to the "Spaces" tab and open the Space you'll be using.
Click the yellow "+" button in the bottom left of the screen, select "New Capsule", and follow the instructions below to create a Data Capsule::
Choose "Data Capsule".
Under "Data Type", select "MongoDB Database Cluster".
Under "Product", select "Standard".
Click "Create Capsule".
Navigate to the "Space" containing your recently created Data Capsule. Click the yellow "+" button in the bottom left of the screen, select "New Capsule", and follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule".
Under "Product", select "Sandbox".
Choose the GitHub repository you forked.
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
After the two capsules have been successfully built, the next step is to connect them. To do this, navigate to the "Config" tab of your Backend Capsule. Scroll down to the "Data Capsule" section and click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
You can now view the application after the two capsules have been connected. To see how it looks, click on the URL in the "Details" tab.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.
Deploy your application with with PHP and Docker to Production on Code Capsules
This guide will show you how to deploy your application built with PHP and Docker to Code Capsules. By the end of this guide, you'll have an application that looks like the one below which runs on the public internet, and you'll get a URL to share with your users.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a PHP and Docker application with Code Capsules, we've provided some example starting code, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top right of your screen and selecting your GitHub account as the destination.
If you don't already have an account, navigate to the site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you've just signed up for an account, you'll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you're signing in again, click on the "Spaces" tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at .
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Choose "Docker Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, navigate to the "Config" tab and edit the "Capsule Parameters" section. Enter "80" as the port number and click on "Save".
Restart your capsule by toggling the radio button in the top right off and on again.
Once the build is complete, click the "URL" link in the "Details" tab, and you should see your deployed application. Navigate to the /api route to view it.
If you’d like to deploy another application in a different language or framework, take a look at our other .
A powerful frontend framework supported by Code Capsules, Angular simplifies building dynamic web applications, providing robust tools and libraries for efficient development and deployment.
Deploy an Angular application and learn how to host frontend code on Code Capsules. At the end of the guide, you would have deployed the application in the screenshot below and can adapt it to meet your unique needs.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you’ll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy an Angular application with Code Capsules, we’ve provided an example application, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
If you don’t already have an account, navigate to the site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you’ve just signed up for an account, you’ll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you’re signing in again, click on the "Spaces" tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at .
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default “personal” Team if you’re the only person working on this project, or a named Team if you’re collaborating with others
This should remind you of the project, for example, “customer-api” or “notetaking-app”
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Navigate to the Space containing your recently created Data Capsule and click the yellow + icon on the bottom left of the screen. Follow the instructions below to create a Frontend Capsule:
Choose "Frontend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you’ve finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, click the "URL" link in the "Details" tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other .
A guide to deploying an Express.js and Mongo application from GitHub.
Deploy an Express.js and Mongo application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy an Express.js MongoDB application with Code Capsules, we've provided an example application, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
A provides the server for hosting an application on Code Capsules.
Navigate to the Spaces tab and open the Space you'll be using.
Click the yellow "+" button in the bottom left of the screen, select "New Capsule", and follow the instructions below to create a Database Capsule:
Choose "Data Capsule".
Under "Data Type", select "MongoDB Database Cluster".
Click "Create Capsule".
Navigate to the Space containing your recently created Data Capsule. Click the yellow "+" button in the bottom left of the screen, select "New Capsule", and follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose a payment plan.
Choose the GitHub repository you forked.
Press "Next".
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
After the two capsules have been successfully built, the next step is to connect them. To do this, navigate to the "Config" tab of your Backend Capsule. Scroll down to the "Data Capsule" section and click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
You can now view the application after the two capsules have been connected. To see how it looks, click on the URL in the "Details" tab.
If you’d like to deploy another application in a different language or framework, take a look at our other .
A guide to deploying a Node.js Telegram Bot from GitHub.
Deploy a Node.js Telegram Bot and learn how to host backend code on Code Capsules.
You'll need a Telegram user account before you can create a Telegram bot. Head over to Telegram and create an account if you don't already have one.
When you've signed in to Telegram, search for "BotFather" (a bot for managing all other Telegram bots) and start a new chat with it. Follow the steps below to register a new bot with the BotFather:
git remote add origin <YOUR-REMOTE-GITHUB-URL>Press "Next".
Click "Create Capsule".



Press "Next".
Type npm run build in "Build Command" and dist/ng4-complete-guide in "Static Content Folder Path".
Click "Create Capsule".



Video Guides
If you prefer watching videos to reading text, find videos…

Click "Create Capsule".


/start and press send.Type /newbot and press send.
Choose a name for your bot.
Choose a username for your bot that ends in "bot".
The BotFather will respond with a message containing an access token for your newly created bot. This access token will allow our application to access the Telegram API and tell our bot what to do when receiving different messages from users.
To confirm that your bot was created successfully, search for the bot's username. You should be able to see it and start a conversation with it, although it won't respond as we haven't written the bot's logic yet.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Node.js Telegram Bot with Code Capsules, we've provided an example bot which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example bot repository by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the top right of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, you have to add BOT_TOKEN and URL environment variables on the "Config" tab under the "Environment Variables" section.
Assign the BOT_TOKEN variable the value of the access token you were given by the BotFather when you registered the bot.
For the URL variable, set it to the value of your bot's domain. You can get it by clicking the "Live Website" link to the left of the capsule's toggle button and copying the URL in the new tab that opens. Paste the URL you copied in the value field for the URL environment variable (make sure the URL ends with a / or the webhook will not be valid).
Confirm your changes by clicking on "Save", then restart your Capsule by toggling the radio button in the top right off and on again.
The bot will be able to respond to messages after Code Capsules finishes building it. When this is done, search for your bot on Telegram using the username you assigned it and start a chat with it. The bot has been programmed to respond to /start and echo any messages you send it.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.












MongoDB provides reliable NoSQL persistent storage for your applications. In this tutorial, we look at how to create a MongoDB instance you can use with your backend applications that are running on Code Capsules and elsewhere.
Log in to your Code Capsules account and navigate to the Space your MongoDB Data Capsule will be contained in. Click the yellow + button in the bottom left of the screen, select "New Capsule", then select the "MongoDB" option from the dropdown.
In the New Data Capsule dialog, choose "MongoDB Database Cluster" as your data type, then click the "Create Capsule" button.
To connect a Data Capsule to a Backend Capsule hosted on Code Capsules, you need to provide a database connection string from your Database Capsule to your Backend Capsule. If you're not hosting your backend application on Code Capsules, you can jump to , as this step is not applicable in that use case.
Navigate to the Backend Capsule and click "Config" to open the Capsule's config tab. Scroll down to the "Data capsules" section, where your recently created Data Capsule will show.
Click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to the services and features of your Data Capsule.
We can use this database variable in code to read and write to our Data Capsule. Copy the value of the DATABASE_URL variable and append /your_db_name?authSource=admin to it as a query parameter. Make sure to replace your_db_name with the actual name of your database. This tells the Data Capsule to read and write to the specified database. If a database named your_db_name doesn't exist, the Data Capsule will create it. This allows you to have multiple databases in one Data Capsule.
If your Backend Capsule is a Python application, use the following code to connect to your MongoDB Data Capsule:
If your Backend Capsule is a Node.js application, use the following code to connect to your MongoDB Data Capsule:
If you're not hosting your backend application on Code Capsules, you can still connect your Data Capsule to it. The first step is to allow public access to your Data Capsule. Make sure this option is turned on in the "Details" tab of your Data Capsule's details screen.
If public access to your Data Capsule is enabled, a connection string is visible below the "Public Access" switch, as shown in the above picture. Copy this connection string and append &authSource=admin to it so that its format is similar to mongodb://92d79d9b-64f2-0:[email protected]:27017/app?ssl=true&authSource=admin.
The string slice preceeding /app?ssl=true&authSource=admin will be different in your case since you're using a different Data Capsule from the one used for the purpose of writing this reference guide. The last /app?ssl=true&authSource=admin part doesn't need to be replaced though. Paste the appended connection string into your backend application's code to access your Data Capsule's services.
If your backend application is written in Python, use the following code to connect to your MongoDB Data Capsule:
If you copied the code snippet above remember to replace the mongodb://92d79d9b-64f2-0:[email protected]:27017 string slice in the database_url variable with the corresponding value for your connection string.
If your backend application is written in Node.js, use the following code to connect to your MongoDB Data Capsule:
If you copied the code snippet above remember to replace the mongodb://92d79d9b-64f2-0:[email protected]:27017 string slice in the database_url variable with the corresponding value for your connection string.
A guide to deploying a Django application from GitHub.
Deploy a Django application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you’ll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Django application with Code Capsules, we’ve provided an example application, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
If you don’t already have an account, navigate to the site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you’ve just signed up for an account, you’ll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you’re signing in again, click on the "Spaces" tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at .
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default “personal” Team if you’re the only person working on this project, or a named Team if you’re collaborating with others
This should remind you of the project, for example, “customer-api” or “notetaking-app”
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Navigate to the "Capsules" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Capsule.
To create a new Data Capsule for your Space, follow the instructions below:
Choose "Persistent Storage", your Team, and Space.
Choose your payment plan.
Click "Create Capsule".
Navigate to the Space containing your recently created Data Capsule and click the yellow + icon on the bottom left of the screen. Follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you’ve finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Now you need to bind the two capsules together. Navigate to the "Config" tab of the Backend Capsule you've just created. Scroll to the "Bind Data Capsule" section and click on the "Bind". This enables the capsule to use the Persistent database in the Data Capsule.
Restart your capsule by toggling the radio button in the top right off and on again.
Once the build is complete, click the "URL" link in the "Details" tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other .
A guide to deploying a Next.js application from GitHub.
Deploy a Next application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Next application with Code Capsules, we've provided an example application, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, a URL link will appear in the URL section in the "Details" tab. Click the link, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other .
A walkthrough on how to deploy a Flask application from GitHub.
Deploy a Flask application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Flask application with Code Capsules, we've provided an example application, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space follow the instructions below:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, a URL link will appear in the URL section in the "Details" tab. Click the link, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other .
Publish a Caddy Docker site using its source code on GitHub.
Deploy a Caddy Docker site and learn how to host frontend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a Bootstrap site with Code Capsules, we've provided an example application, which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
A guide on how to launch a Java MySQL application from GitHub.
Deploy a Java MySQL application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a Java MySQL application with Code Capsules, we've provided an example application, which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.



import os
import pymongo
data_capsule_url = os.getenv('DATABASE_URL')
database_one_url = data_capsule_url + "/database_one?authSource=admin"
production_database_url = data_capsule_url + "/production_database?authSource=admin"
client = pymongo.MongoClient(database_one_url)
db = client.database_one
### Do something with the db variable here
data_capsule_url = process.env.DATABASE_URL
database_one_url = data_capsule_url + "/database_one?authSource=admin"
production_database_url = data_capsule_url + "/production_database?authSource=admin"
var MongoClient = require('mongodb').MongoClient;
MongoClient.connect(database_one_url, function(err, db) {
// Do something with the db variable here
});
import pymongo
database_url = "mongodb://92d79d9b-64f2-0:[email protected]:27017/app?ssl=true&authSource=admin"
client = pymongo.MongoClient(database_url)
db = client.database_one
### Do something with the db variable here
database_url = "mongodb://92d79d9b-64f2-0:[email protected]:27017/app?ssl=true&authSource=admin"
var MongoClient = require('mongodb').MongoClient;
MongoClient.connect(database_url, function(err, db) {
// Do something with the db variable here
});
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".


Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".

Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
If you don't already have an account, navigate to the Code Capsules site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you've just signed up for an account, you'll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you're signing in again, click on the "Spaces" tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at .
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Navigate to the "Space" containing your recently created Data Capsule and click the yellow + icon on the bottom left of the screen. Follow the instructions below to create a Backend Capsule:
Choose "Docker Capsule", your Team, and Space.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Press "Next".
Enter "Dockerfile" as the input in the "Dockerfile location" field.
Leave the "Docker build context" field blank.
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, click the "URL" link in the "Config" tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.
A provides the server for hosting an application on Code Capsules.
Navigate to the Spaces tab and open the Space you'll be using.
Click the yellow "+" button in the bottom left of the screen, select "New Capsule", and follow the instructions below to create a Data Capsule:
Choose "Data Capsule".
Under "Data Type", select "MySQL Database Cluster".
Click "Create Capsule".
Navigate to the "Space" containing your recently created Data Capsule and click the "New Capsule" button. Follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose a payment plan.
Choose the GitHub repository you forked.
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
After the two capsules have been successfully built, the next step is to connect them. To do this, navigate to the "Config" tab of your Backend Capsule. Scroll down to the "Data Capsule" section and click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
You can now view the application after the two capsules have been connected. To see how it looks, click on the URL in the "Details" tab.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.




A guide to deploying a Slack Bot from GitHub.
Deploy a Node.js Slack Bot and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Node.js Slack Bot with Code Capsules, we've provided an example bot, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example bot repository by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the top right of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
You'll need a Slack user account and to log into a workspace before you can create a Slack bot. After you have logged into a workspace, head over to the page and click on "Create an app".
On the popup that displays, choose the "From scratch" option, give your app a name, and choose the workspace you want to add it to, then click "Create App".
Click "OAuth & Permissions" on the left panel and scroll down to the Scopes section, and click "Add an OAuth Scope" under the Bot Token Scopes section.
Choose "chat:write" from the options list.
Our bot's logic makes use of environment variables to function securely. You'll need to add the variables to your capsule's "Configure" tab before the bot can send/receive messages from your workspace.
For the first environment variable, SLACK_BOT_TOKEN:
Head over to your app dashboard on Slack, and click on the "OAuth & Permissions" menu item on the left-hand side.
Click the "Install to Workspace" button, followed by the "Allow" button.
Actioning the preceding 2 steps should reveal a newly generated "Bot User OAuth Token". Copy this token.
On your capsule's "Configure" tab, add a new environment variable with the name SLACK_BOT_TOKEN and set its value to the token you copied in the previous step.
For the second environment variable, SLACK_CHANNEL_ID:
Open Slack and right-click on the channel name of the channel you want to send messages to.
On the context menu that appears, choose "Copy Link".
Paste the link in a browser tab, but don't press "enter" or "return".
The link should follow the format, https://<workspace-name>.slack.com/archives/C01SZ6Z3TCY
For the third environment variable, SLACK_SIGNING_SECRET:
Head over to your Slack app dashboard and click on "Basic Information" on the left-hand side.
Scroll down to App Credentials and look for the Signing Secret. Click "Show" and copy the secret.
Add a new environment variable with the name SLACK_SIGNING_SECRET on your capsule's "Config" tab and set its value to the secret you copied in the previous step.
You need to invite the bot to the chosen channel so that it'll be able to post there. To do this, send a message mentioning @<bot-name> the bot in the channel you added it to. Click "Invite Them" when Slack prompts you.
The bot can now send messages to the channel every time it starts. You can restart the capsule to see this functionality in action, or alternatively, send a /stats message in the channel to get a report about the bot's status on Code Capsules.
If you’d like to deploy another application in a different language or framework, take a look at our other .
A guide to deploying a Python Telegram Bot from GitHub.
A video for this guide can be found here if you prefer watching to reading.
Deploy a Python Telegram Bot and learn how to host backend code on Code Capsules.
You'll need a Telegram user account before you can create a Telegram bot. Head over to Telegram and create an account if you don't already have one.
When you've signed in to Telegram, search for "BotFather" (a bot for managing all other Telegram bots) and start a new chat with it. Follow the steps below to register a new bot with the BotFather:
Type /start and press send.
Type /newbot and press send.
Choose a name for your bot.
Choose a username for your bot that ends in "bot".
The BotFather will respond with a message containing an access token for your newly created bot. This access token will allow our application to access the Telegram API and tell our bot what to do when receiving different messages from users.
To confirm that your bot was created successfully, search for the bot's username. You should be able to see it and start a conversation with it, although it won't respond as we haven't written the bot's logic yet.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a Python Telegram Bot with Code Capsules, we've provided an example bot, which you can find on the .
Sign in to GitHub, and fork the example bot repository by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, you have to add BOT_TOKEN and URL environment variables on the "Config" tab under the "Environment Variables" section.
Assign the BOT_TOKEN variable the value of the access token you were given by the BotFather when you registered the bot.
For the URL variable, set it to the value of your bot's domain. You can get it by clicking the "Live Website" link to the left of the capsule's toggle button and copying the URL in the new tab that opens. Paste the URL you copied in the value field for the URL environment variable (make sure the URL ends with a / or the webhook will not be valid).
Confirm your changes by clicking on "Save", then restart your Capsule by toggling the radio button in the top right off and on again.
The next step is to set up a webhook for your bot. Do this by clicking the "Live Website" link at the top of the capsule's page. On the new tab that opens, add /setwebhook to the URL and press enter/return to visit the URL. If you see webhook setup ok then your bot is ready to chat!
The bot will be able to respond to messages after completing the above steps. When this is done, search for your bot on Telegram using the username you assigned it and start a chat with it. The bot has been programmed to respond to /start and echo any messages you send it.
If you’d like to deploy another application in a different language or framework, take a look at our other .
A guide to deploying a Django MySQL application from GitHub.
Deploy a Django MySQL application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Django MySQL application with Code Capsules, we've provided an example application, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination
A provides the server for hosting an application on Code Capsules.
Navigate to the Spaces tab and open the Space you'll be using.
Click the yellow "+" button in the bottom left of the screen, select "New Capsule", and follow the instructions below to create a Data Capsule:
Choose "Data Capsule".
Under "Data Type", select "MongoDB Database Cluster".
Click "Create Capsule".
Navigate to the "Space" containing your recently created Data Capsule and click the "New Capsule" button. Follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose a payment plan.
Choose the GitHub repository you forked.
Press "Next".
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
After the two capsules have been successfully built, the next step is to connect them. To do this, navigate to the "Config" tab of your Backend Capsule. Scroll down to the "Data Capsule" section and click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
You can now view the application after the two capsules have been connected. To see how it looks, click on the URL in the "Details" tab.
If you’d like to deploy another application in a different language or framework, take a look at our other .
A guide to deploying a WhatsApp Bot from GitHub.
Deploy a WhatsApp Bot and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account, a GitHub account, and a Twilio account.
To demonstrate how to deploy a WhatsApp Bot with Code Capsules, we've provided an example bot, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example bot repository by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
The Twilio Sandbox provides a development environment to access the WhatsApp API. Sign up for a to use a sandbox that allows you to test your bot in real-time. After you've logged into your Twilio account, navigate to the page to configure your WhatsApp sandbox settings.
Go to your capsule's "Details" tab and copy your bot's domain under the "URL" section.
Head back to your Twilio console and paste the domain in the "When a Message Comes In" field and append /bot to the end of it. Make sure the method is set to HTTP Post.
Scroll down to the bottom of the page and click "Save".
The bot will now be able to respond to your messages after sending the join code. Try it, and the bot should echo any message you send it.
If you’d like to deploy another application in a different language or framework, take a look at our other .
In this guide, we'll clone an existing Python repository and take a look at how to edit the project locally before pushing the changes to GitHub. The final step will be to deploy the application with the changes we made locally to Code Capsules.
We'll be using an example starter project provided by Code Capsules on their GitHub repository. Fork this repository by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination. Clone the forked repository to your machine by clicking the green "Code" button and copying the link that appears in the pop-up.
Open a terminal window on your machine and navigate to your preferred working directory. Run git clone <FORKED-REPO-URL>, replacing <FORKED-REPO-URL> with the link you copied from the pop-up above.
Before we can run the project locally, we need to create and activate a virtual environment where we'll install the project's dependencies. Depending on your machine, run the appropriate commands from the ones listed below:
MacOS
Windows
Next, install the project's dependencies by running pip install -r requirements.txt in the same terminal window where your environment is activated.
To start the application, run the command python3 -m flask run in the same terminal window, and you should see the application in your browser.
Open the app/routes.py file in your text editor and add the code snippet below to add another route to the app:
You need to stop and restart the server in order to see your changes.
Add and commit the changes you made by running the commands below in a terminal window while in the project's root folder:
Push the changes to your remote repository by running git push in the same terminal window.
To create a new Space, log in to your Code Capsules account, click the yellow + icon on the bottom left of the screen, and select "New Space".
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you’ve finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, a URL link will appear in the URL section in the "Details" tab. Click the link, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other .
A guide to deploying a Next.js and Mongo application from GitHub.
Deploy a Next.js and Mongo application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Next.js MongoDB application with Code Capsules, we've provided an example application, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
Log in to your Code Capsules account and navigate to the Spaces tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Navigate to the "Capsules" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Capsule.
To create a new Data Capsule for your Space, follow the instructions below:
Choose "MongoDB", your Team, and Space.
Choose your payment plan.
Click "Create Capsule".
Navigate to the Space containing your recently created Data Capsule and click the yellow + icon on the bottom left of the screen. Follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
After the two capsules have been successfully built, the next step is to connect them. To do this, navigate to the "Config" tab of your Backend Capsule. Scroll down to the "Data Capsule" section and click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
Once the build is complete, click the "URL" link in the "Config" tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other .
Publish a Caddy Docker site using its source code on GitHub.
Deploy a Laravel Docker API and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Bootstrap site with Code Capsules, we've provided an example application, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top right of your screen and selecting your GitHub account as the destination.
If you don't already have an account, navigate to the site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you've just signed up for an account, you'll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you're signing in again, click on the "Spaces" tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at .
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Choose "Docker Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, navigate to the "Config" tab and edit the "Capsule Parameters" section. Enter "8000" as the port number and click on "Save".
Restart your capsule by toggling the radio button in the top right off and on again.
Once the build is complete, click the "URL" link in the "Details" tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other .
In this tutorial, we’ll create a Redis Data Capsule to provide low-latency, in-memory data storage for your application hosted on Code Capsules.
Log in to your Code Capsules account and navigate to the Space your Redis Capsule will be contained in. Click the yellow + button in the bottom left of the screen, select "New Capsule", then select "Redis" from the dropdown.
Choose a payment option, and click "Create Capsule".
Now we need to connect our Data Capsule to a Backend Capsule using a database connection URL.
Navigate to your Backend Capsule and click on the "Configure" tab. Scroll down to the "Data capsules" section and click "View". Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
We'll use this environment variable in our app to connect to the Redis database.
If your Backend Capsule is a Python application, use the following code to connect to your Redis database:
If your Backend Capsule is a Node.js application, use the following code to connect to your Redis database:
If you’d like to deploy another application in a different language or framework, take a look at our other .
A walkthrough on how to deploy a Flask Docker application from GitHub.
Deploy a Flask Docker application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a Bootstrap site with Code Capsules, we've provided an example application, which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
A walkthrough on how to deploy a Flask MongoDB application from GitHub.
Deploy a Flask MongoDB application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a Flask MongoDB application with Code Capsules, we've provided an example application, which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
A guide to deploying a Go application from GitHub.
Deploy a Go application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a Go application with Code Capsules, we've provided an example application, which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
Enable auto deployments for an Express.js application from a specified branch on your GitHub repo.
Deploy an Express.js application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy an Express.js application with Code Capsules, we've provided an example application, which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
A walkthrough on how to deploy a Next.js and Express.js application from GitHub.
Deploy a Next.js and Express.js application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a Next.js and Express.js application with Code Capsules, we've provided an example application, which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.


import os
import redis
redis_url = os.getenv('REDIS_URL')
connection = redis.from_url(redis_url)
# Do something herelet redis = require('redis');
let redis_url = process.env.REDIS_URL
let connection = redis.createClient({
url: redis_url
});
connection.connect();
// Do something here
connection.quit();Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
Give the command the name /stats.
For the Request URL, head over to your Capsule "Details" tab on Code Capsules and copy the URL under the "Public URL" section.
Paste your URL into the Request URL box on Slack, and add /slack/command/stats to the end of it.
Fill in the description with 'Returns key stats from the app'.
Click "Save".
Confirm your changes by clicking on "Save".
C01SZ6Z3TCYAdd the channel ID to the environment variables with the name SLACK_CHANNEL_ID.
Confirm your changes by clicking on "Save".
Confirm your changes by clicking on "Save", then restart your Capsule by toggling the radio button in the top right off and on again.





Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".




Click "Create Capsule".

Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
Under the "Sandbox Participants" section, you will find the WhatsApp number for your sandbox and a code to join it that starts with join. Send this code to the displayed WhatsApp number to add your personal number as a sandbox participant.


Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".


Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".


Press "Next".
Click "Create Capsule".



If you don't already have an account, navigate to the Code Capsules site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you've just signed up for an account, you'll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you're signing in again, click on the "Spaces" tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at .
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Choose "Docker Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Press "Next".
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, navigate to the "Config" tab and edit the "Capsule parameters" section. Enter "5000" as the port number and click on "Save".
Restart your capsule by toggling the radio button in the top right off and on again.
Once the build is complete, click the "URL" link in the "Details" tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.
A provides the server for hosting an application on Code Capsules.
Navigate to the Spaces tab and open the Space you'll be using.
Click the yellow "+" button in the bottom left of the screen, select "New Capsule", and follow the instructions below to create a Database Capsule:
Choose "Data Capsule".
Under "Data Type", select "MongoDB Database Cluster".
Click "Create Capsule".
Navigate to the Space containing your recently created Data Capsule. Click the yellow "+" button in the bottom left of the screen, select "New Capsule", and follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose a payment plan.
Choose the GitHub repository you forked.
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
After the two capsules have been successfully built, the next step is to connect them. To do this, navigate to the "Config" tab of your Backend Capsule. Scroll down to the "Data Capsule" section and click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
You can now view the application after the two capsules have been connected. To see how it looks, click on the URL in the "Details" tab.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.
If you don't already have an account, navigate to the Code Capsules site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you've just signed up for an account, you'll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you're signing in again, click on the "Spaces" tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at our explanation.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Navigate to the "Space" containing your recently created Data Capsule and click the yellow + icon on the bottom left of the screen. Follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Restart your capsule by toggling the radio button in the top right off and on again.
Once the build is complete, click the "URL" link in the "Details" tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.
If you don't already have an account, navigate to the Code Capsules site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you've just signed up for an account, you'll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you're signing in again, click on the "Spaces" tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at .
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, a "Live Website" link will appear at the top of the tab. Click the link, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.
If you don't already have an account, navigate to the Code Capsules site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you've just signed up for an account, you'll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you're signing in again, click on the Spaces tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at .
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a team — you can use a default "personal" team if you're the only person working on this project, or a named team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Navigate to the "Space" containing your recently created Data Capsule and click the yellow + icon on the top right of the screen. Follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Once the build is complete, click the "URL" link in the "Details" tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.




A guide to deploying a Python Discord Bot from GitHub.
Deploy a Python Discord Bot and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Python Discord Bot with Code Capsules, we've provided an example bot, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example bot repository by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
You'll need a Discord user account before you can create a Discord bot. Head over to Discord and create an account if you don't already have one.
When you've signed in to Discord, follow the steps below:
Click on the "+" icon in the left toolbar to create a server to contain your channels.
Navigate to the .
Click on the "New Application" button.
Give the application a name and click "Create".
After actioning these steps, your bot will now have access to all the channels in the server you added it to.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
TOKEN Environment VariableOnce the build is complete, you have to add a TOKEN environment variable on the "Config" tab under the "Environment Variables" section. Assign it the value of the token you copied in step 6 of the section above.
Confirm your changes by clicking on "Save", then restart your Capsule by toggling the radio button in the top right off and on again.
The bot will be able to respond to messages after Code Capsules finishes building it. When this is done, you can send messages to the bot as a direct message, and the bot will echo them.
If you’d like to deploy another application in a different language or framework, take a look at our other .
A guide to deploying a MEAN Stack application from GitHub.
Deploy a MEAN stack application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a MEAN stack application with Code Capsules, we've provided an example application, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
If you don't already have an account, navigate to the site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you've just signed up for an account, you'll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you're signing in again, click on the Spaces tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at .
Log in to your Code Capsules account and navigate to the Spaces tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Navigate to the "Capsules" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Capsule.
To create a new Data Capsule for your Space, follow the instructions below:
Choose "MongoDB", your Team, and Space.
Choose your payment plan.
Click "Create Capsule".
Navigate to the "Space" containing your recently created Data Capsule and click the yellow + icon on the top right of the screen. Follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
After the two capsules have been successfully built, the next step is to connect them. To do this, navigate to the "Config" tab of your Backend Capsule. Scroll down to the "Data Capsule" section and click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
After restarting the Capsule, the application will now be ready to be viewed. Click the "URL" link in the "Details" tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other .
A guide to deploying a Node.js Discord Bot from GitHub.
Deploy a Node.js Discord Bot and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Node.js Discord Bot with Code Capsules, we've provided an example bot, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example bot repository by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
You'll need a Discord user account before you can create a Discord bot. Head over to Discord and create an account if you don't already have one.
When you've signed in to Discord, follow the steps below:
Click on the "+" icon in the left toolbar to create a server to contain your channels.
Navigate to the .
Click on the "New Application" button.
Give the application a name and click "Create".
After actioning these steps, your bot will now have access to all the channels in the server you added it to.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the top right of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
TOKEN Environment VariableOnce the build is complete, you have to add a TOKEN environment variable on the "Config" tab under the "Environment Variables" section. Assign it the value of the token you copied in step 6 of the section above.
Confirm your changes by clicking on "Save", then restart your Capsule by toggling the radio button in the top right off and on again.
The bot will be able to respond to messages after Code Capsules finishes building it. When this is done, you can send messages in the general channel of your Discord server, and the bot will echo them.
If you’d like to deploy another application in a different language or framework, take a look at our other .
Deploy a WordPress application and learn how to host a content management system on Code Capsules.
To follow this guide, you'll need a Code Capsules account. WordPress can be downloaded and deployed automatically, or you can connect your Capsule to WordPress hosted on a GitHub repository.
Before creating your WordPress capsule, you'll need a Team and a Space. You can follow these guides to learn how to create and .
If you already have a Team and Space set up, log in to your Code Capsules account. On the dashboard, click the yellow + on the bottom left of the screen, then click "New Capsule".
A provides the server for hosting an application on Code Capsules.
To create a WordPress Capsule, first choose "WordPress" as the Capsule type, as well as your Team, and Space.
Next choose your payment plan, or create a custom plan.
A WordPress Capsule requires a connection to a MySQL Database Capsule as well as a Persistent Storage Capsule. Either select a previously created instance of each from the dropdowns, or click the yellow + next to each and follow the prompts for creating each Capsule. Click "Create Capsule".
To automatically download and deploy a WordPress version on Code Capsules:
Select the "Default" deployment type from the dropdown
Choose your WordPress version
Click "Next"
To deploy WordPress from your version control repository:
Select the "Git Managed" deployment type
Select a repository
Select the branch to deploy from
Click "Next"
You can read more about connecting your account to a version control provider in .
Code Capsules will automatically build and deploy your WordPress application. You can view the build log by selecting the "Logs" tab to monitor the deployment progress.
Once the build is complete, click the URL link in the "Details" tab to access your WordPress site.
When you first visit your WordPress site, you'll see the installation screen:
Enter your site title.
Create an admin username.
Set a strong password.
Provide your email address.
After installation, you'll see the WordPress admin dashboard and can begin customizing your site.
If you’d like to deploy another application in a different language or framework, take a look at our other .
In this tutorial, we'll create a PostgreSQL Data Capsule to provide persistent storage for your applications hosted on Code Capsules.
Log in to your Code Capsules account and navigate to the Space your PostgreSQL Data Capsule will be contained in. Click the yellow + button and select the "PostgreSQL Data Capsule" option from the dropdown.
Choose your payment option, then click the "Create Capsule" button.
To use the Data Capsule with your Backend Capsule, you'll need to link the two. Navigate to the Backend Capsule and click "Config" to open the Capsule's configuration tab. Scroll down to the "Data capsules" section and you'll see your recently created Data Capsule.
Click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
We can use this database variable in code to read and write to our Data Capsule. Copy the value of the DATABASE_URL variable and append /your_db_name to it as a query parameter. Make sure to replace your_db_name with the actual name of your database. This tells the Data Capsule to read and write to the specified database. If a database named your_db_name doesn't exist, the Data Capsule will create it. This allows you to have multiple databases in one Data Capsule. Take note, if you copy the DATABASE_URL value from the Capsule, it will already include the name of the default database you used whilst creating the Data Capsule as part of the string.
If your Backend Capsule is a Python application, use the following code to connect to your PostgreSQL Data Capsule:
If your Backend Capsule is a Node.js application, use the following code to connect to your PostgreSQL Data Capsule:
If you’d like to deploy another application in a different language or framework, take a look at our other .
A guide on how to launch a Java application from GitHub.
Deploy a Java application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Java application with Code Capsules, we've provided an example application, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
If you don't already have an account, navigate to the site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you've just signed up for an account, you'll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you're signing in again, click on the "Spaces" tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at .
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Navigate to the "Space" containing your recently created Data Capsule and click the yellow + icon on the bottom left of the screen. Follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Restart your capsule by toggling the radio button in the top right off and on again.
Once the build is complete, click the "URL" link in the "Details" tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other .
In this tutorial, we'll create a MySQL Data Capsule to provide persistent storage for your applications hosted on Code Capsules.
Log in to your Code Capsules account and navigate to the Space your MySQL Data Capsule will be contained in. Click the yellow + button and select the "MySQL Data Capsule" option from the dropdown.
Choose your payment option, then click the "Create Capsule" button.
To use the Data Capsule with your Backend Capsule, you'll need to link the two. Navigate to the Backend Capsule and click "Config" to open the Capsule's configuration tab. Scroll down to the "Data capsules" section and you'll see your recently created Data Capsule.
Click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
We can use this database variable in code to read and write to our Data Capsule. Copy the value of the DATABASE_URL variable and append /your_db_name to it as a query parameter. Make sure to replace your_db_name with the actual name of your database. This tells the Data Capsule to read and write to the specified database. If a database named your_db_name doesn't exist, the Data Capsule will create it. This allows you to have multiple databases in one Data Capsule. Take note, if you copy the DATABASE_URL value from the Capsule, it will already include the name of the default database you used whilst creating the Data Capsule as part of the string.
If your Backend Capsule is a Python application, use the following code to connect to your MySQL Data Capsule:
If your Backend Capsule is a Node.js application, use the following code to connect to your MySQL Data Capsule:
If you’d like to deploy another application in a different language or framework, take a look at our other .
A walkthrough on how to deploy a Flask HTMx application from GitHub.
Deploy a Flask HTMx application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Flask HTMx application with Code Capsules, we've provided an example application, which you can find on the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
If you don't already have an account, navigate to the site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you've just signed up for an account, you'll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you're signing in again, click on the "Spaces" tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at .
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the top right of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Navigate to the "Capsules" tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Capsule.
To create a new Data Capsule for your Space, follow the instructions below:
Choose "Persistent Storage", your Team, and Space.
Choose your payment plan.
Click "Create Capsule".
Navigate to the Space containing your recently created Data Capsule and click the yellow + icon on the bottom left of the screen. Follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
After the two capsules have been successfully built, the next step is to connect them. To do this, navigate to the "Config" tab of your Backend Capsule. Scroll down to the "Data Capsule" section and click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
After restarting the capsule, the application will now be ready to be viewed. Click the "URL" link in the "Config" tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other .
A guide to deploying a MERN Stack application from GitHub.
A video for this guide can be found if you prefer watching to reading.
Deploy a MERN stack application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a MERN stack application with Code Capsules, we've provided an example application, which you can find on the .
A walkthrough on how to deploy a Flask MySQL application from GitHub.
Deploy a Flask MySQL application and learn how to host backend code on Code Capsules.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a account and a account.
To demonstrate how to deploy a Flask MySQL application with Code Capsules, we've provided an example application, which you can find on the .
Sign in to GitHub, and fork the example application by clicking "Fork" at the top-right of your screen and selecting your GitHub account as the destination.
python3 -m venv env
source env/bin/activatepy -m venv env
.\env\Scripts\activate@app.route('/greeting')
def greeting():
return "Hello there, thank you for visiting my new route"git add app/routes.py
git commit -m "Added new route"



import os
import psycopg2
# Get the DATABASE_URL from environment variables
data_capsule_url = os.getenv('DATABASE_URL')
# Connect to the PostgreSQL database
conn = psycopg2.connect(data_capsule_url)
# Create a cursor to interact with the database
cur = conn.cursor()
# Example query (optional)
cur.execute("SELECT version();")
print(cur.fetchone())
# Always close cursor and connection when done
cur.close()
conn.close()const { Client } = require('pg');
// Get the DATABASE_URL from environment variables
const client = new Client({
connectionString: process.env.DATABASE_URL
});
// Connect and interact with the database
client.connect()
.then(() => {
console.log("Connected!");
// Example query (optional)
return client.query('SELECT version();');
})
.then(res => {
console.log(res.rows[0]);
})
.catch(err => {
console.error("Connection error", err.stack);
})
.finally(() => {
client.end();
});import os
import mysql.connector
data_capsule_url = os.getenv('DATABASE_URL')
employees_database_url = data_capsule_url + "/employees"
cnx = mysql.connector.connect(user='yourusername', password='yourpassword',
host=employees_database_url,
database='employees')
### Do something with the cnx variable here
cnx.close()
var mysql = require('mysql');
var data_capsule_url = process.env.DATABASE_URL
var employees_database_url = data_capsule_url + "/employees"
var con = mysql.createConnection({
host: employees_database_url,
user: "yourusername",
password: "yourpassword"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
// Do something with the db here
});
Go to the "Bot" tab and click "Add Bot". Confirm your decision by clicking "Yes, do it!"
Click the "Copy" button under the "TOKEN" section to copy your bot's token.
Go to the "OAuth2/URL Generator" tab and select the "bot" option under the "Scopes" section.
Select all the text permission options under the "Bot Permissions" section.
Click the "Copy" button under the "Generated URL" section
Paste the URL you copied in the previous step in another browser tab and add the bot to the server you created in the first step. Click "Continue" to confirm your changes.
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".

Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".


Go to the "Bot" tab and click "Add Bot". Confirm your decision by clicking, "Yes, do it!"
Click the "Copy" button under the "TOKEN" section to copy your bot's token.
Go to the "OAuth2/URL Generator" tab and select the "bot" option under the "Scopes" section.
Select all the text permission options under the "Bot Permissions" section.
Click the "Copy" button under the "Generated URL" section
Paste the URL you copied in the previous step in another browser tab and add the bot to the server you created in the first step. Click "Continue" to confirm your changes.
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".











Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".

Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".


If you don't already have an account, navigate to the Code Capsules site and click the "Sign Up" button in the top right corner of the screen. Enter your details to create an account, or log in to an existing one.
If you've just signed up for an account, you'll be directed to a welcome page on your first login. Click on the "Go To Personal Team" button.
Alternatively, if you're signing in again, click on the "Spaces" tab.
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at .
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the top right of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Navigate to the "Capsules" tab. Once there, click the yellow + icon on the top right of the screen to add a new Capsule.
To create a new Data Capsule for your Space, follow the instructions below:
Choose "MongoDB", your Team, and Space.
Choose your payment plan.
Click "Create Capsule".
Navigate to the "Space" containing your recently created Data Capsule and click the yellow + icon on the top right of the screen. Follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Click the GitHub button and give access to the repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
After the two capsules have been successfully built, the next step is to connect them. To do this, navigate to the "Config" tab of your Backend Capsule. Scroll down to the "Data Capsule" section and click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
After restarting the capsule, the application will now be ready to be viewed. Click the URL link in the "Details" tab of the capsule tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.
A provides the server for hosting an application on Code Capsules.
Navigate to the Spaces tab and open the Space you'll be using.
Click the yellow "+" button in the bottom left of the screen, select "New Capsule", and follow the instructions below to create a Data Capsule:
Choose "Data Capsule".
Under "Data Type", select "MySQL Database Cluster".
Under "Product", select "Standard".
Click "Create Capsule".
Navigate to the "Space" containing your recently created Data Capsule and click the "New Capsule" button. Follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule".
Under "Product", select "Sandbox".
Choose the GitHub repository you forked.
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
After the two capsules have been successfully built, the next step is to connect them. To do this, navigate to the "Config" tab of your Backend Capsule. Scroll down to the "Data Capsule" section and click "View" to view the environment variables from the Data Capsule. Click the + next to the Connection string variable to create a DATABASE_URL environmental variable in your Backend Capsule, which gives access to services and features of your Data Capsule.
Once the binding is complete, you have to append +pymysql after mysql in the DATABASE_URL value under the "Capsule parameters" section on the "Configure" tab.
Confirm your changes by clicking on "Update Capsule" then restart your capsule by toggling the radio button in the top right off and on again.
After restarting the capsule, the application will now be ready to be viewed. Click the "Live Website" link at the top of the capsule tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other deployment guides.














You need persistent storage to develop your application that solves a real-world problem, but you don't want a full-blown database. In this tutorial, we'll show you how to create a persistent storage Data Capsule that you can use with your backend applications running on Code Capsules.
A Persistent Storage Capsule is like a virtual cloud hard drive. The key benefit is that you can attach multiple backend or docker capsules (workloads) to read/write to the same persistent storage capsule, allowing for horizontal and vertical scaling of your backend/docker capsules/workloads.
Log in to your Code Capsules account and navigate to the Space your Data Capsule will be contained in. Click the yellow + button on the bottom left of the screen, select "New Capsule", then select "Persistent Storage" option from the dropdown.
Choose your payment option, then click the "Create Capsule" button.
You need to bind the Data Capsule to a Backend Capsule hosted on Code Capsules before you can connect to it and use it.
Navigate to the Backend Capsule and click "Config" to open the Capsule's config tab. Scroll down to the "Bind Data Capsule" section, where your recently created Data Capsule will show.
Click "Bind" to bind your Data and Backend Capsules. During the bind process, Code Capsules creates a PERSISTENT_STORAGE_DIR environment variable to let your Backend Capsule know where your Data Capsule resides in order to access its features. Once the two Capsules have been bound, you can scroll to the top of the Configure tab to find the value of this variable.
The next step is to use this environment variable in code in order to read and write to our Data Capsule. Copy the value of the PERSISTENT_STORAGE_DIR variable and paste it in your code as the value of the db_directory variable. Alternatively, reference it directly in your code using os.getenv for Python or process.env for Node.js.
If your Backend Capsule is a Python application, use the following code to connect to your Data Capsule:
If your Backend Capsule is a Node.js application, use the following code to connect to your Data Capsule:
By default, you can't browse files and folders in your Persistent Storage Capsule without building your own file browser. To solve this, Code Capsules provides native WebDAV access.
To enable file browsing:
Navigate to your Persistent Storage Capsule
Go to the "Details" tab
Toggle "Public Access" to "Enabled"
This doesn't mean your files are indexed on the internet - it exposes them over WebDAV protocol with authentication credentials.
Open Finder
Click on "Go" in the menu bar and select "Connect to Server"
Enter the WebDAV server URL in the following format: https://server-address
Click "Connect"
Here you can see the files inside a Wordpress Capsule accessed in the Mac Finder locally.
Open File Explorer
Right-click on "This PC" in the sidebar
Click on "Add a network location"
Click "Next" in the wizard until prompted to enter the "Internet or network address"
Open your file manager (e.g., Nautilus, Dolphin, Thunar)
In your address bar, enter the WebDAV server URL in the following format:
davs://server-address for Nautilus and Thunar
webdavs://@server-address
This guide will show you how to deploy a basic file-sharing site on Code Capsules. You'll use a Flask application to upload files and a Caddy file server to serve and download the uploaded files.
We'll use three capsules: a Data Capsule to store the files, a Backend Capsule for the Flask upload server, and a Docker Capsule for the Caddy file server.
After following the guide, you'll be able to upload files in the Flask application, see a file listing, and get public links to your uploaded files in the Caddy application, as shown below.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a Code Capsules account and a account.
The code you need for this guide is in the following GitHub projects.
Sign in to GitHub, and fork both example applications by clicking "Fork" at the top right of your screen and selecting your GitHub account as the destination.
Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow + icon on the top right of the screen to add a new Space.
Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".
Example instructions to go with numbered annotations
Choose a Team — you can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others
This should remind you of the project, for example, "customer-api" or "notetaking-app"
Choose a country close to where most of your users will be
A provides the server for hosting an application on Code Capsules.
Navigate to the Capsules tab. Once there, click the yellow + icon on the bottom left of the screen to add a new Capsule.
To create a new Data Capsule for your Space, follow the instructions below:
Choose "Persistent Storage", your Team, and Space.
Choose your payment plan.
Click "Create Capsule".
Navigate to the Space containing your recently created Data Capsule and click the yellow + icon on the bottom left of the screen. Follow the instructions below to create a Backend Capsule:
Choose "Backend Capsule", your Team, and Space.
Choose your payment plan.
Select the flask-file-uploads repository you forked at the start of the tutorial.
Choose the GitHub repository you forked.
Click the "New capsule" button again.
Choose Docker Capsule
Select the caddy-file-server repository
Click "Next"
Enter Dockerfile for the Dockefile location
Code Capsules will automatically build your application when you've finished creating the Capsule. While the build is in progress, you can view the log by clicking "View Build Progress" next to the "Building Capsule" message.
Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.
Now navigate to each of the Backend Capsule and Docker Capsule and bind them to the Data Capsule. This gives them access to a shared file store so that the Flask application can upload files and the Caddy server can serve them to users.
Once the build is complete, click the "URL" link in the "Config" tab, and you should see your deployed application.
If you’d like to deploy another application in a different language or framework, take a look at our other .
Learn how to deploy a Go Telegram Bot from GitHub.
Deploy a Go Telegram Bot and learn how to host backend code on Code Capsules.
Before you can create a Telegram bot, you need a Telegram user account. Open Telegram and create an account if you don't already have one.
When you've signed in to Telegram, search for BotFather (a bot for managing all other Telegram bots) and start a new chat with it.
Follow the steps below to register a new bot with the BotFather:
Enter the username and password when prompted
The WebDAV server will now appear as a mounted drive in Finder
https://server-addressEnter the username and password when prompted
Complete the setup wizard
The WebDAV server will now appear as a mapped drive in File Explorer
Enter the username and password when prompted
The WebDAV server will now appear as a drive in your file manager




import os
db_directory = os.getenv('PERSISTENT_STORAGE_DIR')
### Do something with the db_directory variable here
file_to_write = os.path.join(db_directory, "test.txt")
file1 = open(file_to_write, "w")
file1.write("File writing test")
file1.close()
db_directory = process.env.PERSISTENT_STORAGE_DIR
const fs = require('fs')
const content = 'Some content!'
// Do something with the db_directory variable here
fs.writeFile(db_directory + '/test.txt', content, err => {
if (err) {
console.error(err)
return
}
//file written successfully
})
Press "Next".
Leave "Run Command" blank.
Click "Create Capsule".
Press "Create Capsule"

Type /start and press send.
Type /newbot and press send.
Choose a name for your bot.
Choose a username for your bot that ends in bot.
The BotFather will respond with a message containing an access token for your newly created bot. This access token allows our application to:
Access the Telegram API.
Tell our bot what to do when receiving different messages from users.
To confirm that your bot has been created successfully, search for the bot's username. You should be able to see it and start a conversation with it. However, it won't respond because we haven't written the bot's logic yet.
Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you need a Code Capsules account and a GitHub account.
To demonstrate how to deploy a Go Telegram Bot with Code Capsules, we've provided an example bot in the Code Capsules GitHub repository.
Sign in to GitHub, and fork the example bot repository by clicking Fork at the top right of your screen and selecting your GitHub account as the destination.
Log in to your Code Capsules account and navigate to the Spaces tab. Then, click the yellow + icon at the bottom left of the screen to add a new Space.
Follow the prompts to choose your region and give your Space a name, then click Create Space.
Example instructions to go with numbered annotations:
Choose a Team. You can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others.
The name should remind you of the project, for example, customer-api or notetaking-app.
Choose a country close to where most of your users reside.
A Capsule provides the server for hosting an application on Code Capsules.
To create a new Capsule for your Space, follow the instructions below:
Click the add Capsule + button in your Space.
Choose Backend for the Capsule type, and select your Team and Space, if not already populated.
Choose your payment plan and click Next.
Click the Configure Git for Code Capsules button and grant access to your forked go-telegram-echobot repository.
Press Next.
Leave the Run Command blank.
Click Create Capsule.
Code Capsules automatically builds your application when you've finished creating the Capsule.
Once your application is live, you can view the build logs by selecting the Deploy tab and clicking the View build log link in the Builds section.
Once the build is complete, we need to add the BOT_TOKEN and URL environment variables on the Config tab, under the Environment Variables section.
First, name the BOT_TOKEN variable and enter your Telegram access token (which you received from the BotFather when you registered the bot) as its Value.
Name the URL variable and set your bot's domain as its Value.
Get the domain by clicking the Capsule's Details tab and copying the URL in the Public URL section.
Paste the URL in the Value field.
Make sure the URL ends with a / or the webhook will not be valid.
Confirm your changes by clicking on Save, then restart your Capsule by toggling the radio button in the top-right corner off and on again.
The next step is to set up a webhook for your bot:
Click the Public URL link in your Capsule's Details tab.
In the new tab that opens, add /setwebhook to the URL and press enter/return to visit the URL.
If you see webhook setup ok, then your bot is ready to chat!
The bot can now respond to messages! Search for your bot on Telegram using the username you assigned it, and start a chat with it. The bot is programmed to respond to /start and echo any messages you send it.
If you'd like to deploy another application in a different language or framework, take a look at our other deployment guides.






















