Development
Codebase overview
Below you can find a breakdown of the Blobscan's codebase.
Architecture
Blobscan.com is comprised of the following major components:
- Web App: A Next.js application hosted on Vercel that spins up a tRPC API that communicates with the database via Prisma. It also uses Tailwind CSS for styling.
- REST API: An express app that runs the tRPC API with OpenAPI support. It exposes some of the tRPC API endpoints as REST endpoints for the public and external services such as the indexer.
- Indexer: A Rust service that listens to the Ethereum blockchain looking for blocks and transactions containing blobs and forwards them to the REST API to be indexed.
Repository structure
Blobscan is a monorepo managed with Turborepo which contains two main folders: apps
and packages
.
The indexer is not part of the monorepo and it's located in a separate repository.
Apps
Blobscan is composed of the following apps:
App | Description |
---|---|
@blobscan/docs | Nextjs app that contains the documentation. |
@blobscan/web | Nextjs app that contains the web app. |
@blobscan/rest-api-server | Express app that contains the REST API. |
CLI
Blobscan has the following command line interfaces:
CLI | Description |
---|---|
@blobscan/blob-propagation-jobs-cli | CLI to run the blob propagation jobs. |
@blobscan/stats-aggregation-cli | CLI to run the stats aggregation jobs. |
Packages
Here you can find all the shared packages used by the apps:
Package | Description |
---|---|
@blobscan/api | tRPC routers and procedures used by the web app and the REST API |
@blobscan/@blobscan/blob-propagator | Mechanism for propagating blob data across various storage systems through bullmq sandboxed workers. |
@blobscan/blob-storage-manager | Orchestrates the storage/retrieval of blobs in/from different storage providers. Currently it supports Google Cloud Storage, Swarm, and PostgreSQL database. |
@blobscan/dayjs | Extended Day.js with plugins. |
@blobscan/db | Prisma schema and a Prisma client with extensions containing custom methods queries. |
@blobscan/logger | Shared logger utilities. |
@blobscan/open-telemetry | Otel configuration and sdk setup. |
@blobscan/test | Shared test utilities and fixtures. |
@blobscan/zod | Shared Zod schemas and utilities. |
@blobscan/eth-format | Provides utility functions for handling Ethereum value conversions and formatting. |
@blobscan/rollups | A utility that provides a comprehensive list of all rollups and their associated addresses supported by Blobscan, along with functions to retrieve them easily. |
Tooling
Blobscan uses the following tools:
Tool | Description |
---|---|
@blobscan/eslint | ESLint configuration shared across all packages. |
@blobscan/github | GitHub actions shared. |
@blobscan/svgo-config | Svgo configuration. |
@blobscan/tailwind-config | Tailwind configuration shared across all packages. |
@blobscan/typescript | Typescript configuration shared across all packages. |