BRIDGE is a high-performance, self-hosted API gateway built on Node.js and Fastify. It sits between your clients and microservices to handle cross-cutting concerns like authentication, rate limiting, caching, and logging.
- Lightning Fast: Powered by Fastify and Pino.
- Authentication: Native support for JWT and static API Keys.
- Rate Limiting: Redis-backed fixed-window rate limiting.
- Type Safe: Configuration validated at startup using Zod.
- Observability: Structured JSON logging ready for centralized log aggregators.
- Node.js (v18+)
- Redis (running locally or via Docker)
Clone the repository and install dependencies: ```bash npm install ```
Create a `.env` file in the root directory based on the following environment variables:
```env PORT=3000 REDIS_URL=redis://localhost:6379 JWT_SECRET=your_super_secret_jwt_key_here API_KEY=optional_static_api_key LOG_LEVEL=info NODE_ENV=development ```
To run in development mode with hot-reloading: ```bash npm run dev ```
To build and run for production: ```bash npm run build npm run start ```
Requests pass through the following lifecycle hooks:
- Request Logging: Captures incoming method and path.
- Authentication: Validates `Authorization` or `X-API-Key` headers.
- Rate Limiting: Checks Redis counters against the configured limits.
- Transformation & Proxy: (Pending implementation) Routes traffic to downstream services.