This is a template repo for the base of a Bun server using Elysia for the API and Prisma as the ORM for a Postgres DB.
You can deploy on Railway or simply create a new repo using this template.
Install dependencies
bun install
Start a Docker container for the Postgres database
docker run --name dev-postgres -p 5432:5432 -e POSTGRES_PASSWORD=12345678 -d postgres
Add the DATABASE_URL
env variable to a .env file
DATABASE_URL="postgresql://postgres:12345678@localhost:5432/postgres?schema=public"
To start the development server run:
bun run dev
Open http://localhost:3000/ with your browser to see the result.
- Ensure the
DATABASE_URL
env variable is set to${{Postgres.DATABASE_URL}}
- Set custom build command to
bunx prisma migrate deploy
in order to run database migrations