Skip to content

Migrate to Zustand and Major Enhancements#1

Merged
dimastriann merged 20 commits into
mainfrom
migrate-zustand
May 29, 2026
Merged

Migrate to Zustand and Major Enhancements#1
dimastriann merged 20 commits into
mainfrom
migrate-zustand

Conversation

@dimastriann

Copy link
Copy Markdown
Owner

No description provided.

- initialize frontend project structure with state management, core layouts, and chat functionality
- new fields simple budget information
- approval timesheet
- project plan and period
- improve some pages more modern and user friendly
- update form, comment, landing and login/register page
- improve all views available both dark/light mode
- change icon web app
…chat to real-time

Phase 1: Security Hardening & Input Sanitization
- Purged duplicate Module imports (TimesheetModule, CommentModule) in `app.module.ts`.
- Implemented lightweight, high-performance XSS input sanitization using a custom `@IsSanitizedString` decorator backed by the `xss` engine.
- Protected User, Workspace, and Chat message DTOs from arbitrary script injection.
- Replaced deprecated `csurf` library with dynamic Origin and Referer validation middleware combined with httpOnly/sameSite session cookies.
- Fixed `migrate-passwords.ts` dotenv setup and migrated plain-text passwords into secure salted bcrypt hashes to match GqlAuthGuard validation.

Phase 2: Infrastructure, Diagnostics & CI/CD
- Added dynamic health check endpoints (/health, /health/liveness, /health/readiness) validating Postgres connections and memory footprint thresholds.
- Integrated fail-fast environment validation using class-validator and class-transformer on bootstrap.
- Built a unified HTTP & GraphQL Logging Interceptor generating random UUID tracking keys for requests.
- Integrated a Global Exception Filter with fallback Sentry exception capturing.
- Configured a multi-job GitHub Actions CI/CD workflow (.github/workflows/ci.yml) for automated builds.

Phase 3: Performance, Code Splitting & Subscriptions
- Purged legacy Socket.IO server and client dependencies completely.
- Migrated the chat pipeline to Apollo GraphQL Subscriptions (OnMessageSent, OnMessageUpdated, OnMessageDeleted).
- Configured Apollo Client caching type policies for paginated message buffers.
- Enabled code splitting and bundle size reduction (Login bundle reduced to 4.3KB) using React.lazy code splitting.
- Added performance database indexes to schema.prisma on relational keys (workspaceId, projectId, userId, etc.).
- FIXED WebSocket subscription blocker by upgrading backend PubSub to use `asyncIterableIterator` matching graphql-subscriptions 3.0.0 API.
- FIXED subscription context handshake crash by optional-chaining req headers in `logging.interceptor.ts`.
- FIXED message ordering in the chat pane using ID-based ascending sort to bypass local cache-merge inconsistencies.

Phase 4: DoS Protection & File Upload Hardening
- Implemented AST-based GraphQL depth query limiting (maximum depth: 5) to protect against DoS.
- Hardened file uploads by validating extensions/mime-types pre-write and enforcing a strict 10MB limit post-write.
- Added comprehensive unit testing coverage for environment validation and query depth limiting.

Phase 5: Collaborative Auditing & Pagination
- Implemented non-destructive soft deletes (deletedAt) for collaborative models (Project, Comment, Timesheet).
- Added backward-compatible cursor-based pagination alongside offset pagination for task query resolutions.
- dependencies package
- formmating file
- gql schema
Enforces strict type safety and achieves 0 linter warnings/errors across the entire backend and frontend applications without relying on global linter disable rules.

Backend (NestJS) Refactoring:
- Resolved dynamic `@sentry/node` packages using typed placeholder interfaces.
- Replaced unused catch block error variables with modern ES2019 optional catch bindings.
- Casted host context types to resolve GraphQL-to-HTTP union mismatches.
- Properly typed Passport JWT strategy parameters and WS authenticated socket client extensions.

Frontend (React / Vite) Refactoring:
- Replaced implicit and explicit `any` assertions on form submit payloads with typesafe `Record<string, unknown>`.
- Defined interface schemas (`ProjectAttachment`, `ProjectMember`, `AttachmentFile`, and `LoginData`) to type dynamically mapped records.
- Casted API response arrays (e.g., `usersData?.users as UserType[]`) to utilize TypeScript type inference during mappings.
- Refactored selection helpers to clear collections using typesafe double assertions (`null as unknown as Conversation`).
- Coerced form values to standard strings via `String(...)` before parsing with `parseInt`/`parseFloat` to satisfy strict argument signatures.
… CSS warnings

- Mock global ResizeObserver in vitest setup to support Headless UI components.
- Introduce hidden native select within Select component to enable robust RTL and query selections.
- Add id associations to Select wrappers in ProjectForm, TaskForm, and TimesheetForm.
- Implement hasResetInitial state check to prevent form data loss when async users/projects load.
- Shift index.css font @import statement to the top to resolve PostCSS ordering warnings.
- Update test form input selectors to use getByLabelText for modern UI layouts.
…er and interceptor

- Cast host.getType() and context.getType() as string to permit comparison with 'graphql'.
- Fixes backend CI build failures.
@dimastriann dimastriann merged commit 521ca28 into main May 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant