https://github.com/franklinkemta/challenge-3dfilestore
An implementation of a REST API of a 3D file repository challenge application
https://github.com/franklinkemta/challenge-3dfilestore
Last synced: 2 months ago
JSON representation
An implementation of a REST API of a 3D file repository challenge application
- Host: GitHub
- URL: https://github.com/franklinkemta/challenge-3dfilestore
- Owner: franklinkemta
- License: apache-2.0
- Created: 2024-03-15T22:21:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-28T00:10:00.000Z (about 1 year ago)
- Last Synced: 2024-03-28T01:27:09.030Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 522 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 3D Filestore API
Thanks to [3dverse](https://github.com/3dverse/challenge-3dfilestore) for this challenge
This is an implementation of a REST API of a 3D file repository application
The API provides endpoints to manage and transform 3D object files
## Features for 3D Objects CRUD and Transformation Operations
- Upload 3D files
- Rename 3D files
- Delete 3D files
- Download original 3D files
- **Download transformed 3D files with dynamic scaling and translation**## Getting Started
To get started with the 3D Filestore API follow these steps:
1. Clone the project repository:
```bash
git clone https://github.com/franklinkemta/challenge-3dfilestore.git
```2. Navigate, Install and Serve
```bash
cd challenge-3dfilestore && npm install
```3. Start the server
```bash
npm run serve
```Visit API docs UI: **[localhost:5000](http://localhost:5000)**

Original buggy obj vertices before transformation```bash
# vertices
v 329.088287 23.088200 739.943176
v 332.551910 23.978901 738.547974
v 332.605499 22.584801 738.398682
# ...
```
Transformed buggy obj vertices after scale and translate vector transformation
```json
{
"scale": [2,2,2],
"translation": [10,0,0]
}
``````bash
# transformed vertices
v 668.176574 46.1764 1479.886352
v 675.10382 47.957802 1477.095948
v 675.210998 45.169602 1476.797364
# ...
```
## API Reference
The API provides the following endpoints in openapi V3 specification:
- `GET /api/files`: List all 3D files
- `PUT /api/files/:fileId`: Rename a 3D file
- `DELETE /api/files/:fileId`: Delete a 3D file
- `GET /api/files/:fileId`: Download the original 3D file or transformed(scaling and translation)## Usage Examples
```bash
GET http://localhost:5000/api/files/buggy?scale=[2,2,2]&translation=[10,0,0]
```This call will stream the transformed 3D object progressively as a download response applying the given transformation e.g { scale: [2,2,2], translate: [10,0,0] } on the original source file vertices and **will not alter the file ⚠️**
## Constraints
- Added **memory usage monitoring** **< ~512Mb**, see src/server.ts file
- Supports **multiple clients** at the **same time**
- Can modify the constant **FILE_READ_CHUNK_SIZE** in src/constants.ts to tweak and see the output memory variation## Running Tests
To run tests, run the following command
```bash
npm run test
```## Tech Stack
- Node.js
- Express.js
- TypeScript
- swagger-ui-express (for OpenAPI v3 docs UI)
- Jest (for testing)## License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.