Getting Started
How to start building with the Bedstack architecture.
To begin building with the Bedstack architecture, you don't "install" Bedstack itself. Instead, you adopt its patterns and use its recommended toolkit.
Tooling Prerequisites
To build a high-performance Bedstack application, we recommend the following toolchain:
- Bun: The foundation. You'll need Bun installed as your runtime, package manager, and test runner.
- ElysiaJS: The web framework.
- Drizzle ORM: For typesafe database access.
- ArkType: For runtime validation.
Your First Bedstack App
Starting a new Bedstack project is straightforward. Follow these steps to initialize your project and adopt the Bedstack pattern:
Initialize your project
Create a new directory and initialize it with Bun.
mkdir my-bedstack-app
cd my-bedstack-app
bun initAdopting the Bedstack Pattern
Once your tools are in place, organize your code into the modular, layered structure:
- Features: Group your code by domain (e.g.,
users,products). - Layers: Within each feature, separate logic into Controllers, Services, and Repositories.
- Types: Ensure types flow from database schema to API responses.
Seeing it in Action
If you want to see a full-scale implementation of this architecture, check out our RealWorld Example section. It provides a complete, working codebase that follows every principle discussed in this guide.