Mariusz

@bmariusz@techhub.social
3 Followers
22 Following
18 Posts

🧠 25+ years in IT
πŸ› οΈ Architecture, code, automation, integration
πŸ‘¨β€πŸ’» Building something big in TypeScript
πŸ”· TypeScript, Next.js, human-friendly JSON
🍲 Soup is a lifestyle
🎸 Bass guitar β€” the DevOps of music: no one notices until it's gone

(https://bmariusz.writeas.com)

Pixelfedbmariusz@pixelfed.sdf.org
Blueskyβ€ͺ@bmariusz.bsky.social‬
Twitter/Xdeleted
Write.asbmariusz.writeas.com

Day 8
TL;DR: Yesterday I took a break. Today I’m back – and permissions are under control :)
Spent the day designing a fine-grained permission model.
I now support 96 distinct permissions across 8 modules, 4 CRUD operations, and 3 scopes: self, group, global.
Three system roles bind these into meaningful sets:
admin: full global access (32 permissions)
supervisor: read self + full group scope (32)
employee: read/update self only (16)

That's 80 role-permission bindings total. Uff.

https://write.as/bmariusz/designing-a-scalable-permission-model

#sql #Microservices #monorepo #rbac #codingdays #programming #accessManagement

Day#8 πŸ“Š Designing a Scalable Permission Model

Yesterday I took a break. Today I’m back – and permissions are under control, I hope. I’ve implemented a structured permission model tha...

Mariusz Balewski

Day 7
βœ… 24 test suites, 153 tests passing.

Solid coverage across service and controller layers in my modular monorepo. Strict typing (TypeScript), full DTO validation, and realistic mocks across complex relations (TypeORM).

Next: fine-tuning error handling & exploring e2e strategies.

https://write.as/bmariusz/24-test-suites-153-tests-passing-scaling-confidence-with-every-assertion

#TypeScript #NestJS #Nextjs #InsuranceTech #Microservices #monorepo #rbac #codingdays #swagger #jwt #jwt_auth #programming

Day#7: 24 Test Suites, 153 Tests Passing β€” Scaling Confidence with Every Assertion

After several days of shaping a growing service architecture, I've finally reached a point where 24 test suites and 153 individual tests ...

Mariusz Balewski

Day 6
TL;DR: Groups, memberships, hierarchy β€” all dynamic now.

Released backend v0.3.0 πŸŽ‰

βœ… Users can belong to multiple groups with typed roles
βœ… Groups can form hierarchical or overlapping structures
βœ… Roles are normalized via reference types

Built with NestJS + TypeORM. Documented via Swagger.

https://write.as/bmariusz/building-a-flexible-group-structure-with-nestjs-and-typeorm

#TypeScript #NestJS #Nextjs #InsuranceTech #Microservices #monorepo #rbac #codingdays #swagger #jwt #jwt_auth #programming

Building a Flexible Group Structure with NestJS and TypeORM

TL;DR: I introduced a generic group model into the backend to handle dynamic user-to-organization assignments and relationships. Users ca...

Mariusz Balewski

Day 5
TL;DR: Continued work on backend security β€” role-based access is now fully wired up.

βœ… Got fine-grained role-based access control fully working today.

β€’ Roles loaded from PostgreSQL
β€’ Injected into JWT during login
β€’ Validated via custom `@Roles()` + `RolesGuard`
β€’ Authenticated via `@UseGuards(JwtAuthGuard)` globally
β€’ Introduced `@Public()` decorator to bypass guards for public endpoints
β€’ Swagger supports Bearer token for testing

Took a while to get the role propagation into the token right β€” the key was enriching the `validateUser()` result, not just fetching data from DB.

Modular, clean, and no magic. Feels good. πŸ‘Œ

more on: https://write.as/bmariusz/continuation-securing-routes-with-jwt-and-role-based-access-control
#CloudNative #TypeScript #NestJS #Nextjs #InsuranceTech #Microservices #monorepo
#codingdays #swagger #jwt #jwt_auth #programming

Continuation: Securing Routes with JWT and Role-Based Access Control

TL;DR: Continuing development on the backend platform β€” this time focusing on securing routes with JWT, implementing @Roles decorators, h...

Mariusz Balewski
Finally, the weekend is here. Time to unwind and recharge 

Day 4

TL;DR: Full Swagger docs + JWT auth with registration and login are live.

Today’s work focused on two key improvements.

1. Swagger documentation was extended across all API layers. DTOs, entities, and controllers were enriched with `@ApiTags`, `@ApiOperation`, `@ApiResponse`, and detailed `@ApiBody` annotations β€” including real-life examples for request bodies.

2. JWT-based authentication was implemented. A secure registration flow was added, with password hashing via bcrypt. A login endpoint now issues access tokens containing user ID, email, and roles. All logic is encapsulated using Passport strategies (local and JWT). The next step will be protecting routes with guards and role-based access.

#CloudNative #TypeScript #NestJS #Nextjs #InsuranceTech #Microservices #monorepo
#codingdays #swagger #jwt #jwt_auth #programming

Day 3 2/2
2. Enabling API documentation with Swagger.

I integrated Swagger into the backend (NestJS v10, ESM, Turbo monorepo), using `@nestjs/swagger@7` to match our current framework version.
The docs are now live at `/api/docs`, fully aligned with our global `ValidationPipe` and `AllExceptionsFilter` β€” ensuring consistent validation and error responses.

Next: annotate DTOs, describe endpoints properly, and restrict access.
#CloudNative #TypeScript #NestJS #Nextjs #InsuranceTech #Microservices
#codingdays #programming

Day 3 1/2
TL;DR:
Added global `ValidationPipe` and unified `AllExceptionsFilter` in NestJS. API errors now follow a consistent format: `{ statusCode, error, message, code, details }`.

Today’s work focused on:
1. Standardizing input validation and error handling in the backend of the insurance sales network management system (NestJS, TypeScript, ESM, Turbo monorepo).

- Enabled global `ValidationPipe` with: `whitelist`, `forbidNonWhitelisted`, `transform`, `enableImplicitConversion`.
- Extended existing `AllExceptionsFilter` to produce structured error responses across `HttpException`, `QueryFailedError`, and other runtime errors.
- Removed `http-exception.filter.ts` β€” now redundant.
- Error response format is frontend/B2B-friendly and consistent across the API.

Example error response:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Field 'email' is required",
"code": "VALIDATION_EMAIL_REQUIRED",
"details": {
"field": "email",
"reason": "required"
}
}
#codingdays #programming

Day 2:

TL;DR:
❌ `composite: true`
❌ `tsconfig.build.json`
βœ… `paths` in `tsconfig.base.json`
βœ… `include` shared libs explicitly where needed
βœ… `turbo run build` just works

Wrestled for hours (~3) with TypeScript `project references` and `paths` in a Turbo monorepo (NestJS, ESM).
Turns out: if you want global aliases like `@my-lib/foo` to *just work* across apps β€” skip `composite: true` and `tsc --build`.

Project references and alias-based path mapping don't mix well when your intent is to keep things simple.

#CloudNative #TypeScript #NestJS #Nextjs #InsuranceTech #Microservices
#codingdays #programming

Day 1:
tl;dr: ESM + TS + NestJS + TypeORM is possible, but not recommended for the impatient.

Successfully bootstrapped NestJS + TypeORM + PostgreSQL stack using ESM.

It only took:
- 6 hours
- 17 cryptic errors
- 3 existential crises

Turns out, using modern JS modules with legacy decorators is... bold. But hey β€” it runs now.

#CloudNative #TypeScript #NestJS #Nextjs #InsuranceTech #Microservices
#codingdays #programming