Neon
Inngest allows you to trigger functions from your Neon Postgres database updates.
Benefits of triggering functions from database events
By decoupling function triggers from your application logic, events are initiated by database updates rather than relying on instrumentation in your code to send them. This ensures you won’t miss an event when data is manipulated within your application. This decoupling creates a clean abstraction layer between database operations and code that runs asynchronously.
Additionally, as database events are pushed into the Inngest system to enqueue new functions, this can eliminate the need for architecture patterns like the transactional outbox pattern.
Leveraging Inngest features with database triggers
Beyond the architectural benefit, some specific Inngest features go perfectly with database triggers:
- Fan-out - Use a single database event to trigger multiple functions to run in parallel. For example, a pg/users.inserted might trigger a welcome email function and a function that starts a trial in Stripe.
- Batching - Database events can be batched to process many updates more efficiently. For example, many small updates can be aggregated or efficiently perform bulk operations using third party APIs that support it, like Shopify.
- Flow control - Combine database triggers with flow control functionality like throttling, debouncing, or rate limiting for better resource management and efficiency. For example, use throttling for working with third party API rate limits or use debounce for operations that may happen frequently, helping to avoid redundant work.
How it works
Once you connect Neon to Inngest, any changes to data in your database will automatically send new events to your Inngest account.
Connecting Neon to Inngest
Connecting Neon will require some configuration changes on your Postgres database and Neon project.
There are three steps to install the Neon integration in Inngest:
- Authorization: by adding your postgres credentials, Inngest can access your database to proceed with the installation
- Enable logical replication: change the
wal_level
configuration tological
- Connect the Neon database to Inngest
You will find Neon in the integrations page inside your Inngest dashboard. Click "Connect" to begin the setup process:
1. Authorizing Inngest
Inngest doesn’t store your credentials. Make sure you don’t refresh the page when completing the steps, otherwise your credentials will be lost. If that’s the case, you will be prompt to authorize Inngest again.
Insert your postgres credentials and hit the “Verify” button to start the validation process:
2. Enable logical replication
You will need to make sure your Neon project has enabled logical replication.
Enable logical replication either automatically using the Neon dashboard:
Or follow the steps in the Neon guide to locate and edit your postgresql.conf file. Once that’s complete, go back to Inngest to “Verify logical replication is enabled”:
3. Connecting
There are two ways to connect to the Neon Database:
- Automatically
- Manually (coming soon)
Ingest will setup and connect to your Neon Database automatically. It will create a Postgres role for replication, grant schema access to the role, create a replication slot and create a publication.
Local development (coming soon)
For information about our plans check our public roadmap.