You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/www/content/docs/(architecture)/authentication.mdx
+25-8Lines changed: 25 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,22 +16,39 @@ The `AuthService` is a singleton responsible for:
16
16
- Extracting user context from request headers.
17
17
18
18
### 2. Guarding Routes
19
-
Bedstack uses Elysia's `beforeHandle` hook to protect routes. This is implemented in the Controller layer.
20
19
21
-
```typescript
22
-
// src/articles/articles.controller.ts
23
-
import { AuthService } from'@/auth/auth.service';
20
+
Bedstack uses Elysia hooks to protect routes. Depending on the endpoint, you might require a user to be logged in or simply want to identify them if they are.
Inside a Bedstack application (like `apps/api`), code is organized into self-contained feature modules. This makes the codebase easier to navigate and allows features to be moved or scaled independently.
Copy file name to clipboardExpand all lines: apps/www/content/docs/(architecture)/validation.mdx
+22-4Lines changed: 22 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,20 +10,38 @@ In Bedstack, validation is not just an afterthought—it's a core part of the ar
10
10
Data Transfer Objects (DTOs) define the shape of data entering and leaving your application. In Bedstack, every DTO is an **ArkType** schema.
11
11
12
12
### Defining an Input DTO
13
-
Input DTOs are used in `POST`, `PUT`, and `PATCH` requests to validate the request body.
13
+
14
+
Input DTOs are used in `POST`, `PUT`, and `PATCH` requests. ArkType allows you to define these using a concise string-based syntax or a more traditional object-based one.
Bedstack is unapologetically opinionated. A tech stack is not just a menu of options; it is a curated path. We've selected these tools because they reinforce each other to create a developer experience that is both fast and safe.
33
33
34
34
Whether you are building a small MVP or a large-scale production system, the **Bedstack Architecture** provides the structure you need to move fast without breaking things.
35
+
36
+
---
37
+
38
+
## FAQ
39
+
40
+
<Accordions>
41
+
<Accordiontitle="Can I use Bedstack with Node.js?">
42
+
Bedstack is designed specifically for **Bun**. While most of the tools (Elysia, Drizzle, ArkType) work on Node.js, the core philosophy of Bedstack—unmatched speed and zero-boilerplate—is best achieved using the Bun runtime.
43
+
</Accordion>
44
+
<Accordiontitle="How does it compare to NestJS?">
45
+
Bedstack is heavily inspired by NestJS's modular and layered architecture but aims for **minimal friction**. We avoid heavy use of decorators and complex dependency injection, favoring clean TypeScript patterns and the performance of the Bun ecosystem.
46
+
</Accordion>
47
+
<Accordiontitle="Is it production ready?">
48
+
Yes! Our [RealWorld example implementation](/docs/realworld) is a non-trivial, production-scale application that demonstrates how Bedstack handles real-world complexity, authentication, and database relationships.
Bedstack uses Bun's built-in package manager. Run the following command in the root directory:
28
32
29
33
```bash terminal
30
34
bun install
31
35
```
36
+
</Step>
32
37
38
+
<Step>
33
39
## 3. Environment Variables
34
40
35
41
The application requires some environment variables to connect to the database and sign JWTs. Copy the example file:
36
42
37
43
```bash terminal
38
44
cp apps/conduit/.env.example apps/conduit/.env
39
45
```
46
+
</Step>
40
47
48
+
<Step>
41
49
## 4. Database Setup
42
50
43
51
We use Docker Compose to spin up a local PostgreSQL instance.
@@ -56,7 +64,9 @@ bun run --cwd apps/conduit db:push
56
64
# Seed with initial data
57
65
bun run --cwd apps/conduit db:seed
58
66
```
67
+
</Step>
59
68
69
+
<Step>
60
70
## 5. Run the Application
61
71
62
72
Now you can start the development server:
@@ -66,3 +76,6 @@ bun run --cwd apps/conduit dev
66
76
```
67
77
68
78
The API is now available at `http://localhost:3000/api`. You can also visit `http://localhost:3000/swagger` to explore the interactive API documentation.
0 commit comments