Note
The project is under active development.
A native Ethereum protocol for following and tagging Ethereum accounts.
- Documentation: docs.ethfollow.xyz/api
- Bun runtime (latest version)
- Node.js (LTS which is currently 20)
git clone https://github.com/ethereumfollowprotocol/indexer.git && cd indexerNote
If vscode extensions behave weirdly or you stop getting type hints, run CMD+P and type > Developer: Restart Extension Host to restart the extension host.
# upgrade bun to make sure you have the latest version then install dependencies
bun upgrade && bun installcp .env.example .env- PostgreSQL
- dbmate (for migrations)
Migration files are located in ./db/migrations. dbmate commands:
bunx dbmate --help # print usage help
bunx dbmate new # generate a new migration file
bunx dbmate up # create the database (if it does not already exist) and run any pending migrations
bunx dbmate create # create the database
bunx dbmate drop # drop the database
bunx dbmate migrate # run any pending migrations
bunx dbmate rollback # roll back the most recent migration
bunx dbmate down # alias for rollback
bunx dbmate status # show the status of all migrations (supports --exit-code and --quiet)
bunx dbmate dump # write the database schema.sql file
bunx dbmate wait # wait for the database server to become availableAssuming the efp-database container from compose.yml is running, run the following command to create the database and generate TypeScript types for the database schema:
bun database:upThe command creates the database (if it doesn't exist) and runs migrations (see ./db/migrations).
While still in development (i.e., no production database yet), any database schema we make go directly into this single file: ./db/migrations/20231205052550_init.sql. See next section for updating the database schema.
You've updated the sql schema in ./db/migrations/20231205052550_init.sql and want to reflect that in the database container and update the TypeScript types. Run:
Note
Make sure you're not connected to the database through any GUI or client while running this command. Otherwise you will get Error: pq: database "efp" is being accessed by other users.
bun database:resetThis:
- runs
dbmate dropwhich nukes theefpdatabase, then - runs
dbmate upwhich creates the database and runs migrations (aka the single migration file we have in./db/migrations), then - runs
kysely-codegen --dialect='postgres' --type-only-imports --log-level='error'which generates TypeScript types for the database schema and writes them to./src/database/.
TODO: Continue documentation
Follow @ethfollowpr on 𝕏 for updates and join the Discord to get involved.