Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cdbrw/bun-elysia-drizzle-base
Base template for a Bun server using Elysia for routing and Drizzle ORM for a Postgres database
https://github.com/cdbrw/bun-elysia-drizzle-base
Last synced: 26 days ago
JSON representation
Base template for a Bun server using Elysia for routing and Drizzle ORM for a Postgres database
- Host: GitHub
- URL: https://github.com/cdbrw/bun-elysia-drizzle-base
- Owner: cdbrw
- Created: 2024-02-19T02:06:47.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-02-19T03:37:51.000Z (10 months ago)
- Last Synced: 2024-10-28T21:38:28.349Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 26.4 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - cdbrw/bun-elysia-drizzle-base - Base template for a Bun server using Elysia for routing and Drizzle ORM for a Postgres database (TypeScript)
README
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/xuXPu7?referralCode=codebrew)
# 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](https://railway.app/template/xuXPu7?referralCode=codebrew) or simply [create a new repo](https://github.com/thecodebrew/bun-elysia-drizzle-base/generate) using this template.
## Development
1. Install dependencies
```
bun install
```
2. Start a Docker container for the Postgres database
```
docker run --name dev-postgres -p 5432:5432 -e POSTGRES_PASSWORD=12345678 -d postgres
```3. Add the `DATABASE_URL` env variable to a _.env_ file
```
DATABASE_URL="postgresql://postgres:12345678@localhost:5432/postgres?schema=public"
```4. Add your tables to `src/db/schema/index.ts`.
5. Generate migrations
```shell
bun run generate
```6. Run migrations
```shell
bun run migrate
```7. To start the development server run:
```bash
bun run dev
```
Open http://localhost:3000/ with your browser to see the result.