@salsaboy990/strapi-template-seeder v1.0.23
strapi-template-seeder
A Strapi template with seeder to create a Strapi project for a Gatsby website with sample data.
- custom entities and components
- dynamic groups for content
- content seeder
- Gatsby frontend available for the Strapi backend
Important notes
There was an older npm package strapi-template-drb
(1.0.9) which is deprecated.
Always use the current package: strapi-template-seeder
Usage
# Using Yarn
yarn create strapi-app your-app-name --template https://github.com/SalsaBoy990/strapi-template-seeder
# Or using NPM
npx create-strapi-app your-app-name --template https://github.com/SalsaBoy990/strapi-template-seeder
At the install process:
- Choose JavaScipt
- Choose manual setup and select postgres (though sqlite can be used as well)
In order to use Postgres, create first a Postgres database with user and password.
Strapi backend example
The example backend is created using the starter template.
Deploy a Strapi app to Heroku
- Deploy Strapi on Heroku You only need to have a free Heroku account. You can also have a Postgres database for free.
Checkout the database config used by Heroku: https://github.com/SalsaBoy990/strapi4-backend/blob/master/config/env/production/database.js
And this file: https://github.com/SalsaBoy990/strapi4-backend/blob/master/config/env/production/server.js
Note:: You cannot store your assets in the uploads folder on Heroku, since your uploads will be lost after Heroku restarts the dyno. The filesystem only lasts until the dyno is restarted. In the free tier, this is done more regurarly since Heroku will stop your dyno after 30 mins.
You only need to have a free account on Cloudinary. In addition, do not forget to set your cloudinary credentials as env vars for your Heroku application, for example:
heroku config:set CLOUDINARY_NAME=app-name-here
See the cloudinary config: https://github.com/SalsaBoy990/strapi4-backend/blob/master/config/plugins.js
- Production requirements for the Gatsby Strapi Source plugin
Check out this file: https://github.com/SalsaBoy990/strapi4-backend/blob/master/config/plugins.js
Frontend starter using Gatsby v4
Frontend starter for the Strapi backend:
Set these variables in .env.development
:
STRAPI_API_URL=strapi-app-url-on-heroku
STRAPI_TOKEN=full-access-token-generated-in-the-strapi-app
To refresh content for the Gatsby development script, set this variable to true:
ENABLE_GATSBY_REFRESH_ENDPOINT=true
And run:
bin/refresh
The bash script will trigger the rebuild of the content after the data changes you have made in the Strapi admin.
Sample images and text
Three images are from Unsplash and can be used for commercial and non-commercial purposes.
Author attributions:
- Construction in Ottawa, Canada: Jeriden Villegas
- Construction worker in San Francisco: Tolu Olubode
- Skyscrapers in Chicago with Lake Michigen in the background: Pedro Lastra
- Bus in Hamburg, Germany: Phuoc Anh Dang
There are sample images from a real project I made for a client at a company where I used to do contract work. All the brand images are replaced with fake ones, so the original company can't be recognized.
The original texts are also changed and replaced with made-up, or lorem ipsum texts.