https://github.com/bedstack/elysia-drizzle-realworld-example
RealWorld backend implementation built with ElysiaJS and Drizzle ORM
https://github.com/bedstack/elysia-drizzle-realworld-example
arktype backend biomejs bun drizzle-orm elysiajs realworld realworld-backend scalar server typescript web
Last synced: 4 days ago
JSON representation
RealWorld backend implementation built with ElysiaJS and Drizzle ORM
- Host: GitHub
- URL: https://github.com/bedstack/elysia-drizzle-realworld-example
- Owner: bedstack
- License: mit
- Created: 2023-09-21T17:47:25.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-04-24T00:45:42.000Z (7 days ago)
- Last Synced: 2026-04-24T02:30:05.271Z (7 days ago)
- Topics: arktype, backend, biomejs, bun, drizzle-orm, elysiajs, realworld, realworld-backend, scalar, server, typescript, web
- Language: TypeScript
- Homepage: https://realworld.io
- Size: 2.59 MB
- Stars: 64
- Watchers: 0
- Forks: 7
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Support: SUPPORT.md
Awesome Lists containing this project
README
# 
> ### ElysiaJS + Drizzle ORM codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the [RealWorld](https://github.com/gothinkster/realworld) spec and API.
### [Demo](https://demo.realworld.show) [RealWorld](https://github.com/gothinkster/realworld)
[](https://github.com/bedstack/elysia-drizzle-realworld-example/actions/workflows/tests.yml?query=branch%3Amain+event%3Apush) [](https://github.com/bedstack/elysia-drizzle-realworld-example/blob/main/LICENSE) [](https://elysiajs.com/) [](https://drizzle.team/) [](https://arktype.io/) [](https://scalar.com/) [](https://bun.com/) [](https://biomejs.dev/) [](https://github.com/bedstack/elysia-drizzle-realworld-example/stargazers/)
This codebase was created to demonstrate a fully fledged backend application built with **[ElysiaJS](https://elysiajs.com/)** and **[Drizzle ORM](https://orm.drizzle.team/)** including CRUD operations, authentication, routing, pagination, and more.
We've gone to great lengths to adhere to the **ElysiaJS** and **Drizzle ORM** community styleguides & best practices.
For more information on how this works with other frontends/backends, head over to the [RealWorld](https://github.com/gothinkster/realworld) repo.
# How it works
## Architecture
This project follows the [Bedstack](https://bedstack.js.org/) architecture - a modular, layered approach to building TypeScript backends:
- **Modular structure** - Each domain (users, articles, comments, etc.) is a self-contained module with its own controller, service, repository, and DTOs
- **Layered design** - Clear separation between Controller (HTTP handling) → Service (business logic) → Repository (data access)
- **Type-safe data flow** - DTOs define request/response shapes, mappers transform between layers, schemas define database tables
```
src/
├── users/ # User module
│ ├── users.controller.ts
│ ├── users.service.ts
│ ├── users.repository.ts
│ ├── users.schema.ts
│ ├── dto/
│ └── mappers/
├── articles/ # Article module (same structure)
├── shared/ # Shared utilities and error handling
└── app.module.ts # Root module composing all features
```
[Read more about the Bedstack architecture →](https://bedstack.js.org/)
## Technologies
- **[ElysiaJS](https://elysiajs.com/)** - Web framework for HTTP
- **[Drizzle ORM](https://orm.drizzle.team/)** - TypeScript ORM for PostgreSQL
- **[ArkType](https://arktype.io/)** - Runtime validation
- **[Scalar](https://scalar.com/)** - API documentation
- **[Bun](https://bun.sh/)** - JavaScript runtime and package manager
- **[Biome](https://biomejs.dev/)** - Linting and formatting
# Getting started
1. **Install dependencies**
```sh
bun i
```
2. **Create a `.env` file**
```sh
cp .env.example .env
```
Use the provided example values or replace them with your own.
3. **Ensure Docker daemon is running and start the database service**
```sh
bun db:start
```
4. **Migrate the schema to the database**
```sh
bun db:migrate
```
5. **Run the development server**
```sh
bun dev
```
6. **Run the API tests**
```sh
bun run test # not `bun test`!
```
7. **(Optional) Start the [database studio](https://orm.drizzle.team/drizzle-studio/overview)**
```bash
bun db:studio
```
# Deploy to production
> [!TIP]
> See more info in ElysiaJS's [Deploy to production](https://elysiajs.com/patterns/deploy) pattern.
1. **Build the app**
```sh
bun run build # not `bun build`!
```
2. **Run the server**
```sh
bun preview
```
# Need help?
If you have questions or ideas:
- Open a [GitHub Discussion](https://github.com/bedstack/elysia-drizzle-realworld-example/discussions)
- Open an [Issue](https://github.com/bedstack/elysia-drizzle-realworld-example/issues) if you believe you found a bug
# Contributors
You are welcome to [contribute to the project](https://github.com/bedstack/elysia-drizzle-realworld-example/blob/main/CONTRIBUTING.md)!

Yam C Borodetsky
💬 🤔 📖 🐛 💡 🚇 ⚠️

Hajbo
🚇 💻 🎨 🤔 ⚠️ 💬

Aruay Berdikulova
💻 🤔