Skip to content

weng-lab/MOHD-api

Repository files navigation

Bun Hono GQL API template

Template for Bun + Hono REST/GraphQL APIs with PostgreSQL.

Deployment on GCP with Cloud Run and Cloud SQL.

Development

bun install
bun run dev

Local Database (Docker)

cp .env.example .env
bun run db:start    # start postgres container
bun run db:up       # run migrations
bun run db:seed     # seed test data

Other commands: db:down, db:reset, db:stop

Testing

bun test

Cloud Run Deployment

Set these environment variables in Cloud Run:

POSTGRES_URL=postgresql://USER:PASSWORD@localhost:PORT/DATABASE
POSTGRES_PATH=/cloudsql/PROJECT:REGION:INSTANCE/.s.PGSQL.PORT

Requirements:

  • Add Cloud SQL instance under "Connections" tab
  • Service account needs Cloud SQL Client role

Local Access to Cloud SQL

cloud-sql-proxy PROJECT:REGION:INSTANCE --port=PORT
POSTGRES_URL="postgresql://USER:PASSWORD@localhost:PORT/DATABASE"

About

API for MOHD data portal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published