Photon
Solana indexer for general compression
Installation
To install the photon indexer run:
Running Photon
To run photon run:
# Against localnet
# Against devnet
# Using your local Postgres database instead of the default in in-memory SQLite db
# Specifying a start slot. Defaults to 0 for localnet and current for devnet/mainnet
# To see more configuration options
Database Management
We support both Postgres and SQLite as database backends. Photon uses a auto-configured SQLite in-memory database by default. To specify another database backend run migrations and specify the database url when running Photon.
# Or your SQLlite database url
Local Development
Running Tests
To run tests, install and run Postgres and SQLlite locally. For MacOS users, we recommend using Homebrew to run local Postgres: https://wiki.postgresql.org/wiki/Homebrew.
Then export environment variables to configure your RPC and your test Postgres url. For SQLlite testing, we always use an in-memory SQLlite database, so there is no need to configure a test url.
Additionally, for tests we use swagger-cli
to validate our OpenAPI schemas. So please install it:
Afterwards finishing setup simply run:
Note that for both Postgres and SQLlite all migrations will run automatically during tests. So no prior configuration is needed.
Database Model Autogeneration
To generate database models first install sea-orm-cli:
Then run:
Documentation Generation
In order to update the OpenAPI schemas for the API please first install the swagger-cli
through:
Then run: