As developers, we often build projects on the side, whether for fun or to learn something new. These projects also serve as proof of our skills.
You should have proof of work. Beyond your code, users should be able to use your application, and for that, it should not just be in localhost:3000
, but accessible through a link. To achieve this, you need to deploy your application and map it to a custom domain for better readability and easy sharing.
In this article, you will get introduced to DigitalOcean App Platform, and see how easy it is to go from deploying an application to mapping it to a custom domain in just a few clicks.
A DigitalOcean account to access the App Platform.
Custom domain available on NameCheap or similar platform.
App Platform is a fully managed platform-as-a-service (PaaS) that helps developers build, deploy, and scale applications with ease. It abstracts away much of the infrastructure management, allowing you to focus on code and deployment.
It can automatically analyze and build code from git providers like GitHub and GitLab, and publish your applications to the cloud. It can also publish using container images that you have already uploaded to DigitalOcean Container Registry or Docker Hub.
With features like DDoS mitigation, auto OS patching, vertical scaling, HTTP support, global CDN and domain support, the App Platform makes it simple to publish and manage your apps.
Once the application is ready, you can deploy it from monorepos
,container images, or using GitHub Actions.
A monorepo is a version-controlled code repository that holds many projects. While these projects may be related, they are often logically independent and run by different teams.
Let us see how we can deploy applications using the App Platform with GitHub. Let’s say you have a private GitHub repository with an index.html
file that contains this simple hello world code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World</title>
</head>
<body>
<h1>Hello, World!</h1>
<script>
console.log("Hello, World!");
</script>
</body>
</html>
index.html
file in the root directory, we will go ahead with the default /
. If your code follows a monorepo structure, make sure you choose the particular directory where the code is located.Select auto-deploy
, this will automatically re-deploy whenever you push a new change:
Next
to view the Review
page, where you get to see other app related information like billing, location, etc. Then finally click on Create resource
to get the app deployed.Overview
page.If you follow all the steps above, this is how your application will look like: https://sea-lion-app-l8cvv.ondigitalocean.app/.
Now that your application is successfully deployed and has an ondigitalocean.app
domain, in this step, you will see how you can map it to a custom domain.
There are two ways by which you can add a custom domain to your app:
Using the control panel
For this article, you will see how you can configure custom domain using the control panel.
Login toDigitalOcean Cloud and select the app you want to add the domain to, and then click on the Settings
tab.
Then, click the Edit
link to the right of Domains
, andthen click the Add Domain
button.
You can either add the custom domain using DigitalOcean’s name servers or using a CNAME provider.
To use DigitalOcean’s name servers, copy and paste them (ns1.digitalocean.com
, ns2.digitalocean.com
, ns3.digitalocean.com
) into your domain registrar’s name server records. Check our tutorial on Point to DigitalOcean Name Servers From Common Domain Registrars for guidance on delegating your domain to DigitalOcean’s name servers from popular registrars.
ondigitalocean.app
alias and paste it into the CNAME record on your DNS provider to point your custom domain to your App Platform app. Once done, click the Add Domain button.For more advanced settings related to the domain, refer to our documentation on How to Manage Domains in App Platform.
You can follow the above steps to add custom domains purchased on any platform. For this example, let us see how you would configure the settings for a domain bought on Namecheap.
Log in to your Namecheap account. Click on Domain List, select the domain you want to add, and then click Manage.
Then move to the Advanced DNS tab and click Add new record.
That’s all! Now, you have your application mapped to your custom domain.
In this article, you learned how to deploy your applications and manage custom domains using DigitalOcean.
Custom domains can help your website rank higher in search engines because they are unique and relevant to your brand. It also makes it easier for people to remember the URL and access your application.
Here are some best practices to follow for a custom domain:
Ensure SSL/TLS security, as it encrypts data and improves SEO by providing a secure connection.
Monitor domain health regularly to detect issues and maintain optimal performance for users.
Create backups to protect against data loss and allow for a quick recovery if your domain or site experiences problems.
If you decide to discontinue your app for some reason, make sure to remove the custom domain before deleting the app. To remove it, go to the control panel, click on your app, and then click on Settings. Next, click the Edit link to the right of Domains and the triple-dot (…) menu item, and finally, click on Remove Domain to remove the domain.
Here’s a list of resources that can come in handy:
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!