Skip to content

anaquac/storage-microservice

 
 

Repository files navigation

Image Storage Microservice

This microservice implements a basic CRUD for uploading, storing, and retrieving images using NestJS. Images are externally stored in Firebase Storage, and the endpoints support file upload, retrieval, and validation.

Project Description

This project provides a scalable and efficient image storage microservice, featuring:

  • Image upload (with type and size validation).
  • Storage in Firebase Storage.
  • Image retrieval via public URLs.
  • Security with JWT authentication to protect access to the endpoints (Mocked data, not real authentication process required).

Additional Features (Optional)

  • Thumbnail generation (for image resizing).
  • Audit logs to track who uploaded which file and when.
  • Redis integration to cache URLs and improve performance.

Prerequisites

Before starting, make sure you have the following installed in your local environment:

  • Node.js (version 20 or higher).
  • NestJS (already included in the template).
  • Firebase CLI (if using Firebase Storage).
  • Redis (optional for URL caching).

Required Stack

You should use the following tech stack during this project:

  • TypeORM.
  • PostgreSQL.
  • Redis (optional).

Project workflow

  • You should create a forked repository and make a PR when you complete the project.
  • A guideline of the tasks required can be found in the issues of this repo and in the following project: Cute Digital Media Project
  • Each issue contains the description needed to handle the task.

Installation and Setup

  1. Clone the Repository

    Clone the GitHub repository to your local machine:

    git clone <REPOSITORY_URL>
    cd <PROJECT_NAME>
    
  2. Install dependencies

    yarn install
    
  3. .env variables

  • You should update this point to include env names needed.
  1. Start the Service
    yarn start:dev
    
  2. Final considerations and recomendations
  • Keep it simple.
  • Be organized in your code.
  • Don't forget to provide the necessary environment variable names needed to run and test the project.
  • Good luck :).
  1. Additional notes: the roles handling is missing intentional some end points because I think the we dont need for the test. The redis cache is using in the get single url end point and is very easy extend to the get all the url and pagination but I dont left more time.

I make some unit test for the user.service for testing porpoise

For the task [[optional] Log Persistence #12] I dont get the point about the log persistence I meaning I dont know if you need to handle in the same pg database or in another resource like ElasticSearch or something like that

  • Run docker compose for up the additional resources pg database and redis cache manager
docker-compose up -d
all the env var example are in .env.template file

About

Storage microservice recruitment repo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 97.9%
  • JavaScript 2.1%