A simple, production-ready Node.js web application that demonstrates how to deploy to DigitalOcean App Platform. Perfect for getting started or as a foundation for building REST APIs.
- Express.js Web Server: Lightweight and fast Node.js framework
- RESTful API Endpoints: Multiple example endpoints demonstrating different patterns
- Health Checks: Built-in health monitoring endpoint
- Graceful Shutdown: Proper signal handling for zero-downtime deployments
- Error Handling: Comprehensive error handling middleware
- Production Ready: Security best practices and environment-based configuration
- Runtime: Node.js 18.x or higher
- Framework: Express.js 4.18.x
- Deployment: DigitalOcean App Platform
- Dependencies: Minimal (only Express.js)
This Hello World application provides several useful endpoints:
GET /- Welcome message with timestamp and environment infoGET /health- Health check endpoint for monitoring (returns uptime and status)GET /api/info- API documentation and available endpointsPOST /api/echo- Echo endpoint that returns your request body
- DigitalOcean account (Sign up here)
- Basic understanding of Node.js (optional, for local development)
- Compute: Basic XXS (512MB RAM, 1 vCPU) - $5/month
- Bandwidth: 100GB included
- Total: ~$5/month for a production-ready application
Cost can be reduced further by using App Platform's free tier (if available) or by scaling down when not in use.
- Click the "Deploy to DigitalOcean" button above
- Authorize DigitalOcean to access the GitHub repository (read-only)
- Configure deployment settings:
- App Name: Choose a unique name for your app
- Region: Select the closest region to your users
- Branch: Keep as
main(or change if deploying from a different branch)
- Review environment variables (defaults are set for production)
- Click "Deploy"
- Wait 2-5 minutes for the build and deployment to complete
Once deployed, your application will be available at:
https://[your-app-name].ondigitalocean.app
Test Your Deployment:
# Test the welcome endpoint
curl https://[your-app-name].ondigitalocean.app/
# Check health status
curl https://[your-app-name].ondigitalocean.app/health
# Get API information
curl https://[your-app-name].ondigitalocean.app/api/info
# Test echo endpoint
curl -X POST https://[your-app-name].ondigitalocean.app/api/echo \
-H "Content-Type: application/json" \
-d '{"message": "Hello from DigitalOcean!"}'Want to test or modify the application locally? Follow these steps:
- Node.js 18.x or higher installed
- npm (comes with Node.js)
# Clone the repository
git clone https://github.com/bikram20/AppPlatform-Templates.git
cd AppPlatform-Templates/templates/hello-world-nodejs
# Install dependencies