This is a simple Express.js application that demonstrates how to build a CRUD web app backed by PostgreSQL with StatsD metrics, and deploy it to Clever Cloud.
This application is a simple value list where you can add or delete entries. It uses:
- PostgreSQL for data persistence
- StatsD for tracking metrics (creations, deletions, and a gauge for total values)
GET /- Renders the main page with all valuesPOST /values- Create a new valueDELETE /values/:id- Delete a value by ID
- Express.js 5 - Web framework for Node.js
- pg - PostgreSQL client for Node.js
- Pug 3 - Template engine
- Bootstrap 5 - Frontend CSS framework
- hot-shots - StatsD client
- Node.js 24+
- PostgreSQL
- Node.js 24+
- npm
npm install
npm startThe application will be accessible at http://localhost:8080.
The application requires a running PostgreSQL instance. Set the
POSTGRESQL_ADDON_URIenvironment variable to your PostgreSQL connection string.
You have two options to deploy your application on Clever Cloud: using the Web Console or using the Clever Tools CLI.
If you don't already have an account, go to the Clever Cloud console and follow the registration instructions.
- Log in to the Clever Cloud console
- Click on "Create" and select "An application"
- Choose "Node.js" as the runtime environment
- Configure your application settings (name, region, etc.)
- In your application's dashboard, go to "Service dependencies"
- Click "Link add-ons" and select "PostgreSQL"
- Choose the plan that fits your needs
- Link the add-on to your application
The POSTGRESQL_ADDON_URI environment variable will be automatically set.
You can deploy your application using Git:
# Add Clever Cloud as a remote repository
git remote add clever git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/app_<your-app-id>.git
# Push your code to deploy
git push clever masterInstall the Clever Tools CLI following the official documentation:
# Using npm
npm install -g clever-tools
# Or using Homebrew (macOS)
brew install clever-toolsclever login# Initialize the current directory as a Clever Cloud application
clever create --type node <YOUR_APP_NAME>
# Add a PostgreSQL add-on
clever addon create postgresql-addon <YOUR_ADDON_NAME> --link <YOUR_APP_NAME>clever deployOnce deployed, you can access your application at the URL provided by Clever Cloud.
clever openOnce deployed, you can monitor your application through:
- Web Console: The Clever Cloud console provides logs, metrics, and other tools to help you manage your application.
- CLI: Use
clever logsto view application logs andclever statusto check the status of your application.