Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/actions/deploy-website/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy to GitHub Pages
descrition: Build and deploy website to github pages

on:
push:
branches: [main]
paths:
- "website/**"
- "docs/**"

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install & Build
run: |
cd website
bun install
bun run build

- name: Prepare deployment
run: |
mkdir -p deploy
cp -r website/build/* deploy/

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deploy
enable_jekyll: false
20 changes: 10 additions & 10 deletions docs/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Actions orchestrate the request → response flow. They parse parameters, call m

Use controllers for simple CRUD operations, single-model operations, or any direct request → model → view flow. Most of your endpoints will be controller actions.

**See:** [examples/database/src/controllers/](../examples/database/src/controllers/)
**See:** [examples/database/src/controllers/](https://github.com/TrustBound/dream/tree/main/examples/database/src/controllers/)

---

Expand All @@ -68,7 +68,7 @@ The router is generic over your Context and Services types. This means the compi

**Router Performance:** Dream uses a radix trie for O(path depth) route matching. Benchmarks show consistent ~1.3-1.5μs lookup times whether you have 100 or 1000 routes. The router is fast enough that it won't be your bottleneck.

**See:** [examples/simple/src/router.gleam](../examples/simple/src/router.gleam)
**See:** [examples/simple/src/router.gleam](https://github.com/TrustBound/dream/tree/main/examples/simple/src/router.gleam)

---

Expand Down Expand Up @@ -108,7 +108,7 @@ Now every controller action gets the same Services instance. Need to add a new s

Yes, Services is a "god object" that holds multiple dependencies. We're okay with that tradeoff because it makes adding cross-cutting concerns easy, keeps controller action signatures consistent, and the alternative—threading dependencies through every function—is worse.

**See:** [examples/database/src/services.gleam](../examples/database/src/services.gleam)
**See:** [examples/database/src/services.gleam](https://github.com/TrustBound/dream/tree/main/examples/database/src/services.gleam)

---

Expand Down Expand Up @@ -176,7 +176,7 @@ The controller action receives the enriched context and can access `context.user
| User, request ID | Database, cache, config |
| Middleware can modify | Initialized once at startup |

**See:** [examples/custom_context/](../examples/custom_context/)
**See:** [examples/custom_context/](https://github.com/TrustBound/dream/tree/main/examples/custom_context/)

---

Expand Down Expand Up @@ -238,7 +238,7 @@ Response

Use middleware for cross-cutting concerns like logging and auth, or for request/response modification. Don't put business logic in middleware—that belongs in operations or controller actions.

**See:** [examples/custom_context/src/middleware/](../examples/custom_context/src/middleware/)
**See:** [examples/custom_context/src/middleware/](https://github.com/TrustBound/dream/tree/main/examples/custom_context/src/middleware/)

---

Expand Down Expand Up @@ -324,7 +324,7 @@ pub fn publish_post_with_wrong_user_returns_forbidden_test() {

Use operations when you're coordinating 2+ models, have complex business rules spanning entities, or need side effects like events, emails, or search indexing. Don't use them for simple CRUD—most controller actions don't need operations. Only extract when complexity demands it.

**See:** [examples/cms/src/operations/](../examples/cms/src/operations/)
**See:** [examples/cms/src/operations/](https://github.com/TrustBound/dream/tree/main/examples/cms/src/operations/)

---

Expand Down Expand Up @@ -363,7 +363,7 @@ fn row_to_user(row: sql.GetUserRow) -> User {

Models take connections as parameters, return domain types (not DB types), and handle the DB ↔ Domain conversion internally. Your controller actions stay clean—they just call `user.get(db, id)` and get a `User`, not a database row.

**See:** [examples/database/src/models/](../examples/database/src/models/)
**See:** [examples/database/src/models/](https://github.com/TrustBound/dream/tree/main/examples/database/src/models/)

---

Expand Down Expand Up @@ -393,7 +393,7 @@ pub fn to_json(user: User) -> String {

Views are testable in isolation. Give them a `User`, get back JSON. No database, no HTTP, no mocks. Just formatting.

**See:** [examples/multi_format/src/views/](../examples/multi_format/src/views/)
**See:** [examples/multi_format/src/views/](https://github.com/TrustBound/dream/tree/main/examples/multi_format/src/views/)

### Template Composition for HTML

Expand All @@ -404,9 +404,9 @@ For server-side rendering with full type safety, Dream recommends a layered temp
3. **Pages** (`templates/pages/*.matcha` or `.gleam`): Compose components into full pages
4. **Layouts** (`templates/layouts/*.gleam`): Wrap pages with consistent structure (nav, footer, scripts)

This pattern eliminates markup duplication, keeps styling consistent, and provides full type safety through Gleam. See [Template Composition](../guides/templates.md) for a complete guide.
This pattern eliminates markup duplication, keeps styling consistent, and provides full type safety through Gleam. See [Template Composition](guides/templates.md) for a complete guide.

**See:** [examples/tasks/src/templates/](../examples/tasks/src/templates/) for a working example
**See:** [examples/tasks/src/templates/](https://github.com/TrustBound/dream/tree/main/examples/tasks/src/templates/) for a working example

---

Expand Down
4 changes: 2 additions & 2 deletions docs/concepts/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ The response flows back through middleware (which can modify it), then back to t

## Next Steps

- [Components](components.md) - Detailed explanation of routers, controllers, middleware
- [Request Flow Example](../examples/simple/) - See it in action
- Components - Detailed explanation of routers, controllers, middleware
- [Request Flow Example](https://github.com/TrustBound/dream/tree/main/examples/simple/) - See it in action
- [Architecture Reference](../reference/architecture.md) - Deep technical dive

2 changes: 1 addition & 1 deletion docs/concepts/project-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ But this structure works. We use it in production. It scales.

## Next Steps

- [Components](components.md) - Learn about controllers, models, views
- Components - Learn about controllers, models, views
- [Concepts Overview](../concepts.md) - All Dream concepts explained
- [Examples](../examples.md) - See real project structures

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to Dream
# Contributing Guide

Thanks for your interest in contributing! Dream is a community project and we welcome contributions.

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Writing docs?** Read the [Tone Guide](tone-guide.md) first.

**Writing code?** See [Contributing Guide](contributing.md)
**Writing code?** See [Contributing Guide](contributing-guide.md)

**Running tests?** See [Testing Guide](testing.md)

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/tone-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,6 @@ A little strategic snark in the right place builds connection with battle-tested
## See Also

- [Contributing Index](index.md) - Overview of documentation contributing
- [contributing.md](contributing.md) - Code contribution guidelines
- [Contributing Guide](contributing-guide.md) - Code contribution guidelines
- [Design Principles](../reference/design-principles.md) - Dream's philosophy

22 changes: 11 additions & 11 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ If you are not sure where to start, follow the examples in the **Learning Order*

## Learning Order

### 1. [simplest/](../examples/simplest/)
### 1. [simplest/](https://github.com/TrustBound/dream/tree/main/examples/simplest/)
**One file. One route.** (Best first "hello Dream" example.)

The absolute minimum Dream app. Everything inline, no organization. Start here.
Expand All @@ -22,7 +22,7 @@ The absolute minimum Dream app. Everything inline, no organization. Start here.

---

### 2. [simple/](../examples/simple/)
### 2. [simple/](https://github.com/TrustBound/dream/tree/main/examples/simple/)
**Basic routing and path parameters.** (Best first routing + path parameters example.)

Multiple routes, path parameters, HTTP client usage.
Expand All @@ -37,7 +37,7 @@ Multiple routes, path parameters, HTTP client usage.

---

### 3. [database/](../examples/database/)
### 3. [database/](https://github.com/TrustBound/dream/tree/main/examples/database/)
**Full CRUD API with PostgreSQL.** (Best first database-backed REST API example.)

Complete REST API with type-safe SQL, migrations, and validation.
Expand All @@ -55,7 +55,7 @@ Complete REST API with type-safe SQL, migrations, and validation.

---

### 4. [custom_context/](../examples/custom_context/)
### 4. [custom_context/](https://github.com/TrustBound/dream/tree/main/examples/custom_context/)
**Authentication with middleware.** (Best first auth + custom context example.)

Custom context types and middleware for auth.
Expand All @@ -71,7 +71,7 @@ Custom context types and middleware for auth.

---

### 5. [tasks/](../examples/tasks/)
### 5. [tasks/](https://github.com/TrustBound/dream/tree/main/examples/tasks/)
**Full-featured task app with HTMX.** (Best first templates + HTMX example.)

Complete task management application with HTMX, semantic classless HTML, and composable templates.
Expand All @@ -90,7 +90,7 @@ Complete task management application with HTMX, semantic classless HTML, and com

## Specialized Examples

### [multi_format/](../examples/multi_format/)
### [multi_format/](https://github.com/TrustBound/dream/tree/main/examples/multi_format/)
**JSON, HTML, CSV, HTMX responses.** (Best first multi-format responses example.)

Same data in multiple formats with content negotiation.
Expand All @@ -106,7 +106,7 @@ Same data in multiple formats with content negotiation.

---

### [streaming/](../examples/streaming/)
### [streaming/](https://github.com/TrustBound/dream/tree/main/examples/streaming/)
**HTTP client with streaming.** (Best first streaming HTTP client example.)

Both streaming and non-streaming HTTP requests to external APIs.
Expand All @@ -122,7 +122,7 @@ Both streaming and non-streaming HTTP requests to external APIs.

---

### [streaming_capabilities/](../examples/streaming_capabilities/)
### [streaming_capabilities/](https://github.com/TrustBound/dream/tree/main/examples/streaming_capabilities/)
**🔥 Advanced streaming patterns.** (Read `streaming/` first; this is the advanced streaming showcase.)

Complete streaming showcase: ingress, egress, bi-directional, middleware, proxying.
Expand All @@ -139,7 +139,7 @@ Complete streaming showcase: ingress, egress, bi-directional, middleware, proxyi

---

### [websocket_chat/](../examples/websocket_chat/)
### [websocket_chat/](https://github.com/TrustBound/dream/tree/main/examples/websocket_chat/)
**Real-time chat with WebSockets.** (Best first WebSocket example.)

A multi-user chat application that uses WebSockets and a broadcaster service.
Expand All @@ -156,7 +156,7 @@ A multi-user chat application that uses WebSockets and a broadcaster service.

---

### [rate_limiter/](../examples/rate_limiter/)
### [rate_limiter/](https://github.com/TrustBound/dream/tree/main/examples/rate_limiter/)
**Global rate limiting with shared state.** (Best first ETS + rate limiting example.)

Rate limiting across all requests using shared ETS-backed state.
Expand All @@ -170,7 +170,7 @@ Rate limiting across all requests using shared ETS-backed state.

---

### [static/](../examples/static/)
### [static/](https://github.com/TrustBound/dream/tree/main/examples/static/)
**Serving static files.** (Best first static file serving example.)

File serving with security, directory listing, MIME types.
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/multiple-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fn detect_format_from_headers(request: Request) -> String {

## Working Example

See [examples/tasks](../../examples/tasks/) for a complete application demonstrating:
See [examples/tasks](https://github.com/TrustBound/dream/tree/main/examples/tasks/) for a complete application demonstrating:
- Side-by-side JSON and HTML
- HTMX for dynamic updates
- Shared business logic
Expand Down
3 changes: 1 addition & 2 deletions docs/guides/streaming-quick-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,5 +365,4 @@ fn int_to_byte(n: Int) -> BitArray {
- [Streaming Guide](streaming.md) - Complete guide
- [Streaming API Reference](../reference/streaming-api.md) - Full API docs
- [WebSockets Guide](websockets.md) - Real-time, bi-directional connections
- [Examples](../../examples/streaming_capabilities/) - Working code

- [Examples](https://github.com/TrustBound/dream/tree/main/examples/streaming_capabilities/) - Working code
12 changes: 6 additions & 6 deletions docs/guides/streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,11 @@ fn map_validation_result_to_response(result: Result(String, Error)) -> Response

### Simple Streaming

See [`examples/streaming/`](../../examples/streaming/) for HTTP client streaming.
See [`examples/streaming/`](https://github.com/TrustBound/dream/tree/main/examples/streaming/) for HTTP client streaming.

### Advanced Streaming

See [`examples/streaming_capabilities/`](../../examples/streaming_capabilities/) for:
See [`examples/streaming_capabilities/`](https://github.com/TrustBound/dream/tree/main/examples/streaming_capabilities/) for:
- **Ingress streaming**: File uploads with byte counting
- **Egress streaming**: Generate and stream 1000 lines
- **Bi-directional streaming**: Transform data both ways
Expand All @@ -668,7 +668,7 @@ See [`examples/streaming_capabilities/`](../../examples/streaming_capabilities/)

### Multi-Format Streaming

See [`examples/multi_format/`](../../examples/multi_format/) for:
See [`examples/multi_format/`](https://github.com/TrustBound/dream/tree/main/examples/multi_format/) for:
- CSV export as a stream
- Different formats from same data
- Streaming with database queries
Expand Down Expand Up @@ -859,6 +859,6 @@ type ResponseBody {

- [Multiple Formats Guide](multiple-formats.md) - Different response formats
- [File Uploads Guide](file-uploads.md) - Multipart form handling
- [Streaming Example](../../examples/streaming/) - HTTP client streaming
- [Streaming Capabilities Example](../../examples/streaming_capabilities/) - Advanced streaming
- [Multi-Format Example](../../examples/multi_format/) - CSV streaming with database
- [Streaming Example](https://github.com/TrustBound/dream/tree/main/examples/streaming/) - HTTP client streaming
- [Streaming Capabilities Example](https://github.com/TrustBound/dream/tree/main/examples/streaming_capabilities/) - Advanced streaming
- [Multi-Format Example](https://github.com/TrustBound/dream/tree/main/examples/multi_format/) - CSV streaming with database
2 changes: 1 addition & 1 deletion docs/guides/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ This is by no means the only way to do server-side rendering, but we have found

## Working Example

See [examples/tasks](../../examples/tasks/) for a complete working example of this pattern, including:
See [examples/tasks](https://github.com/TrustBound/dream/tree/main/examples/tasks/) for a complete working example of this pattern, including:
- Element templates (button, input, checkbox, etc.)
- Component functions (task_card, task_list, etc.)
- Page templates (index, show, etc.)
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/websockets.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ without opening real connections.
full API (`Message`, `Action`, `send_text`, `send_binary`, etc.).
- Explore `src/dream/services/broadcaster.gleam` for the pub/sub
implementation.
- Run and modify the [`examples/websocket_chat/`](../../examples/websocket_chat/)
- Run and modify the [`examples/websocket_chat/`](https://github.com/TrustBound/dream/tree/main/examples/websocket_chat/)
example to fit your own use case.
- Revisit the [Streaming Guide](streaming.md) to compare WebSockets with
HTTP streaming and SSE.
2 changes: 1 addition & 1 deletion docs/learn/01-hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,5 @@ When you need multiple routes, path parameters, or a database, continue to [Less

---

**Working example:** See [examples/simplest/](../../examples/simplest/) for the complete runnable code.
**Working example:** See [examples/simplest/](https://github.com/TrustBound/dream/tree/main/examples/simplest/) for the complete runnable code.

2 changes: 1 addition & 1 deletion docs/learn/02-building-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,4 +635,4 @@ Continue to [Lesson 3: Adding Auth](03-adding-auth.md) to learn custom context a

---

**Working example:** See [examples/database/](../../examples/database/) for the complete runnable code.
**Working example:** See [examples/database/](https://github.com/TrustBound/dream/tree/main/examples/database/) for the complete runnable code.
2 changes: 1 addition & 1 deletion docs/learn/03-adding-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,5 @@ Continue to [Lesson 4: Advanced Patterns](04-advanced-patterns.md) to learn the

---

**Working example:** See [examples/custom_context/](../../examples/custom_context/) for the complete runnable code.
**Working example:** See [examples/custom_context/](https://github.com/TrustBound/dream/tree/main/examples/custom_context/) for the complete runnable code.

8 changes: 4 additions & 4 deletions docs/learn/04-advanced-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,11 @@ You now understand:
- [Architecture](../reference/architecture.md) - How it all fits together

**Examples:**
- [CMS Example](../../examples/cms/) - Full application with operations
- [Multi-Format Example](../../examples/multi_format/) - JSON, HTML, CSV responses
- [All Examples](../../examples/) - Complete working applications
- [CMS Example](https://github.com/TrustBound/dream/tree/main/examples/cms/) - Full application with operations
- [Multi-Format Example](https://github.com/TrustBound/dream/tree/main/examples/multi_format/) - JSON, HTML, CSV responses
- [All Examples](https://github.com/TrustBound/dream/tree/main/examples/) - Complete working applications

---

**Working example:** See [examples/cms/](../../examples/cms/) for the complete runnable code with operations.
**Working example:** See [examples/cms/](https://github.com/TrustBound/dream/tree/main/examples/cms/) for the complete runnable code with operations.

2 changes: 1 addition & 1 deletion docs/learn/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ Scale your application logic. Learn the Operations pattern for complex business
Once you've completed the path, you'll have a solid understanding of Dream's core philosophy. From there, you can:

- **Build something specific:** Check out the [Guides](../guides/) for task-based help.
- **See real code:** Explore the [Examples](../../examples/) to see working applications.
- **See real code:** Explore the [Examples](https://github.com/TrustBound/dream/tree/main/examples/) to see working applications.
- **Deep dive:** Read the [Reference](../reference/) docs for API details.
8 changes: 4 additions & 4 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ that it won’t be your bottleneck for typical apps.

### Explore Examples

- [`examples/database`](../examples/database/) - Full CRUD API with PostgreSQL
- [`examples/streaming_capabilities`](../examples/streaming_capabilities/) - Advanced streaming
- [`examples/multi_format`](../examples/multi_format/) - JSON/HTML/CSV/HTMX
- [All Examples](../examples/) - Multiple working applications with extensive integration tests
- [`examples/database`](https://github.com/TrustBound/dream/tree/main/examples/database/) - Full CRUD API with PostgreSQL
- [`examples/streaming_capabilities`](https://github.com/TrustBound/dream/tree/main/examples/streaming_capabilities/) - Advanced streaming
- [`examples/multi_format`](https://github.com/TrustBound/dream/tree/main/examples/multi_format/) - JSON/HTML/CSV/HTMX
- [All Examples](https://github.com/TrustBound/dream/tree/main/examples/) - Multiple working applications with extensive integration tests

**Want to understand this code?** Start with [Hello World](learn/01-hello-world.md) in the learning path.

2 changes: 1 addition & 1 deletion docs/reference/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ Everything else is subject to change based on feedback and real-world usage:
### Upgrading Between Versions

When upgrading between 0.x.x versions:
- Review the [CHANGELOG](../CHANGELOG.md) for breaking changes
- Review the [CHANGELOG](https://github.com/TrustBound/dream/blob/main/CHANGELOG.md) for breaking changes
- Test your application thoroughly
- Update code to match new APIs as needed

Expand Down
Loading
Loading