Demonstration of integrating Usagey for usage-based pricing in an Express application
API Key Not Configured
Please set your Usagey API key in the .env
file
to enable full functionality of this example. Alternatively, set USE_MOCK_DATA=true
.
Send usage events to Usagey to track how your customers are using your application.
View DemoView your usage data with charts and visualizations to understand consumption patterns.
View DemoImplement flexible pricing tiers and see how they affect billing based on usage.
View DemoThis example demonstrates how to integrate the Usagey SDK into an Express application for tracking usage and implementing usage-based pricing.
.env.example
to .env
and add your Usagey API keynpm install
to install dependenciesnpm start
to start the server (or npm run dev
for development with hot reload)http://localhost:3000
in your browser
Check out the source code to see how each feature is implemented. The main functionality is in the
lib/usagey-client.js
file and the Express route handlers.
For more information, visit the Usagey NPM package or read the official documentation.
Track a usage event
Get usage statistics
Get recent usage events
Calculate cost based on pricing model and usage