figma-to-json

Architecture

Server is runs with 'Express' package. I used '3 Layered Architecture' type for folders structure.

  • Presentation layer (should takes only request and response, no business logic here)
  • Business Logic Layer (store all logics here, no intraction with database)
  • Data Access Layer (all database queryies here)

Folders description

  • src/config - storing default env variables

  • src/data-access - intraction with writing file and upload to S3

  • src/loaders - consisted of logger function and S3 client

  • src/models - validation of client request model using Joi

  • src/routers - HTTP Routers

  • src/services - business logic

  • src/utils - reusable functions

Endpoint

}

Static files

  • All files file saves to 'tempFiles' folder, after uploading it will be deleted locally.

Notes

  • I used 'Minio' package as S3 object. It is exactly same as AWS S3. Currently, I don't have AWS account, so I used Minio locally.

Future improvements

  1. Read buffer from Figma API, upload to S3 with buffer method
  2. Check bucket is exits, if not create bucket
  3. Add Swagger using 'swagger-ui-express'