Path: blob/master/webhooks/webhook_preview/README.md
1080 views
License Plate Webhook Dashboard
A webhook dashboard for license plate recognition data from Stream.
🧰 Technologies Used
Next.js – Full-stack React framework
Prisma – ORM for database access
PostgreSQL – Relational database for persistent data
Cloudflare R2 – Object storage for image uploads
pnpm – Fast package manager
🛠️ Project Setup Guide
Follow these steps to set up and run the project locally.
1. Clone the Repository
2. Install Dependencies
Use pnpm to install the project dependencies:
If you don't have pnpm installed yet:
3. Configure Environment Variables
Create a .env file in the root of the project and add the required environment variables.
You can use the .env.example file as a template. Just copy it and fill in the appropriate values:
Example .env content:
Used by Prisma to connect to your PostgreSQL database.
This variable defines the maximum number of webhook requests stored in memory. Helps control resource usage.
These are required to upload and retrieve image files from Cloudflare R2 object storage.
4. Start PostgreSQL with Docker
If you don't have a local PostgreSQL server running, you can start one using Docker:
Update your .env file to match the database credentials:
5. Set Up the Database
Run the following command to apply the initial database migration using Prisma:
This will create the necessary tables in your database and generate the Prisma client to use in your application.
6. Start the Development Server
Finally, start the development server with:
The application should now be running at:
7. Running with Docker
You can also run the entire application using Docker Compose, which will set up both the application and the PostgreSQL database in containers.
Prerequisites
Docker and Docker Compose installed on your system
Make sure the environment variables in the docker-compose.yml file are properly configured for your environment, including the Cloudflare R2 credentials and the webhook request limit (as described in step 3).
Steps to Run with Docker
Build and start the containers:
In your terminal, navigate to the root of the project and run the command below.
This command builds the Docker images and starts the containers in detached mode.
Check the logs to ensure everything is running correctly:
Access the application:
The application will be available at:
Important Notes for Docker Deployment
The
docker-compose.ymlfile is configured to pass environment variables to both the build process and runtime environment.The PostgreSQL data is persisted in a Docker volume named
postgres_data.
Stopping the Docker Containers
To stop the running containers:
To stop the containers and remove the volumes (this will delete all database data):
Usage
Visit the homepage to generate a new webhook URL
Use the generated URL to config webhook send in Stream
View the data in on the dashboard
Access your data anytime by visiting
/{uuid}, where{uuid}is your webhook UUID
🔧 Using Prisma Studio in Development
You can use Prisma Studio to visually inspect and manage your database. To start it, run:
Prisma Studio provides a web interface for easy database management, useful for debugging and quick edits during development.