Skip to content

Refactor entire project structure to use NestJS for backend and Next.js for frontend#133

Open
simarjot0032 wants to merge 50 commits intoBRL-CAD:developmentfrom
simarjot0032:development
Open

Refactor entire project structure to use NestJS for backend and Next.js for frontend#133
simarjot0032 wants to merge 50 commits intoBRL-CAD:developmentfrom
simarjot0032:development

Conversation

@simarjot0032
Copy link

  • This PR represents a complete modernization of the Online Geometry Viewer (OGV) project, refactoring it to a Next.js + Nest.js architecture.
  • The goal of this migration is to improve scalability, maintainability, performance, and developer experience across both the frontend and backend.
  • Updated documentation and environment details

Technical Changes

Backend:

  • Migrated to NestJS with modular architecture (controllers, services, DTOs).
  • Centralized environment variables and configuration.
  • Added structured logging, validation, and error handling.
  • Integrated background tasks for model conversion and expiration.

Frontend:

  • Rebuilt interface using Next.js with SSR and dynamic routing.
  • Introduced SCSS modules and reusable UI components.
  • Optimized asset loading and 3D model rendering flow.

- fix: uploading porcess button label chnage
… using id

- fix: on error it now return proper eoor code with status property
- made the explore page
- updated the framer motion
README.md Outdated
This project consists of two main modules:

### 1. Conversion Module (Backend)
- **Repository**: [ogv-conversation-package](https://github.com/simarjotsingh/ogv-conversation-package)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have these packages under BRL-CAD org

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, changed to the URL.

README.md Outdated
- **Purpose**: Handles file uploads, conversion, and API endpoints

### 2. Viewer Module (Frontend)
- **Repository**: [ogv-viewer-package](https://github.com/simarjotsingh/ogv-viewer-package)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have these packages under BRL-CAD org

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed Changed the URL

- [Lint](#lint)
- [Build and Deploy](#build-and-deploy)
- [Contribution](#contribution)
## 🚀 Features

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We must have a Table of Contents

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, added the table of contents.

Comment on lines 1 to 13
DATABASE_URL="postgresql://your_db_user:your_secure_password@localhost:5434/your_db_name"
CLOUDINARY_CLOUD_NAME=""
CLOUDINARY_API_KEY=""
CLOUDINARY_API_SECRET=""
UPLOAD_BASE_PATH="storage path"
UPLOAD_API_PATH="storage path"
RAW_FILES_PATH="storage path"
CONVERTED_TO_OBJ_PATH="storage path"
THUMBNAIL_PATH="storage path"
CONVERSION_API_PATH="storage path"
CONVERTER_INPUT_PATH="storage path"
CONVERTER_OUTPUT_PATH="storage path"
TEMP_FILES_PATH="storage path" No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have better documentation for sample.env

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, have added the comments as well as a proper definition in their respective README files.

Comment on lines 1 to 5
**OGV Backend**

This is the backend service for the Online Geometry Viewer (OGV) project. It handles file uploads, 3D model conversion using BRL-CAD, and provides REST API endpoints for the frontend application.

> 📖 **For complete setup instructions, environment configuration, and database setup, see the [main README](../README.md)**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Project setup should come first, and then API endpoints and examples, also add a TOC

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed as well as fixed for the frontend too.

Comment on lines 2 to 10
CREATE TABLE "UploadModel" (
"id" TEXT NOT NULL,
"thumbnailUrl" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT NOT NULL,
"category" TEXT NOT NULL,
"license" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"status" TEXT NOT NULL DEFAULT 'active',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need migrations? since we just released the project

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed migration as well as the TOML extra file.

Comment on lines +1 to +16
export const InputFormats = [
'obj',
'stl',
'ply',
'vrml',
'3mf',
'asc',
'x',
'x3d',
'3ds',
'dae',
'fbx',
'json',
'assbin',
'fbx',
'g',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can use the existing mimetypes to type secure these objects

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, I have removed the validation for the mime types because it was giving errors. We need the proper data for the mime files.

@@ -0,0 +1 @@
export * from './formarts';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formarts -> formats

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed


constructor(private readonly prisma: PrismaService) {}

@Cron(CronExpression.EVERY_MINUTE)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isnt this too much for an operation like this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My initial thinking was that since we already default the expiration for the unknown licensed models to one hour, we were implicitly tracking it that way.

That said, based on your feedback, I’ve now updated it explicitly to every hour.

Comment on lines 23 to 53
if (!request.file) {
return createError400('File is required');
}

if (!request.thumbnailImage) {
return createError400('Thumbnail image is required');
}

if (!request.title) {
return createError400('Title is required');
}

if (!request.description) {
return createError400('Description is required');
}

if (!request.category) {
return createError400('Category is required');
}

if (!request.license) {
return createError400('License is required');
}

if (!request.expiresIn) {
return createError400('Expires in is required');
}

if (!request.userIP) {
return createError400('User IP is required');
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There has to be a better way for this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment on lines 25 to 31
},
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'react/no-unescaped-entities': 'off',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting ptoblrm spotted

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

},
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont have to disable this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, removed that.

value={fileInformation.license}
onChange={handleLicenseChange}
>
{Licenses.map((license) => (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming problem, this Licenses looks like a component

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed and also added the index file for the data for easy import.

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.

2 participants