https://github.com/bedstack/elysia-prisma-realworld-example
RealWorld backend implementation built with ElysiaJS and Prisma
https://github.com/bedstack/elysia-prisma-realworld-example
arktype backend biomejs bun elysiajs prisma realworld realworld-backend scalar server typescript web
Last synced: 5 days ago
JSON representation
RealWorld backend implementation built with ElysiaJS and Prisma
- Host: GitHub
- URL: https://github.com/bedstack/elysia-prisma-realworld-example
- Owner: bedstack
- License: mit
- Created: 2025-06-21T13:10:31.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2026-04-24T00:31:28.000Z (8 days ago)
- Last Synced: 2026-04-24T02:26:54.449Z (8 days ago)
- Topics: arktype, backend, biomejs, bun, elysiajs, prisma, realworld, realworld-backend, scalar, server, typescript, web
- Language: TypeScript
- Homepage: https://realworld.io
- Size: 485 KB
- Stars: 3
- Watchers: 0
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# 
> ### ElysiaJS + Prisma 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-prisma-realworld-example/actions/workflows/tests.yml?query=branch%3Amain+event%3Apush) [](https://github.com/bedstack/elysia-prisma-realworld-example/blob/main/LICENSE) [](https://elysiajs.com/) [](https://www.prisma.io/) [](https://arktype.io/) [](https://scalar.com/) [](https://bun.com/) [](https://biomejs.dev/) [](https://github.com/bedstack/elysia-prisma-realworld-example/stargazers/)
This codebase was created to demonstrate a fully fledged backend application built with **[ElysiaJS](https://elysiajs.com/)** and **[Prisma ORM](https://www.prisma.io/)** including CRUD operations, authentication, routing, pagination, and more.
We've gone to great lengths to adhere to the **ElysiaJS** and **Prisma 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 plugin, model, 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.plugin.ts
│ ├── users.model.ts
│ ├── interfaces/
│ └── mappers/
├── articles/ # Article module (same structure)
├── shared/ # Shared utilities and error handling
└── core/ # Core app setup, db, env
```
[Read more about the Bedstack architecture →](https://bedstack.js.org/)
## Technologies
- **[ElysiaJS](https://elysiajs.com/)** - Web framework for HTTP
- **[Prisma ORM](https://www.prisma.io/)** - 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. **Push the schema to the database**
```sh
bun db:push
```
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://www.prisma.io/studio)**
```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-prisma-realworld-example/discussions)
- Open an [Issue](https://github.com/bedstack/elysia-prisma-realworld-example/issues) if you believe you found a bug
# Contributors
You are welcome to [contribute to the project](https://github.com/bedstack/elysia-prisma-realworld-example/blob/main/CONTRIBUTING.md)!