Skip to content

ThorbjoernTasche/beyond-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

beyond-api

A Bun monorepo containing the api-gateway service.

Prerequisites

  • Bun 1.3 or newer
  • Docker with Docker Compose

Quick start

cp apps/api-gateway/.env.example apps/api-gateway/.env
bun install
bun run db:up
bun run dev

The API gateway listens on http://localhost:3000 by default.

Check the service and its PostgreSQL connection:

curl http://localhost:3000/health

Example response:

{
  "status": "ok",
  "database": {
    "status": "ok",
    "latencyMs": 1.42
  }
}

The endpoint returns 503 Service Unavailable when the database query fails. Its latency includes pool acquisition, network, and query time, so the first request can be slower while Bun opens the initial PostgreSQL connection.

Commands

Command Description
bun run dev Start the API gateway with file watching
bun run start Start the API gateway
bun run test Run all workspace tests
bun run typecheck Type-check all workspaces
bun run db:up Start PostgreSQL in Docker
bun run db:down Stop PostgreSQL
bun run db:generate Generate Drizzle migrations after schema changes
bun run db:migrate Apply Drizzle migrations

There are no domain tables or migrations in the initial scaffold. Add table definitions to apps/api-gateway/src/db/schema.ts, then run bun run db:generate and bun run db:migrate.

Structure

.
├── apps/
│   └── api-gateway/
│       ├── .env.example
│       ├── src/
│       │   ├── db/
│       │   ├── app.ts
│       │   └── index.ts
│       └── drizzle.config.ts
├── compose.yaml
└── package.json

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages