Npm run develop is taking very long time to start server or Restarting ( i.e avg 8 min to start server)

System Information
  • Strapi Version: “3.6.1”

  • Operating System: ubuntu 20.04

  • Database: mongoDb

  • Node Version: v14.17.6

  • NPM Version: 6.14.15

  • Yarn Version:


return {
      defaultConnection: 'default',

      connections: {
        default: {
          connector: 'mongoose',
          settings: {
            host: env('DATABASE_HOST', ''),
            srv: env.bool('DATABASE_SRV', false),
            port:'DATABASE_PORT', 27017),
            database: env('DATABASE_NAME', 'strapiDB'),
            username: env('DATABASE_USERNAME', null),
            password: env('DATABASE_PASSWORD', null),
          options: {
            authenticationDatabase: env('AUTHENTICATION_DATABASE', null),
            ssl: env.bool('DATABASE_SSL', false),


module.exports = ({ env }) => ({
  host: env("HOST", ""),
  port:"PORT", 1337),
  admin: {
    auth: {
      secret: env("ADMIN_JWT_SECRET", "c76448a2e879826ab48bfac392acc85c"),

Minor tip, don’t POST your SECRET key :slight_smile: It’s like giving away your password. :wink:

Do you have anything in your bootstrap.js etc? Any plugins?
I would also ask is this connect to local database or a remote database?

Thanks for Tip, I would change admin secret nad db is currently connecting to local database.

module.exports = {
    settings: {
      cors: {
        enabled: true,
        origin: '*',
        expose: ['WWW-Authenticate', 'Server-Authorization', 'Access-Control-Expose-Headers'],
        maxAge: 31536000,
        credentials: true,
        methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD'],
        headers: [
      gzip: {
        enabled: true,
        options: {
          br: false



module.exports = ({ env }) => ({
  email: {
    provider: 'sendgrid',
    providerOptions: {
      apiKey: env('SENDGRID_API_KEY'),
    settings: {
      defaultFrom: '',
      defaultReplyTo: '',
      testAddress: '',

Do you have quite a big collection or anything ? Or do you have any scripts running in boostrap.js that’s what normally startup and takes time during startup

We have at least 30 collections. does it compile all collection while auto reloading or what? if so any way to skip file while reloading?

Should not matter to much iirc.
But again one question I asked in both replies and still not answered but does matter for startup time is. Has bootstrap.js been modified added any scripts etc? :blush:

no, bootstrap.js file is just default one.

'use strict';

 * An asynchronous bootstrap function that runs before
 * your application gets started.
 * This gives you an opportunity to set up your data model,
 * run jobs, or perform some special logic.
 * See more details here:

module.exports = () => {};

This is empty file. So Acually we dont know, what is causing this.

Are you using a remote database, seems to me to be local, so I can’t see why this should take that long time.

Can It Happens Due to MongoDb??

It could be depending on how complex your data structure is yes.
Or if it even struggles to connect (but using local host it shouldn’t struggle)

It is my first project on strapi, can You Please Tell Us What possible Cause might Be?

also there is one problem also when using Admin Panel, Normal API request are taking way longer.

if you could tell anything it would very helpful

Have you checked the resources on your computer how the CPU and RAM is going
@DMehaffy sorry for tag but any ideas here :thinking: ?

Thanks. I will check that also one thing when I am connecting to empty mongo db strapi is compiling way fast, but with db of size 20 mb is taking avg 8 min to reload or start.

how many models and how complex are those models?

A certain cough someone’s company project is gigantic and takes a while to start also but that’s expected given it’s size :wink:

1 Like

I have no idea what you talk about @DMehaffy :stuck_out_tongue_winking_eye:

1 Like

@DMehaffy Thanks for responding. our project have 35 collection with medium complexity.

will it help to migrate from strpi v3 to v4 and mongo to mysql or other relation DB?

35 isn’t bad honestly my own personal hobby project has over 90

Moving from Mongo to basically any other database will help yes.
There is no migration path yet from v3 to v4 and we are working on that but yes it will also help.

1 Like

Thanks again @DMehaffy
@Vaibhav_Shinde i agree with @DMehaffy here migrating to MySQL or postgres would be better.