Skip to content

CrystalSystems/crystal-v1.0--production

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Members MIT License
About_project Documentation Developer’s Diary

CRYSTAL v1.0 (Production)

This version is functionally identical to the base CRYSTAL v1.0, but it includes several improvements aimed at increasing reliability, security, and stability.
You can deploy and test CRYSTAL v1.0 (Production) on a local PC or on a VPC following the instructions for regular version, but additionally, it is necessary to define env variables based on these examples.

Architecture:
SPA, REST API, FSD.

Composition:
Full code | Package.json: frontendbackend

Structure:
MongoDB v8.0.4.
Express.js v4.21.2.
React v19.0.0.
Node.js v24.0.2.
NPM v11.3.0.
PM2 v5.4.3.
Vite v6.1.0.

Improvements:

1. Secure database connection
In the production environment, the backend connects to MongoDB using authentication parameters (user, password, authSource), ensuring protection against unauthorized access.

2. Automatic reconnection to MongoDB
Implemented an automatic reconnection mechanism for MongoDB in case of connection failures. It supports customizable retry count (maxRetries) and delay (retryDelay) between attempts, improving application resilience during temporary database outages.

3. Extended env variables configuration
This version introduces a more flexible and detailed env variables structure, allowing for fine-grained customization in development and production environments.

4. Advanced MongoDB connection logging
Connection to the database is performed with detailed logging and status messages - this simplifies debugging and monitoring in development and production environments.

5. Improved error handling
A custom handleServerError helper was introduced to standardize backend error responses and improve debugging during development.
This function captures the context in which the error occurred (even if not explicitly provided), logs detailed information to the console, and adjusts the HTTP response based on the environment:

  • In production, it returns a generic 500 error message without exposing sensitive details.
  • In development, it returns the full error object including stack trace and calling context - making it easier to trace and fix issues.

⚠️ Before using CRYSTAL v1.0 (Production) or its code in a production environment, it is strongly recommended to carefully review the implementation and assess any potential cybersecurity risks.

CRYSTAL is tested on

SHEDOV.TOP CRYSTAL Discord Telegram X VK VK Video YouTube