Help with getting my chat app ready for deployment

I’ve created a chat app in React + Vite and I’m preparing it for deployment. I’ve already added the necessary files such as netlify.toml and _redirects, but there are just a few questions I have.

Here’s the link to my GitHub repo: GitHub - fantasy-thrill/yapper-msg-app at test

My app also uses the Express framework via Node.js. The app.js file uses the multer package to handle images uploaded by users when they create a new account. This package would save image uploads to an "/uploads" directory in the local version of my project. However, I’ve looked into Netlify Blobs which can store images remotely. I just want to know how I can integrate it into my Node.js file (app.js) if possible.

Could I do it like this?:

const { getStore } = require("@netlify/blobs")

async function uploadEndpoint(request) {
  const fileUpload = request.file;
  const userUploadStore = getStore({ name: "UserUpload", consistency: "strong" });
  await userUploadStore.set("ProfilePics", fileUpload);
  return redirect("/success");
}

app.post("/create-account", async (req, res) => {
  try {
    const { name, user_id, email, password } = req.body
    const realUsers = db.collection(process.env.DB_USER_COLLECTION)
    const hashedPassword = await bcrypt.hash(password, 10)

    await uploadEndpoint(req)

    const newUser = {
      name: name,
      uid: user_id,
      email: email,
      password: hashedPassword
    }

  // Extra info handling...
}

I also want to know if my other files for deployment, such as the TOML and redirects file, are correct. I’ve downloaded the serverless-http, @netlify/functions, and @netlify/blobs packages if necessary. I wrote the serverless-http into my app.js file to run the backend Express functions when needed. Please let me know your thoughts.

Where are you planning to host your backend? I don’t see your backend code in the repo you shared.

@hrishikesh The backend would be the src/lib directory. That’s where my app.js file is located.

Sure, you can use Netlify Blobs. However, you’d need to call the connectLambda() function before being able to use getStore(): netlify/blobs: A TypeScript client for Netlify Blobs. As for netlify.toml, the following is not required and should be removed:

[[headers]]
  for = "/*.js"
  [headers.values]
  Content-Type = "application/javascript"

Instead, you need:

[[redirects]]
  from = "/*"
  status = 200
  to = "/index.html"