TypeScript and Express API for the Gravity Bridge web client.
The backend serves bridge data, chain metadata, transaction-related data, and a health endpoint, while scheduled jobs keep cached data fresh in environments where those jobs are enabled.
This repository is prepared to be published as a standalone open-source backend:
- runtime configuration is environment-driven
- local development uses a disposable PostgreSQL container
- scheduled jobs are disabled by default in local setup
- the contributor verify path runs lint, tests, and a production build
- Node.js
20(.nvmrcis included) - Yarn
1.x - Docker with Compose support
cp .env.example .env
yarn install
yarn dev:up
yarn start:devThe API listens on http://localhost:6060 by default.
Health check:
GET /healthz
The default local CORS configuration allows the frontend at:
http://localhost:8080http://127.0.0.1:8080
If you change the frontend port or host, update CORS_ALLOWED_ORIGINS in
.env.
Copy .env.example and adjust values as needed.
The most important settings are:
| Variable | Purpose |
|---|---|
PORT |
HTTP port for the API |
NODE_ENV |
Node environment |
DEPLOYMENT_STAGE |
Stage label used by the app |
DATABASE_URL_LOCAL |
Local PostgreSQL connection string |
DATABASE_URL_TEST |
Test database connection string |
DATABASE_URL |
Primary runtime database connection string |
ENABLE_SCHEDULED_JOBS |
Enables cron/import jobs |
CORS_ALLOWED_ORIGINS |
Comma-separated allowed frontend origins |
COINMARKETCAP_API_KEY |
Optional live market data integration |
GETH_FALLBACK_NODE_URL |
Ethereum RPC fallback |
GETH_NODE_FOR_VALI_MONITORING_URL |
Ethereum RPC for monitoring jobs |
INFURA_API_KEY |
Optional provider integration |
ALCHEMY_API_KEY |
Optional provider integration |
ETHERSCAN_API_KEY |
Optional provider integration |
ALTHEA_API_URL |
External Gravity data source |
GRAVITY_NODE_* |
Gravity node RPC / REST / gRPC endpoints |
Local development works without external API keys. Optional live checks stay out
of the default test suite unless you explicitly run yarn test:external.
| Command | What it does |
|---|---|
yarn start:dev |
Starts the API with nodemon |
yarn dev:up |
Starts the local PostgreSQL container |
yarn dev:down |
Stops the local PostgreSQL container |
yarn lint |
Runs ESLint |
yarn test |
Runs unit, integration, and smoke tests |
yarn test:external |
Runs opt-in live dependency checks |
yarn build |
Compiles TypeScript to build/ |
yarn verify |
Starts local dependencies, runs lint, tests, and build |
Run:
yarn verifyThis is the default contributor verification command for the backend.
For more detail on the test buckets and local troubleshooting, see TESTING.md.
src/server: Express server bootstrap and routingsrc/controllers: request handlers and API modelssrc/data: datasources and repositoriessrc/jobs: scheduled import and cache-refresh jobssrc/configs: environment-driven runtime configurationsrc/models: shared API and chain data modelstest/: unit, database integration, smoke, and opt-in external tests
./scripts/dev-up.shwaits for PostgreSQL readiness before returning./scripts/verify.shautomatically starts and stops the local database- scheduled jobs are skipped unless
ENABLE_SCHEDULED_JOBS=true
- do not commit
.envfiles or production credentials - keep newly added infrastructure endpoints configurable through env vars
- if any credentials ever existed in private history before publication, rotate them before pushing a public repository