Skip to content

Base template for a Bun server using Elysia for routing and Drizzle ORM for a Postgres database

Notifications You must be signed in to change notification settings

cdbrw/bun-elysia-drizzle-base

Repository files navigation

Deploy on Railway

Bun with Elysia & Drizzle

This is a template repo for the base of a Bun server using Elysia for the API and Drizzle ORM for a Postgres DB.

You can deploy on Railway or simply create a new repo using this template.

Development

  1. Install dependencies
bun install
  1. Start a Docker container for the Postgres database
docker run --name dev-postgres -p 5432:5432 -e POSTGRES_PASSWORD=12345678 -d postgres
  1. Add the DATABASE_URL env variable to a .env file
DATABASE_URL="postgresql://postgres:12345678@localhost:5432/postgres?schema=public"
  1. Add your tables to src/db/schema/index.ts.

  2. Generate migrations

bun run generate
  1. Run migrations
bun run migrate
  1. To start the development server run:
bun run dev

Open http://localhost:3000/ with your browser to see the result.

About

Base template for a Bun server using Elysia for routing and Drizzle ORM for a Postgres database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published