Strapi is a really promising CMF that make API managment so simple, it is based on Koa and comes backed with and easy admin panel to create and manage your API.

We don’t need alot of work to set up our API anymore we can focus on others fun stuff, let’s make thing goes real time with strapi & socket.io !

Setup strapi

Install strapi (currently strapi@3.0.0-alpha.10.2):

npm install strapi@alpha -g

Create a Strapi project:

strapi new strapi_socket

> Choose your main database: MongoDB (highly recommended)

> Database name: strapi_socket

> Host: 127.0.0.1

> Port: 27017

> Username:

> Password:

Go to your project root folder:

cd strapi_socket

Install Strapi dependencies:

npm i

Install socket.io (currently socket.io@2.0.4) as dependency:

npm install --save socket.io

Before starting Strapi you can do npm ls strapi which should print something like this:

strapi_socket@0.1.0 /path/to/project/strapi_socket

└── strapi@3.0.0-alpha.10.1

So you know where is the strapi used and we can see this is the local strapi inside our project’s node_modules and not the global version. We can now start strapi by running:

strapi start

Don’t forget to start mongoDB ( mongod on your terminal before starting strapi).

Open /admin that will redirect you to /admin/plugins/users-permissions/auth/register. Register your admin user to login to the admin panel.

Add a new model

In a few steps I will create a simple model named bakery from the content type builder tab: