Skip to content
Merged
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
19 changes: 9 additions & 10 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# Contributor Covenant Code of Conduct

## Our Pledge
## Pledge

We as members, contributors, and leaders pledge to make participation in our
Members, contributors, and leaders pledge to make participation in the
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
The pledge is to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards
## Standards

Examples of behavior that contributes to a positive environment for our
community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
- Accepting responsibility and apologizing to those affected by mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for individuals, but for the
overall community

Examples of unacceptable behavior include:
Expand All @@ -38,7 +38,7 @@ Examples of unacceptable behavior include:

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
Community leaders are responsible for clarifying and enforcing standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Expand All @@ -52,15 +52,14 @@ decisions when appropriate.

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
Examples of representing the community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement by contacting the maintainer team
.
reported to community leaders responsible for enforcement by contacting the maintainer.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down
20 changes: 11 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Developer's Guide

Hey there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great and we truly appreciate your time and effort.
Hey there! Contributing to this project is highly encouraged. Community help is essential for maintaining its quality, and every effort is appreciated.

> [!IMPORTANT]
> Before submitting your contribution, please take a moment and read through the following guidelines.

## 👨‍💻 Repository Setup

This project uses [Bun](https://bun.sh) as a runtime as well as a package manager. It's a modern, fast, and lightweight alternative to [Node.js](https://nodejs.org/en/) and [npm](https://www.npmjs.com/). To install Bun on POSIX systems (like Ubuntu or macOS), run the following command:
This project uses [Bun](https://bun.com) as a runtime as well as a package manager. It's a modern, fast, and lightweight alternative to [Node.js](https://nodejs.org/en/) and [npm](https://www.npmjs.com/). To install Bun on POSIX systems (like Ubuntu or macOS), run the following command:

```sh
curl -fsSL https://bun.sh/install | bash
curl -fsSL https://bun.com/install | bash
```

Otherwise, visit the [Bun installation page](https://bun.sh/docs/installation) for installation options.
Otherwise, visit the [Bun installation page](https://bun.com/docs/installation) for installation options.

## 💡 Commands

Expand All @@ -27,7 +27,7 @@ Build the project for production. The result is under `dist/`.

### `bun check`

We use [Biome](https://biomejs.dev/) for **both linting and formatting**. It is an ultra-fast, Rust based linter and formatter.
Biome is used for **both linting and formatting**. It is an ultra-fast, Rust based linter and formatter.
It also lints JSON.

You can also run `bun fix` to apply any safe fixes automatically.
Expand All @@ -54,7 +54,7 @@ For typo fixes, it's recommended to batch multiple typo fixes into one pull requ

### Pull Request

If you don't know how to send a Pull Request, we recommend reading [the guide](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
If you don't know how to send a Pull Request, it is recommended to read [the guide](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).

If your PR fixes or resolves an existing issue, please add the following line in your PR description according to the following example:

Expand All @@ -75,19 +75,21 @@ Replacing:

This will let GitHub know the issues are linked, and automatically close them once the PR gets merged. Learn more at [the guide](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword).

It's ok to have multiple commits in a single PR, you don't need to rebase or force push for your changes as we will use `Squash and Merge` to squash the commits into one commit when merging.
It's ok to have multiple commits in a single PR; changes do not need to be rebased or force pushed, as Squash and Merge will be used to combine the commits into one when merging.

## 📖 References

### Lint

We use [Biome](https://biomejs.dev/) for both linting and formatting with [a few custom rules](./biome.jsonc). It is an ultra-fast, Rust based linter and formatter.
Biome is used for both linting and formatting with [a few custom rules](./biome.jsonc). It is an ultra-fast, Rust based linter and formatter.

<table><tr><td>

#### IDE Setup

We recommend using [VS Code](https://code.visualstudio.com/) along with the [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome).
[Visual Studio Code](https://code.visualstudio.com/) is recommended for the best experience along with:
- [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome) for linting and formatting.
- [ArkType extension](https://marketplace.visualstudio.com/items?itemName=arktypeio.arkdark) for syntax highlighting and type-safe regex support.

With the settings on the right, you can have auto fix and formatting when you save the code you are editing.

Expand Down
34 changes: 0 additions & 34 deletions GOVERNANCE.md

This file was deleted.

9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@
<img src="apps/www/public/logo-mini.png" alt="Logo for Bedstack RealWorld example" width=200>
<h1>Bedstack</h1>

[![Tests Status](https://github.com/bedtime-coders/bedstack/actions/workflows/tests.yml/badge.svg?event=push&branch=main&)](https://github.com/bedtime-coders/bedstack/actions/workflows/tests.yml?query=branch%3Amain+event%3Apush) [![Discord](https://img.shields.io/discord/1164270344115335320?label=Chat&color=5865f4&logo=discord&labelColor=121214)](https://discord.gg/8UcP9QB5AV) [![License](https://custom-icon-badges.demolab.com/github/license/bedtime-coders/bedstack?label=License&color=blue&logo=law&labelColor=0d1117)](https://github.com/bedtime-coders/bedstack/blob/main/LICENSE) [![Bun](https://img.shields.io/badge/Bun-14151a?logo=bun&logoColor=fbf0df)](https://bun.sh/) [![ElysiaJS](https://custom-icon-badges.demolab.com/badge/ElysiaJS-0f172b.svg?logo=elysia)](https://elysiajs.com/) [![Drizzle](https://img.shields.io/badge/Drizzle-C5F74F?logo=drizzle&logoColor=000)](https://drizzle.team/) [![Biome](https://img.shields.io/badge/Biome-24272f?logo=biome&logoColor=f6f6f9)](https://biomejs.dev/) [![Scalar](https://img.shields.io/badge/Scalar-080808?logo=scalar&logoColor=e7e7e7)](https://scalar.com/) [![Star](https://custom-icon-badges.demolab.com/github/stars/bedtime-coders/bedstack?logo=star&logoColor=373737&label=Star)](https://github.com/bedtime-coders/bedstack/stargazers/)
[![Tests Status](https://github.com/bedtime-coders/bedstack/actions/workflows/tests.yml/badge.svg?event=push&branch=main&)](https://github.com/bedtime-coders/bedstack/actions/workflows/tests.yml?query=branch%3Amain+event%3Apush) [![Discord](https://img.shields.io/discord/1164270344115335320?label=Chat&color=5865f4&logo=discord&labelColor=121214)](https://discord.gg/8UcP9QB5AV) [![License](https://custom-icon-badges.demolab.com/github/license/bedtime-coders/bedstack?label=License&color=blue&logo=law&labelColor=0d1117)](https://github.com/bedtime-coders/bedstack/blob/main/LICENSE) [![Bun](https://img.shields.io/badge/Bun-14151a?logo=bun&logoColor=fbf0df)](https://bun.com/) [![ElysiaJS](https://custom-icon-badges.demolab.com/badge/ElysiaJS-0f172b.svg?logo=elysia)](https://elysiajs.com/) [![Drizzle](https://img.shields.io/badge/Drizzle-C5F74F?logo=drizzle&logoColor=000)](https://drizzle.team/) [![ArkType](https://custom-icon-badges.demolab.com/badge/ArkType-0d1526?logo=arktype2&logoColor=e9eef9)](https://arktype.io/) [![Biome](https://img.shields.io/badge/Biome-24272f?logo=biome&logoColor=f6f6f9)](https://biomejs.dev/) [![Scalar](https://img.shields.io/badge/Scalar-080808?logo=scalar&logoColor=e7e7e7)](https://scalar.com/) [![Star](https://custom-icon-badges.demolab.com/github/stars/bedtime-coders/bedstack?logo=star&logoColor=373737&label=Star)](https://github.com/bedtime-coders/bedstack/stargazers/)

[Bun](https://bun.sh/) + [ElysiaJS](https://elysiajs.com/) + [Drizzle](https://orm.drizzle.team/) = the stack you don't want to sleep on
[Bun](https://bun.com/) + [ElysiaJS](https://elysiajs.com/) + [Drizzle](https://orm.drizzle.team/) = the stack you don't want to sleep on

[bedstack.js.org](https://bedstack.js.org)

</div>

> [!TIP]
> ⚡ **New!** Our Prisma-based alternative to Bedstack was just approved on CodebaseShow. Check it out: [Bepstack](https://github.com/bedtime-coders/bepstack)

> [!TIP]
> ⚡ **New!** We've added support for [Drizzle v1 Beta](https://orm.drizzle.team/roadmap) in _Bedstack (Stripped)_. Check it out: [`drizzle-v1` branch](https://github.com/bedtime-coders/bedstack-stripped/tree/drizzle-v1)
> ⚡ Bedstack supports [Drizzle v1 Beta](https://orm.drizzle.team/roadmap)! Check it out: [`drizzle-v1` branch](https://github.com/bedtime-coders/bedstack-stripped/tree/drizzle-v1)

<br/>
<br/>
Expand Down
8 changes: 4 additions & 4 deletions SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ This article explains where to get help with Bedstack.
Please read through the following guidelines.

> [!WARNING]
> Before participating in our community, please read our
> Before participating in the community, please read the
> [code of conduct](CODE_OF_CONDUCT.md).
> By interacting with this repository, organization, or community you agree to
> abide by its terms.

## Asking quality questions

Questions can go to our [Discord server](https://discord.gg/8UcP9QB5AV) or [GitHub discussions](https://github.com/bedtime-coders/bedstack/discussions).
Questions can go to the [Discord server](https://discord.gg/8UcP9QB5AV) or [GitHub discussions](https://github.com/bedtime-coders/bedstack/discussions).

Help us help you!
Clear questions are easier to answer.
Spend time framing questions and add links and resources.
Spending the extra time up front can help save everyone time in the long run.
Here are some tips:
Expand All @@ -29,7 +29,7 @@ Here are some tips:
* Provide sample code, such as a [CodeSandbox](https://codesandbox.io/) or video, if possible
* Screenshots can help, but if there’s important text such as code or error
messages in them, please also provide those as text
* The more time you put into asking your question, the better we can help you
* The more time put into asking a question, the better the community can provide assistance

## Contributions

Expand Down
2 changes: 1 addition & 1 deletion apps/conduit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<img src="../www/public/logo-mini.png" alt="Logo for Bedstack RealWorld example" width=200>
<h1>Conduit - Bedstack real world example</h1>

[![Tests Status](https://github.com/bedtime-coders/bedstack/actions/workflows/tests.yml/badge.svg?event=push&branch=main&)](https://github.com/bedtime-coders/bedstack/actions/workflows/tests.yml?query=branch%3Amain+event%3Apush) [![Discord](https://img.shields.io/discord/1164270344115335320?label=Chat&color=5865f4&logo=discord&labelColor=121214)](https://discord.gg/8UcP9QB5AV) [![License](https://custom-icon-badges.demolab.com/github/license/bedtime-coders/bedstack?label=License&color=blue&logo=law&labelColor=0d1117)](https://github.com/bedtime-coders/bedstack/blob/main/LICENSE) [![Bun](https://img.shields.io/badge/Bun-14151a?logo=bun&logoColor=fbf0df)](https://bun.sh/) [![ElysiaJS](https://custom-icon-badges.demolab.com/badge/ElysiaJS-0f172b.svg?logo=elysia)](https://elysiajs.com/) [![Drizzle](https://img.shields.io/badge/Drizzle-C5F74F?logo=drizzle&logoColor=000)](https://orm.drizzle.team/) [![Biome](https://img.shields.io/badge/Biome-24272f?logo=biome&logoColor=f6f6f9)](https://biomejs.dev/) [![Scalar](https://img.shields.io/badge/Scalar-080808?logo=scalar&logoColor=e7e7e7)](https://scalar.com/) [![Star](https://custom-icon-badges.demolab.com/github/stars/bedtime-coders/bedstack?logo=star&logoColor=373737&label=Star)](https://github.com/bedtime-coders/bedstack/stargazers/)
[![Tests Status](https://github.com/bedtime-coders/bedstack/actions/workflows/tests.yml/badge.svg?event=push&branch=main&)](https://github.com/bedtime-coders/bedstack/actions/workflows/tests.yml?query=branch%3Amain+event%3Apush) [![Discord](https://img.shields.io/discord/1164270344115335320?label=Chat&color=5865f4&logo=discord&labelColor=121214)](https://discord.gg/8UcP9QB5AV) [![License](https://custom-icon-badges.demolab.com/github/license/bedtime-coders/bedstack?label=License&color=blue&logo=law&labelColor=0d1117)](https://github.com/bedtime-coders/bedstack/blob/main/LICENSE) [![Bun](https://img.shields.io/badge/Bun-14151a?logo=bun&logoColor=fbf0df)](https://bun.com/) [![ElysiaJS](https://custom-icon-badges.demolab.com/badge/ElysiaJS-0f172b.svg?logo=elysia)](https://elysiajs.com/) [![Drizzle](https://img.shields.io/badge/Drizzle-C5F74F?logo=drizzle&logoColor=000)](https://orm.drizzle.team/) [![Biome](https://img.shields.io/badge/Biome-24272f?logo=biome&logoColor=f6f6f9)](https://biomejs.dev/) [![Scalar](https://img.shields.io/badge/Scalar-080808?logo=scalar&logoColor=e7e7e7)](https://scalar.com/) [![Star](https://custom-icon-badges.demolab.com/github/stars/bedtime-coders/bedstack?logo=star&logoColor=373737&label=Star)](https://github.com/bedtime-coders/bedstack/stargazers/)

[RealWorld](https://realworld-docs.netlify.app/) example app for [Bedstack](https://bedstack.js.org/)
</div>
Expand Down
6 changes: 2 additions & 4 deletions apps/conduit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
"@elysiajs/bearer": "^1.4.2",
"@elysiajs/jwt": "^1.4.0",
"@elysiajs/swagger": "^1.3.1",
"@sinclair/typebox": "0.34.47",
"@yolk-oss/elysia-env": "^3.0.0",
"arkregex": "0.0.5",
"arktype": "^2.1.29",
"chalk": "^5.6.2",
"drizzle-orm": "^0.45.1",
"elysia": "^1.4.21",
Expand All @@ -54,8 +55,5 @@
"drizzle-seed": "^0.3.1",
"pg": "^8.16.3",
"typescript": "catalog:"
},
"overrides": {
"@sinclair/typebox": "0.34.34"
}
}
2 changes: 1 addition & 1 deletion apps/conduit/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const setupApp = () => {
set.status = error.status;
return pick(error, ['errors']);
}
// Elysia validation errors (TypeBox based)
// Elysia validation errors (ArkType based)
if (error instanceof ValidationError) {
return formatValidationError(error);
}
Expand Down
7 changes: 3 additions & 4 deletions apps/conduit/src/articles/articles.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Elysia, t } from 'elysia';
import { type } from 'arktype';
import { Elysia } from 'elysia';
import { StatusCodes } from 'http-status-codes';
import { setupArticles } from '@/articles/articles.module';
import { DEFAULT_LIMIT, DEFAULT_OFFSET } from '@/shared/constants';
Expand Down Expand Up @@ -173,9 +174,7 @@ export const articlesController = new Elysia().use(setupArticles).group(
{
beforeHandle: app.store.authService.requireLogin,
response: {
[StatusCodes.NO_CONTENT]: t.Void({
description: 'No content',
}),
[StatusCodes.NO_CONTENT]: type('undefined'),
},
detail: {
summary: 'Delete Article',
Expand Down
23 changes: 5 additions & 18 deletions apps/conduit/src/articles/dto/article-feed-query.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { t } from 'elysia';
import { type } from 'arktype';
import {
DEFAULT_LIMIT,
DEFAULT_OFFSET,
Expand All @@ -13,22 +13,9 @@ import {
* - limit: number of items per request (default: DEFAULT_LIMIT, min: MIN_LIMIT, max: MAX_LIMIT)
* - offset: number of items to skip (default: DEFAULT_OFFSET, min: MIN_OFFSET)
*/
export const ArticleFeedQueryDto = t.Object({
limit: t.Optional(
t.Integer({
minimum: MIN_LIMIT,
maximum: MAX_LIMIT,
default: DEFAULT_LIMIT,
description: `Number of items per request (between ${MIN_LIMIT} and ${MAX_LIMIT}, defaults to ${DEFAULT_LIMIT})`,
}),
),
offset: t.Optional(
t.Integer({
minimum: MIN_OFFSET,
default: DEFAULT_OFFSET,
description: `Number of items to skip (at least ${MIN_OFFSET}, defaults to ${DEFAULT_OFFSET})`,
}),
),
export const ArticleFeedQueryDto = type({
limit: `${MIN_LIMIT} <= number.integer <= ${MAX_LIMIT} = ${DEFAULT_LIMIT}`,
offset: `number.integer >= ${MIN_OFFSET} = ${DEFAULT_OFFSET}`,
});

export type ArticleFeedQueryDto = typeof ArticleFeedQueryDto.static;
export type ArticleFeedQueryDto = typeof ArticleFeedQueryDto.infer;
Loading