Skip to content
Merged
Show file tree
Hide file tree
Changes from 158 commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
01cfd8e
refactor(articles): reorganize files and add architecture documentation
yamcodes Apr 17, 2025
3903bfe
Refactor articles and comments modules with schema and DTO separation
yamcodes Apr 17, 2025
6562e21
feat: add article mappers and domain interfaces, update architecture …
yamcodes Apr 19, 2025
da9309a
Add project structure docs and fix broken markdown link
yamcodes Apr 19, 2025
3948808
Add architecture diagram showing layer relationships and data flow
yamcodes Apr 19, 2025
d63fe60
refactor: consolidate article mappers and rename ArticleInDb to Artic…
yamcodes Apr 19, 2025
52cff00
Add ArticleDto schema with type validation for article data
yamcodes Apr 19, 2025
673bf6e
Reorder imports alphabetically across multiple files
yamcodes Apr 19, 2025
c75a113
Consolidate article schemas and add body field to article interface
yamcodes Apr 19, 2025
ace8438
Fix import order and reorganize imports in articles schema
yamcodes Apr 19, 2025
07d04ca
refactor: reorganize articles module and improve type safety
yamcodes Apr 19, 2025
87f3064
Refactor articles service to separate query params from options, fix …
yamcodes Apr 19, 2025
f65bb7e
refactor: improve articles feed filtering and add followed users lookup
yamcodes Apr 19, 2025
c3672aa
Refactor article response mapping and add domain model transformation
yamcodes Apr 19, 2025
07f0cb4
Refactor feed endpoint to handle pagination and add article response …
yamcodes Apr 19, 2025
61c7be5
refactor: replace toResponse with toDomain and fix author id access
yamcodes Apr 19, 2025
05a02a6
Add delete article endpoint and improve response handling in article …
yamcodes Apr 19, 2025
c119d2d
Merge branch 'main' into layered
yamcodes Jun 6, 2025
2a0352d
chore: update bun.lockb to reflect dependency changes
yamcodes Jun 6, 2025
86c3daf
chore: update bun.lockb to synchronize with dependency changes
yamcodes Jun 6, 2025
e7e810a
docs: update architecture documentation for clarity and formatting im…
yamcodes Jun 6, 2025
6b0d502
docs: enhance architecture documentation with clearer type convention…
yamcodes Jun 6, 2025
76889ad
refactor: streamline article response structure and enhance service m…
yamcodes Jun 6, 2025
752dff7
refactor: update article response mapping and enhance DTO exports
yamcodes Jun 6, 2025
ffe58a0
refactor: update article imports and enhance comment repository type …
yamcodes Jun 7, 2025
49f999f
refactor: update summary descriptions for articles, tags, and users
yamcodes Jun 7, 2025
7337557
refactor: reorganize article creation endpoint in articles controller
yamcodes Jun 7, 2025
c31c49c
refactor: update article feed query handling and remove unused DTO
yamcodes Jun 7, 2025
5b4fc90
fix: correct spelling of 'Registeration' to 'Registration' in users p…
yamcodes Jun 7, 2025
1fe5c27
feat: enhance articles endpoint description for clarity
yamcodes Jun 7, 2025
e46f93b
refactor: improve articles controller and DTO structure
yamcodes Jun 7, 2025
b4cb3d2
refactor: improve article domain mapping and tag handling
yamcodes Jun 7, 2025
d0fed98
refactor: optimize tag handling and article domain mapping
yamcodes Jun 7, 2025
f4426b0
refactor: update comment response structure and remove article mapping
yamcodes Jun 7, 2025
2cd3563
refactor: improve find method parameter handling in ArticlesRepository
yamcodes Jun 7, 2025
05b3823
refactor: streamline article query handling in ArticlesRepository
yamcodes Jun 7, 2025
64347a2
feat: enhance error handling and article slug generation
yamcodes Jun 7, 2025
8379741
refactor: improve follow/unfollow user functionality in profiles service
yamcodes Jun 7, 2025
031803b
refactor: improve follow/unfollow logic in profiles service
yamcodes Jun 7, 2025
3bae8b0
refactor: remove unnecessary logging in error handling
yamcodes Jun 7, 2025
cf7ca8e
refactor: enhance error handling in profiles service
yamcodes Jun 7, 2025
69fc970
refactor: update import paths and clean up article feed interface
yamcodes Jun 7, 2025
44bfb20
refactor: restore CommentsRepository and CommentsService imports in a…
yamcodes Jun 7, 2025
0f37339
refactor: update comment handling and type definitions
yamcodes Jun 7, 2025
5538df8
refactor: update article-feed-row interface to use ProfileFeed type
yamcodes Jun 7, 2025
fea27e6
Update src/errors.ts
yamcodes Jun 7, 2025
88f1cea
refactor: update error message in unfollow user logic
yamcodes Jun 7, 2025
8aaf4a6
refactor: simplify ProfilesService and remove UsersRepository dependency
yamcodes Jun 7, 2025
636614a
refactor: add TODO comment for future refactoring in generateProfileR…
yamcodes Jun 7, 2025
0212a89
refactor: enforce minimum length for tagList items in article DTOs
yamcodes Jun 7, 2025
50a52fb
refactor: update comments schema to improve data integrity and import…
yamcodes Jun 7, 2025
680038b
refactor: simplify ProfilesService initialization in articles module
yamcodes Jun 7, 2025
59bd5a7
refactor: update articles schema to include comments import
yamcodes Jun 7, 2025
b8ab437
refactor: update error messages in article creation and update methods
yamcodes Jun 7, 2025
a3b1d2b
refactor: remove unused slug generation methods from ArticlesRepository
yamcodes Jun 7, 2025
29e4cbd
feat: implement unique slug generation for articles
yamcodes Jun 7, 2025
6eaa6f1
refactor: enhance article creation and update methods
yamcodes Jun 7, 2025
897e395
refactor: add TODO comments for race condition handling in article me…
yamcodes Jun 7, 2025
e065c53
feat: enhance article filtering capabilities in repository
yamcodes Jun 7, 2025
edf6f2e
refactor: enforce minimum length for optional fields in ListArticlesQ…
yamcodes Jun 7, 2025
2b0d57c
refactor: update import paths for articles schema
yamcodes Jun 7, 2025
af86d2e
docs: update architecture and project structure documentation
yamcodes Jun 7, 2025
45e2957
docs: improve project structure documentation formatting
yamcodes Jun 7, 2025
239e7c4
docs: refine architecture and project structure documentation
yamcodes Jun 7, 2025
a741161
refactor: update comments schema and related imports
yamcodes Jun 8, 2025
aab8c39
feat: integrate comments controller into app module and enhance docum…
yamcodes Jun 8, 2025
cd7c66c
refactor: replace outdated comment DTOs with new interfaces
yamcodes Jun 8, 2025
ef3c2b2
refactor: streamline comments module and remove unused mappers
yamcodes Jun 8, 2025
c62c736
refactor: consolidate article mappers and update import paths
yamcodes Jun 8, 2025
64ab5be
refactor: enhance comment mapping functionality and update imports
yamcodes Jun 8, 2025
a5ed353
refactor: standardize import paths across article-related files
yamcodes Jun 8, 2025
844ae66
refactor: restructure tags model and schema for improved organization
yamcodes Jun 8, 2025
a4e6400
refactor: update tags repository to improve type safety and organization
yamcodes Jun 8, 2025
d219c32
refactor: reorganize tags service methods for improved clarity and ty…
yamcodes Jun 8, 2025
fcdfd32
refactor: simplify tags plugin integration by using tags controller
yamcodes Jun 8, 2025
32aad7b
refactor: update tags module structure and remove obsolete plugin
yamcodes Jun 8, 2025
ee8b3c3
refactor: update tags schema import for consistency
yamcodes Jun 8, 2025
95ec927
refactor: update import paths for consistency and clarity
yamcodes Jun 8, 2025
3bbe120
refactor: update tags module for improved type safety and clarity
yamcodes Jun 8, 2025
e3274be
refactor: rename tag retrieval methods for consistency and clarity
yamcodes Jun 8, 2025
442979a
refactor: update tags schema and remove obsolete DTOs
yamcodes Jun 8, 2025
2c84844
refactor: update tags controller response description for clarity
yamcodes Jun 8, 2025
edd6563
refactor: enhance tags service and controller for improved type safet…
yamcodes Jun 8, 2025
30cf1ec
refactor: update tags response handling and type definitions
yamcodes Jun 8, 2025
bb24fe4
refactor: streamline tags response handling and improve type definitions
yamcodes Jun 8, 2025
c2c6917
fix: correct typo in articles controller response description and rem…
yamcodes Jun 8, 2025
a5ffc33
refactor: enhance comments module with article and tag services integ…
yamcodes Jun 8, 2025
444b4d0
refactor: update comment deletion logic and parameter validation
yamcodes Jun 8, 2025
a2cf974
refactor: optimize article filtering logic in repository
yamcodes Jun 8, 2025
74533af
refactor: optimize favorited and following checks in mappers
yamcodes Jun 8, 2025
a629b38
refactor: update comments schema to use integer type for IDs
yamcodes Jun 8, 2025
5bf0f02
Merge branch 'layered-phase2-comments' into layered-phase3-tags
yamcodes Jun 8, 2025
40d61fe
Merge branch 'layered-phase1-articles' into layered-phase2-comments
yamcodes Jun 8, 2025
5aeade0
Merge branch 'layered-phase2-comments' into layered-phase3-tags
yamcodes Jun 8, 2025
ca09117
refactor: enhance comments module with article and tag services integ…
yamcodes Jun 8, 2025
163087d
refactor: update comment deletion logic and parameter validation
yamcodes Jun 8, 2025
7d6ce10
refactor: optimize favorited and following checks in mappers
yamcodes Jun 8, 2025
e91951e
refactor: update comments schema to use integer type for IDs
yamcodes Jun 8, 2025
14d7690
refactor: optimize article filtering logic in repository
yamcodes Jun 8, 2025
aa130a2
refactor: update tags schema and repository for improved consistency
yamcodes Jun 8, 2025
bad5d7a
refactor: update import paths for tags schema consistency
yamcodes Jun 8, 2025
33f3098
refactor: update tags repository to use new interfaces for improved t…
yamcodes Jun 8, 2025
c06c72c
refactor: enhance user DTOs with static type definitions
yamcodes Jun 8, 2025
5d16f70
refactor: streamline user DTOs with enhanced type definitions
yamcodes Jun 8, 2025
df8c834
refactor: simplify user interfaces and enhance type definitions
yamcodes Jun 8, 2025
1987cbc
refactor: restructure user-related modules and DTOs for improved clarity
yamcodes Jun 8, 2025
e37e3c2
refactor: update tags module for improved structure and type safety
yamcodes Jun 8, 2025
0eeb0f7
Merge branch 'layered-phase3-tags' into layered-phase4-users
yamcodes Jun 8, 2025
44f132b
refactor: enhance user service and mappers for improved token handlin…
yamcodes Jun 8, 2025
b51f270
refactor: simplify user response DTO and mapper for improved structure
yamcodes Jun 8, 2025
104ac1c
refactor: enhance user response handling with improved type safety an…
yamcodes Jun 8, 2025
79de450
refactor: enhance user DTOs with improved validation and structure
yamcodes Jun 8, 2025
116f75d
refactor: enhance LoginUserDto with improved email validation
yamcodes Jun 8, 2025
2e2400c
refactor: simplify user interface definitions by removing unused IUse…
yamcodes Jun 8, 2025
f4f8512
refactor: update user DTOs and mappers for improved structure and con…
yamcodes Jun 8, 2025
9c0474a
refactor: improve UpdateUserDto mapper for better handling of undefin…
yamcodes Jun 8, 2025
e40034b
Merge branch 'layered-phase4-users' into layered-phase5-profiles
yamcodes Jun 8, 2025
2a0f8f4
refactor: enhance user DTOs and mappers for improved handling of opti…
yamcodes Jun 8, 2025
470f46b
refactor: remove unused Profile schema to streamline profiles management
yamcodes Jun 8, 2025
1fb7c04
refactor: update ProfilesRepository and DTOs for improved type safety…
yamcodes Jun 8, 2025
739790a
refactor: update profiles service and plugin for improved profile han…
yamcodes Jun 8, 2025
cf1a53d
refactor: replace profiles plugin with profiles controller for improv…
yamcodes Jun 8, 2025
4f540d6
refactor: correct variable naming in profiles module for clarity
yamcodes Jun 8, 2025
1be9dcd
refactor: update profile endpoint descriptions for clarity
yamcodes Jun 8, 2025
b8cedff
refactor: migrate user model imports to schema for improved consistency
yamcodes Jun 8, 2025
bd22d96
refactor: migrate user model imports to schema for improved consistency
yamcodes Jun 8, 2025
7c11b5a
refactor: remove legacy user schema to streamline user management
yamcodes Jun 8, 2025
bcd2cd9
refactor: standardize user schema imports across the codebase
yamcodes Jun 8, 2025
0105734
refactor: update token generation to use new user schema type
yamcodes Jun 8, 2025
be8d485
refactor: migrate user model imports to schema for improved consistency
yamcodes Jun 8, 2025
97c2756
refactor: streamline article tag imports for improved clarity
yamcodes Jun 8, 2025
a52f61b
refactor: update article-row interface to use ArticleTagRow for impro…
yamcodes Jun 8, 2025
50b8ca6
refactor: update user schema imports for consistency across files
yamcodes Jun 8, 2025
6d62e29
feat: enhance shared utilities and error handling
yamcodes Jun 8, 2025
e3926a0
refactor: update error handling imports and restructure error files
yamcodes Jun 8, 2025
5d553b9
refactor: reorganize error imports for consistency across modules
yamcodes Jun 8, 2025
4edf255
refactor: update author profile retrieval in comments service for imp…
yamcodes Jun 8, 2025
786cff2
Merge branch 'layered-phase5-profiles' into layered-phase6-misc
yamcodes Jun 8, 2025
64aa2f7
refactor: update error imports in comments service for consistency
yamcodes Jun 8, 2025
639f04b
refactor: replace pagination constants and remove unused files
yamcodes Jun 10, 2025
4e868c2
refactor: simplify database configuration and update project structure
yamcodes Jun 10, 2025
65ded52
refactor: update project structure and remove obsolete database files
yamcodes Jun 10, 2025
1e2cda7
refactor: update PROJECT_STRUCTURE.md for resource module clarity
yamcodes Jun 10, 2025
947ba13
refactor: update project structure and configuration management
yamcodes Jun 10, 2025
c3aa4ac
refactor: reorganize database provider structure and update import paths
yamcodes Jun 10, 2025
8d69612
refactor: rename shared directory to common and update import paths
yamcodes Jun 10, 2025
7775c4d
refactor: update error handling and remove obsolete error classes
yamcodes Jun 10, 2025
399613a
refactor: enhance error handling and introduce default error message
yamcodes Jun 10, 2025
c0ad8cc
refactor: enhance error handling and update user DTO descriptions
yamcodes Jun 10, 2025
68498a9
refactor: update documentation and improve project structure
yamcodes Jun 10, 2025
b142b12
refactor: clarify project structure in documentation
yamcodes Jun 10, 2025
6ef8cd7
refactor: enhance error handling and standardize not found messages
yamcodes Jun 10, 2025
2c41267
refactor: enhance error handling in CommentsService and app.module.ts
yamcodes Jun 10, 2025
a649dd5
refactor: improve error handling in ArticlesService
yamcodes Jun 10, 2025
1f15549
refactor: improve error handling in app.module.ts
yamcodes Jun 10, 2025
a1e231d
refactor: standardize error handling across services
yamcodes Jun 10, 2025
76d8936
refactor: enhance RealWorldError implementation for improved clarity
yamcodes Jun 11, 2025
c44f77c
refactor: update ArticleFeedQueryDto to use Integer type for limit an…
yamcodes Jun 11, 2025
304e1cf
refactor: update TypeScript interfaces and add type checking script
yamcodes Jun 11, 2025
2c075b7
refactor: update author structure in toResponse mapper for improved c…
yamcodes Jun 11, 2025
486c6a4
refactor: enhance isHttpError function for improved type checking
yamcodes Jun 11, 2025
dd35f04
chore: update dependencies and VSCode settings
yamcodes Jun 11, 2025
81351b2
chore: downgrade TypeScript version in package.json and update bun.lockb
yamcodes Jun 11, 2025
ad0e242
refactor: update drizzle configuration and commands for improved stru…
yamcodes Jun 11, 2025
83fe14d
chore: update TypeScript version and bun.lockb for dependency alignment
yamcodes Jun 11, 2025
9efe685
refactor: enhance follower check with explicit type definition for cl…
yamcodes Jun 8, 2025
809e938
refactor: update user service and mappers for improved input handling…
yamcodes Jun 11, 2025
5c107f4
refactor: remove unused user input interfaces for improved clarity
yamcodes Jun 11, 2025
e719e8d
refactor: streamline imports in article-row and profiles repository f…
yamcodes Jun 11, 2025
8738671
refactor: remove legacy profile and user schemas for improved clarity
yamcodes Jun 11, 2025
4524efa
refactor: remove duplicate import of ProfileRow for improved clarity
yamcodes Jun 11, 2025
a109eff
refactor: improve error message structure in user authentication for …
yamcodes Jun 11, 2025
69a797a
refactor: enhance user creation and update logic with email and usern…
yamcodes Jun 11, 2025
2a185cf
refactor: enhance article filtering logic with improved followed auth…
yamcodes Jun 11, 2025
0b2e3c3
refactor: improve article filtering logic with explicit undefined checks
yamcodes Jun 11, 2025
493c213
refactor: update error handling in authentication and error utilities
yamcodes Jun 11, 2025
decaac9
refactor: update user schema and mappers for improved null handling (…
yamcodes Jun 13, 2025
d536ceb
Better status codes (#176)
yamcodes Jun 13, 2025
2b5f986
`"noUncheckedIndexedAccess": true` (#182)
yamcodes Jun 13, 2025
7aee1eb
Refactor deletions (#181)
yamcodes Jun 13, 2025
c05fb59
Infer rows (#183)
yamcodes Jun 14, 2025
c8e53a5
Elysia.t (#184)
yamcodes Jun 14, 2025
835e40f
Fix typo in articles controller and simplify author response mapping …
yamcodes Jun 20, 2025
5879ee4
Merge
yamcodes Jun 20, 2025
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
9 changes: 9 additions & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
tmp
2 changes: 2 additions & 0 deletions .trunk/configs/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Prettier friendly markdownlint config (all formatting rules disabled)
extends: markdownlint/style/prettier
7 changes: 7 additions & 0 deletions .trunk/configs/.shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enable=all
source-path=SCRIPTDIR
disable=SC2154

# If you're having issues with shellcheck following source, disable the errors via:
# disable=SC1090
# disable=SC1091
7 changes: 7 additions & 0 deletions .trunk/configs/.yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ["{|}"]
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
14 changes: 14 additions & 0 deletions .trunk/configs/svgo.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default {
plugins: [
{
name: "preset-default",
params: {
overrides: {
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
sortAttrs: true,
removeOffCanvasPaths: true,
},
},
},
],
};
39 changes: 39 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.22.11
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.7.0
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- go@1.21.0
- node@22.16.0
- python@3.10.8
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
enabled:
- actionlint@1.7.7
- biome@1.9.4
- checkov@3.2.437
- git-diff-check
- markdownlint@0.45.0
- oxipng@9.1.5
- prettier@3.5.3
- shellcheck@0.10.0
- shfmt@3.6.0
- svgo@3.3.2
- trufflehog@3.88.35
- yamllint@1.37.1
actions:
disabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
enabled:
- trunk-upgrade-available
161 changes: 161 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Architecture

## Overview

This service uses a modular **Layered Architecture** inspired by the [NestJS philosophy](https://docs.nestjs.com/#philosophy). We favor **separation of concerns** over minimalism to maintain clear boundaries between different parts of the system.

We separate the system into 3 main layers:

1. **Controller** – Talks to the client
2. **Service** – Handles the business logic
3. **Repository** – Interacts with the database

Each domain feature (e.g. `articles`, `profiles`, `tags`) is isolated into its own module, containing these layers plus:

- **Mapper** - Transforms data between layers
- **Schema** - Defines database tables and relations

```mermaid
graph TD
subgraph Controller Layer
C1[articles.controller.ts]
C2[comments.controller.ts]
C3[tags.controller.ts]
end

subgraph Service Layer
S1[articles.service.ts]
S2[comments.service.ts]
S3[tags.service.ts]
end

subgraph Repository Layer
R1[articles.repository.ts]
R2[comments.repository.ts]
R3[tags.repository.ts]
end

subgraph Schema Layer
SC1[articles.schema.ts]
SC2[comments.schema.ts]
SC3[tags.schema.ts]
SC4[article-tags.schema.ts]
end

subgraph Mapper Layer
M1[articles.mapper.ts]
M2[comments.mapper.ts]
M3[tags.mapper.ts]
end

C1 --> S1 --> R1 --> SC1
C2 --> S2 --> R2 --> SC2
C3 --> S3 --> R3 --> SC3

S1 --> M1
S2 --> M2
S3 --> M3

SC1 --> SC4
SC3 --> SC4
```

## Layer Responsibilities

### 1. Controller Layer (Client-facing)

- Receives data from the client (DTO)
- Returns data to the client (DTO)
- Validates data types
- Calls the service layer
- Can shape requests and responses, without performing any business logic

### 2. Service Layer (Business Logic)

- Contains the business logic
- Can perform any kind of calculation or transformation as long as it's part of the business rules
- Validates logic rules (e.g., checking if a user can register)
- Handles errors and logging
- Calls the repository layer to get or save data
- Can receive controller-level DTOs, but must map or validate them before passing data to the repository

### 3. Repository Layer (Database Access)

- Talks to the database
- Only responsible for saving and retrieving data
- **No** assumptions about validation
- **No** business logic should go here
- Handles pagination, sorting, and other database-specific operations
- Returns raw database rows, not domain entities

### Additional Layers

#### Mapper (Data Transformation)

- Transforms Row types from the database to domain entities or DTOs
- Performs camelCase vs. snake_case mapping if needed
- Converts Date to ISO strings for output, etc.

#### Schema (Database Definitions)

- Defines schemas using an ORM (e.g. `pgTable()` with Drizzle ORM and PostgreSQL)
- Optionally defines table relations (e.g. `relations()` with Drizzle ORM)

## Type Design Principles

1. **Interfaces vs Classes**:

- Use interfaces (`IUser`) to define contracts between layers
- Use classes (`User`) for concrete implementations. The (database) entity is a concrete implementation of the interface.
- This separation allows for better testing and flexibility

2. **Canonical Forms**:

- Store canonical forms in the database (e.g., `birthdate`)
- The canonical form is represented in the entity (`User`) _and_ the interface (`IUser`)
- The DTO might use a different form, e.g. `CreateUserDto` might use `age` instead of `birthdate`
- Use mappers to convert between forms

3. **System vs Domain Properties**:
- System properties (`id`, `createdAt`, `updatedAt`) are managed by the base entity
- Domain properties (e.g. `email`, `name`) are defined in the interface, enforced by the entity, and controlled by the DTOs

## Examples

### Example 1: Can register?

```typescript
canRegister(user: Partial<IUser>) {
if (user.email.endsWith('@banned.com')) {
throw new ForbiddenException('Email domain is not allowed');
}

if (!this.isOldEnough(user.birthdate)) {
throw new ForbiddenException('User must be at least 13 years old');
}
}
```

This check lives in the service layer because:

- It's business logic
- It could change based on product decisions
- It might be reused across different controllers (`signup`, `adminCreateUser`, etc.)
- If tomorrow we add GraphQL on top of our REST, this logic will remain the same

### Example 2: Normalize email

```typescript
normalizeEmail(email: string) {
return email.toLowerCase().trim();
}
```

Also clearly service-level: it's a standardized rule, not controller-specific logic.

## See also

- More on **Project structure** - see [Project Structure](PROJECT_STRUCTURE.md)
- **Contributing** - see [Developer's Guide](CONTRIBUTING.md)
- **API Documentation** - see [RealWorld Backend Specifications](https://realworld-docs.netlify.app/specifications/backend/introduction/)
- **Drizzle ORM Documentation** - see [Drizzle ORM](https://orm.drizzle.team/)
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
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,
- 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,
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 us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
13 changes: 7 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Hey there! We're thrilled that you'd like to contribute to this project. Your he

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:

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

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

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.
We use [Biome](https://biomejs.dev/) 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 Down Expand Up @@ -69,8 +69,9 @@ Where the template is:
```

Replacing:
* `<keyword>` with one of `close`, `closes`, `closed`, `fix`, `fixes`, `fixed`, `resolve`, `resolves`, `resolved`
* `<issue-number>`: the issue number you are fixing

- `<keyword>` with one of `close`, `closes`, `closed`, `fix`, `fixes`, `fixed`, `resolve`, `resolves`, `resolved`
- `<issue-number>`: the issue number you are fixing

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).

Expand Down
28 changes: 14 additions & 14 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@

To understand the scope of this document, please read:

* [*What is governance?* by Adobe](https://github.com/adobe/open-development-template/blob/master/Governance.md#meritocracy)
* [*Jenkins Governance Document* for an inspiration](https://www.jenkins.io/project/governance/)
- [_What is governance?_ by Adobe](https://github.com/adobe/open-development-template/blob/master/Governance.md#meritocracy)
- [_Jenkins Governance Document_ for an inspiration](https://www.jenkins.io/project/governance/)

## Who we are

We are a group of open-source developers who develop, use, promote the Elysia RealWorld example app, software around it, and other related activities for our mutual benefit.

## Core Philosophy

* **Lower barrier to entry**
- **Lower barrier to entry**

Everyone is welcome to contribute, regardless of their background, experience, or identity. We value all contributions, and we are committed to providing a friendly, safe, and welcoming environment for all. Everyone gets a voice, and everyone is listened to.
Everyone is welcome to contribute, regardless of their background, experience, or identity. We value all contributions, and we are committed to providing a friendly, safe, and welcoming environment for all. Everyone gets a voice, and everyone is listened to.

* **Seeking consensus**
- **Seeking consensus**

We seek consensus among contributors, and we are open to new ideas and approaches. When consensus cannot be reached after giving the stage to all parties, we will use a majority-wins voting process. We will strive to resolve conflicts in a constructive manner.
We seek consensus among contributors, and we are open to new ideas and approaches. When consensus cannot be reached after giving the stage to all parties, we will use a majority-wins voting process. We will strive to resolve conflicts in a constructive manner.

* **Meritocracy**
- **Meritocracy**

We value contributions based on their technical merit, and we welcome new contributors based on their demonstrated ability to contribute. Valuable contributers will be granted access to private channels and will be able to participate in the decision-making process.

* **Transparency**

While the decision-making process is not always public, the results of the decision making process must be public. Decisions will be made after thoughtful consideration of the community's input through [Discord](https://discord.gg/8UcP9QB5AV) and [GitHub Discussions](https://github.com/agnyz/bedstack/discussions).
We value contributions based on their technical merit, and we welcome new contributors based on their demonstrated ability to contribute. Valuable contributers will be granted access to private channels and will be able to participate in the decision-making process.

* **Automation**
- **Transparency**

We rely on automation to make our processes more efficient and to reduce the burden on contributors. We will automate as much as possible, and we will strive to make our automation tools accessible to all contributors. The goal is to abstract away the mundane tasks and let contributors focus on the fun stuff.
While the decision-making process is not always public, the results of the decision making process must be public. Decisions will be made after thoughtful consideration of the community's input through [Discord](https://discord.gg/8UcP9QB5AV) and [GitHub Discussions](https://github.com/agnyz/bedstack/discussions).

- **Automation**

We rely on automation to make our processes more efficient and to reduce the burden on contributors. We will automate as much as possible, and we will strive to make our automation tools accessible to all contributors. The goal is to abstract away the mundane tasks and let contributors focus on the fun stuff.
Loading