How to run Strapi after pulling it from GitHub(with postgres DB)?

I have made a strapi project with custom installation with database as Postgres, So I pushed the code on Github, now if the other person tries to pull the code what step does he need to follow exactly?

I understand he might need to run a cmd “npm install” and then “npm run develop”

So after doing this it is redirecting to a login page of Strapi, how to get the register page, so that one can use their own id and pass to access the strapi content types.

Also, while creating custom starpi project I have given the database name and id and pass of postgres, so will the otther person needs to have the same credentials or will he able to access the same in postgress?

Concerning the credentials you should never push them with your code to github.
Rather use environmental variables (a .env file inside the root folder) where you store the values locally and add it to gitignore. Afterwards use the variables inside the database.js like:

module.exports = ({ env }) => ({
  connection: {
    client: 'mysql',
    connection: {
      host: env('DATABASE_HOST'),
      database: env('DATABASE_NAME'),
      user: env('DATABASE_USERNAME'),
      password: env('DATABASE_PASSWORD'),
      ssl: {
        rejectUnauthorized: env.bool('DATABASE_SSL_SELF', false), // For self-signed certificates
    debug: false,

Your collegues should probably receive their very own db account and put their credentials inside their .env file.

okay thanks a lot! Got it! so one counter question, after they edit this env file so also whatever the db name they will provide obviously they will have to create a db with that name for instance “strapiApi”, so after doing all this changes, will he be able to see those content-types in his database(strapiApi)? Or do he need to anything else?

Ah okay - i had a remote db in mind but it seems like you are using the default sqlite file db right?
Therefore the credential advise is not too important anymore. If you push the database to github as well, they will have the same content-types but there wont be a shared truth while developing since everyone has their own db file locally.

ah no I am using Postgres as my database, so credential things which you have suggetsed are valid for me

It seems like you have a local implementation on your local machine, and you push your code to github. You also have another developer who have access to the github repository and will pull your changes on his/her machine.

if both of you run Strapi on your local machines, that means you have separate databases. So, maybe both of you should add the path to the database file (config/database.js) to the (.gitignore) file so you don’t disrupt each other.

If you have a shared database, which you can do if you set up a database in AWS RDS (for instance), and you both use the same database credentials regardless on where you install Strapi. I assume you know that you can separate the Strapi server from the DB. Hence, this option is valid.

Regarding your question how where users would login, that would be something that you need to develop on your own. Remember, Strapi gives you 2 groups of users:

  1. Strapi backend users: here you have limited number of roles and users. This kind of user is someone who can perform actions on the Strapi admin panel. This kind of user should not perform actions on the frontend as any regular user.

  2. Strapi frontend users: here you can get access to the APIs and use them. you can specify what API should be accessible by which role. This kind of users will not have access to the Strapi Admin panel. You will need to develop your own frontend login page to use the login/registration API.

If you’re starting new in Strapi, I recommend that you invest an hour to go through the documentation of version 4. Also, there are a few nice videos on Youtube if you search for (strapi v4 crash course).

Good luck!

1 Like