Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cdbrw/bun-elysia-prisma-base
Base template for a Bun server using Elysia for routing and Prisma as the ORM for a Postgres database
https://github.com/cdbrw/bun-elysia-prisma-base
bunjs elysiajs prisma
Last synced: 17 days ago
JSON representation
Base template for a Bun server using Elysia for routing and Prisma as the ORM for a Postgres database
- Host: GitHub
- URL: https://github.com/cdbrw/bun-elysia-prisma-base
- Owner: cdbrw
- Created: 2024-02-17T23:18:30.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-02-18T05:04:31.000Z (11 months ago)
- Last Synced: 2024-10-29T20:05:49.983Z (2 months ago)
- Topics: bunjs, elysiajs, prisma
- Language: TypeScript
- Homepage: https://railway.app/template/ospb5B?referralCode=codebrew
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/ospb5B?referralCode=codebrew)
# Bun with Elysia & Prisma
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](https://railway.app/template/ospb5B?referralCode=codebrew) or simply [create a new repo](https://github.com/thecodebrew/bun-elysia-prisma-base/generate) using this template.
## Development
Install dependencies
```bash
bun install
```
Start a Docker container for the Postgres database
```bash
docker run --name dev-postgres -p 5432:5432 -e POSTGRES_PASSWORD=12345678 -d postgres
```Add the `DATABASE_URL` env variable to a _.env_ file
```dotenv
DATABASE_URL="postgresql://postgres:12345678@localhost:5432/postgres?schema=public"
```To start the development server run:
```bash
bun run dev
```
Open http://localhost:3000/ with your browser to see the result.## Production
1. Ensure the `DATABASE_URL` env variable is set to `${{Postgres.DATABASE_URL}}`
2. Set custom build command to `bunx prisma migrate deploy` in order to run database migrations