Last updated
Last updated
Using PostgreSQL with Dappetizer is really straightforward and can be set up in a few minutes.
You will need the following for this guide:
For the purposes of this guide, we will assume you already have an existing Dappetizer project. Check out our guide to learn how to set up one.
(if you are planning on running PostgreSQL in Docker) or a full instance
If you don't have a local PostgreSQL instance running, you can start one using :
The PostgreSQL client package is required when connecting to the database. To install it, run
Notice that the username and password here are stored in plaintext. That is fine for local development, but when running Dappetizer on a server, you should use a local configuration file stored on the server (the file should not be in source control) or make use of environment variables. For example, this is how you can use environment variables:
To select what blocks have been saved by the indexer, we will run a short SELECT query:
If the indexer has successfully connected to the database and started indexing, you should be able to see the stored blocks so far.
The should be changed with specific settings for connecting to PostgreSQL. To connect to your local instance, you can replace the existing database
section with:
You can use any tool (like ) to connect to the database. In this guide we will simply use Docker to run :