What are different ways in which strapi can be deployed?

I am very new to strapi and backend. I was experimenting with strapi on local, then I purchase Postgres on Digital Ocean to make things production ready. But looks like I am confused on these aspects.

A full app made with Strapi as CMS will have separate components like:

  1. Strapi
  2. Database
  3. Storage
  4. Front End

Strategy:

  1. Can I deploy these four into separate clouds like Strapi on Digital Ocean, use Digital Ocean postgres for Database, AWS S3 for Storage, vercel for frontend?
  2. Deploy strapi, database, and storage on single Digital Ocean droplet and front end on vercel
  3. Deploy all 4 on single droplet?

What is the good way to do it? If there are multiple ways, what are the drawbacks of different stragies?

Hi AmitDigga,

I am pretty new as well.
Have you tried this resources?:

I also would suggest you to learn Docker, and deploy with that.
Right now I am learning the docker course from “code with mosh” (search it on goole, I can’t put more than two links here since I am a new user ) which is paid, but it is very good.

If you like Mosh courses, I would suggest to but a license, as it would be cheaper that buying just one course.

2 Likes

The benefits of Strapi is that it is very flexible of where and how you deploy. I typically just use Digital Ocean App platform.

1 Like

Hello,

yes, each strategy has its strengths and weaknesses, but personally, for production I would pick the first one. I’ll explain why.

By separating each part you make it easier to maintain and scale everything.

Strapi backend

Strapi itself needs to be hosted on a droplet (or maybe they have a Strapi app in their App Platform), there is not much you can do. If you need to scale, you will have a momentary downtime while you switch the droplets, but I think you should be able to use the same volume, so you’ll just change instance type and after restart you should be fine.

Database

For database you’re better of using managed database, they are a bit more expensive but you get automatic scaling, automatic backups and bunch of more stuff. You can then just use database URL that is given to you by DigitalOcean by putting it into .env file in your Strapi project. Ideally, for lowest latency, you would pick same region for your Strapi droplet and managed database.

Storage

DigitalOcean also provides S3-compatible storage, so whether you choose AWS, DigitalOcean, Scaleway or anything else, it doesn’t matter. You will need to install the @strapi/provider-upload-aws-s3 plugin to add support for the S3 storage into Strapi. You’ve probably already done this.

Frontend

Vercel is a great choice since they provide great caching and they deploy your app globally to multiple regions, so you should get great performance. And they of course automatically scale based on your usage.


Disclaimer: I’m a primarily a React Native developer, I’ve been programming for 7 years, but I don’t have any hands-on experience with production deployment of Strapi. I just read and watch a lot of stuff and this is how I would do things if I was building a project. Please if anyone has more experience feel free to correct me, I love to learn!

2 Likes

Thanks for the tips. You can also use Strapi Cloud as well. At the moment, we only have our pro tear ($99) that is geared towards businesses and agencies. But I hear we will be introducing a low tear plan, starting at $29, in the near future.

Thanks everyone!

So it is clear that different strategies can be used.

  1. I will learn to deploy all things in a single droplet. It will be good on budget and should be easier to setup.
  2. Later I will split them into multiple when needed.

I build Strapi into a docker container and deploy it on Digital Ocean App platform. Smallest instance for $5 per month is OK. It uses Digital Ocean Postgres for database and Digital Ocean Spaces for storage.

Droplet is more effort to set up, but you can then manage without Digital Ocean Postgres by using database stored on droplet. This can be backed up as cron job to S3 storage.

Also have one deployment in development using Neon for Postgres database which is free.

1 Like