https://github.com/bridge-codes/bridge
Bridge is a Typescript Node.js framework that provides an easy and scalable way to create REST APIs while generating the client code. Our goal is to make Bridge a great framework for both frontend and backend teams, so if you're familiar with Node.js and Typescript, you'll feel right at home.
https://github.com/bridge-codes/bridge
api express expressjs nodejs rest-api typesafe
Last synced: 17 days ago
JSON representation
Bridge is a Typescript Node.js framework that provides an easy and scalable way to create REST APIs while generating the client code. Our goal is to make Bridge a great framework for both frontend and backend teams, so if you're familiar with Node.js and Typescript, you'll feel right at home.
- Host: GitHub
- URL: https://github.com/bridge-codes/bridge
- Owner: bridge-codes
- License: mit
- Created: 2022-12-16T12:09:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-05T18:00:47.000Z (5 months ago)
- Last Synced: 2025-04-01T23:44:49.958Z (30 days ago)
- Topics: api, express, expressjs, nodejs, rest-api, typesafe
- Language: TypeScript
- Homepage: https://bridge.codes
- Size: 9.35 MB
- Stars: 332
- Watchers: 2
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bridge
Bridge is the most straightforward yet powerful framework for creating simple or complex APIs using the full power of TypeScript, even for developers with little experience. Give it a try and see how easy it is to build your dream API!
## Documentation
Full documentation for `bridge` can be found [here](https://bridge.codes).
## Installation
```bash
# npm
npm install bridge
# Yarn
yarn add bridge
# pnpm
pnpm add bridge
```## Quickstart
```bash
# npm
npx create-bridge-app@latest
# Yarn
yarn create bridge-app
# pnpm
pnpm create bridge-app
```## Basic Example
```ts
import { initBridge, handler } from 'bridge';
import express from 'express';
// You can also use Yup or Superstruct for data validation
import z from 'zod';const port = 8080;
// A handler can be used as an endpoint but also as a middleware
const heyHandler = handler({
query: z.object({ name: z.string() }),
resolve: ({ query }) => `Hey ${query.name}`,
});// You can also have multiple endpoints for the same route with different methods with the method function
const routes = {
hey: heyHandler, // POST /hey
};// It is also possible to use pure HTTP Server
const app = express();app.use('', initBridge({ routes }).expressMiddleware());
app.listen(port, () => {
console.log(`Listening on port ${port}`);
});
```For more complex examples and a full understanding of the capabilities of Bridge, be sure to check out our [documentation](https://bridge.codes)!
## Client code generation and documentation
### Connect your Bridge API to Bridge Studio
**With the CLI**
```bash title='terminal'
npx bridge-studio@latest
# or
pnpx bridge-studio@latest
```**With the plateform:** https://studio.bridge.codes
### Fetch your client SDK
```bash title='terminal'
npx fetch-bridge-sdk@latest {username}/{projectName}
```### Access your generated documentation
You'll be able to access your complete generated documentation on https://studio.bridge.codes soon.
Please visit https://bridge.codes/studio for more information.