A lightweight Starknet block explorer designed for local development with devnet environments.
- Real-time indexing of blocks, transactions, events, and L1↔L2 messages
- Fast search by block number, transaction hash, or contract address
- WebSocket updates for live data streaming
- ABI decoding for event parameters and function calls
- Dark mode UI with responsive design
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Run Cosmos with a local Starknet devnet for testing:
cp .env.example .env
docker compose -f docker-compose.yml -f docker-compose.devnet.yml up
This starts:
- Starknet devnet at http://localhost:5500
- PostgreSQL database at localhost:55432
- Backend API at http://localhost:4600
- Frontend UI at http://localhost:5600
If you already have a Starknet RPC endpoint or want to use a network:
cp .env.example .env
# Edit .env and set your STARKNET_RPC_URL
# Example: STARKNET_RPC_URL=https://starknet-sepolia.infura.io/v3/YOUR_KEY
docker compose up
This starts only the necessary services (PostgreSQL, Backend, Frontend).
Open http://localhost:5600 in your browser to use the explorer.
- Node.js 20+
- pnpm 9+
- PostgreSQL 15+
- Starknet devnet or RPC endpoint
- Install dependencies:
corepack enable
pnpm install
- Configure environment:
cp .env.example .env
# Edit .env with your database and RPC settings
- Start PostgreSQL (if not using Docker):
docker run --name cosmos-postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=cosmos \
-p 55432:5432 \
-d postgres:15
- Run database migrations:
pnpm --filter @cosmos/backend prisma:migrate dev
- Start the development servers:
pnpm dev
The backend will be available at http://localhost:4600 and the frontend at http://localhost:5600.
Create sample transactions and blocks on devnet:
# Mint ETH to random accounts (creates transactions)
pnpm devnet:mint
# Force create empty blocks
pnpm devnet:blocks
cosmos/
├── apps/
│ ├── backend/ # Fastify API + Prisma indexer
│ └── frontend/ # React + Vite UI
└── packages/ # Shared utilities and configs
Key configuration options in .env
:
STARKNET_RPC_URL
- Starknet RPC endpoint- Local devnet:
http://localhost:5500
(if using docker-compose.devnet.yml) - Sepolia testnet:
https://starknet-sepolia.infura.io/v3/YOUR_KEY
- Mainnet:
https://starknet-mainnet.infura.io/v3/YOUR_KEY
- Custom RPC: Any compatible Starknet JSON-RPC endpoint
- Local devnet:
DATABASE_URL
- PostgreSQL connection stringBACKEND_PORT
- Backend server port (default: 4600)FRONTEND_PORT
- Frontend dev server port (default: 5600)INDEXER_POLL_INTERVAL_MS
- Polling interval in milliseconds (default: 2000)
pnpm dev # Start backend + frontend
pnpm build # Build for production
pnpm lint # Run ESLint
pnpm test # Run tests
pnpm devnet:mint # Generate test transactions
pnpm devnet:blocks # Create empty blocks
Build static assets:
pnpm build
Run the built backend:
export DATABASE_URL=postgres://postgres:postgres@localhost:55432/cosmos
node apps/backend/dist/index.js
Backend won't start:
- Verify PostgreSQL is running and accessible
- Check
DATABASE_URL
is correct - Ensure Starknet RPC endpoint is reachable
- Check logs:
docker compose logs backend
No data appearing:
- Confirm the indexer is connected to the correct RPC URL
- Check backend logs for errors
- Generate test data with
pnpm devnet:mint
Prisma errors:
- Regenerate the client:
pnpm --filter @cosmos/backend prisma:generate
- Verify migrations are applied:
pnpm --filter @cosmos/backend prisma:migrate dev
Docker issues:
- Check all containers are healthy:
docker compose ps
- View logs:
docker compose logs -f
- Clean restart:
docker compose down -v && docker compose up
MIT