Bun with Elysia & Drizzle

This is a Bun server using Elysia for the API and Drizzle ORM for a Postgres DB. It crawls data from https://dora-world.com/wallpaper and upload it to my personal Uploadthing directory.

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"
UPLOADTHING_SECRET="YOUR_KEY_HERE"
UPLOADTHING_APP_ID="YOUR_KEY_HERE"
  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.