Articles Hierarchy

Articles Home » RPI » CMS?framework for RPI Node server

CMS?framework for RPI Node server

looking for a js server client environment with a minimal custom database on server
and using selected record in HTML client side ( by a processing p5.js app later )
i knew that as soon i would like to also save modified records ( back to server )
i would need a user login environment.

not lucky about searching js framework i suddenly had the idea, why not start the other way,
with a CMS?framework and try to add a own database for my records...
so i found: STRAPI
Strapi comes from the word Bootstrap, and helps Bootstrap your API πŸŽ‰
i think it fits to use it on RPI / under a node js webserver.
lets check it out:

the working environment is a 4GB RPI4,
on ethernet cable to LAN, with fix IP config.
headless, so i use: VNC & bitvise SSH client

as started with the minimal desktop version of Raspberry Pi OS
see also here for setup and test a node express webserver on RPI.
pi@RPI4:~/projects $ node -v
pi@RPI4:~/projects $ npm -v

see Yarn and strapi
in /home/pi/projects/
sudo npm install --global yarn
yarn create strapi-app my-strapi --quickstart

Expected version ">=10.10.0 <13". Got "14.11.0"
error Found incompatible module.

yes, 14 is > as 13, so i need a old NODE? Latest LTS Version: 12.18.4

here could check on using
a node version management
or as this is a test ( in a RPI test installation ) just install a other node version.

tar -xvf node-v12.18.4-linux-armv7l.tar.xz
cd node-v12.18.4-linux-armv7l
sudo cp -R * /usr/local/
sudo reboot

and clean up the remains.. and check:
pi@RPI4:~/projects $ node -v
pi@RPI4:~/projects $ npm -v

try again:
yarn create strapi-app my-strapi --quickstart
looks much better, as it is installing, but lots of warnings about outdated dependencies.
and "Building fresh packages" takes long on RPI4.
pi@RPI4:~/projects $ yarn create strapi-app my-strapi --quickstart
yarn create v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Installed "create-strapi-app@3.1.5" with binaries:
- create-strapi-app
Creating a new Strapi application at /home/pi/projects/my-strapi.

Creating a quickstart project.
Creating files.
Dependencies installed successfully.

Your application was created at /home/pi/projects/my-strapi.

Available commands in your project:

yarn develop
Start Strapi in watch mode.

yarn start
Start Strapi without watch mode.

yarn build
Build Strapi admin panel.

yarn strapi
Display all available commands.

You can start by doing:

cd /home/pi/projects/my-strapi
yarn develop

> my-strapi@0.1.0 build /home/pi/projects/my-strapi
> strapi build "--no-optimization"

Building your admin UI with development configuration ...

βœ” Webpack
Compiled successfully in 1.50m

Running your Strapi application.

> my-strapi@0.1.0 develop /home/pi/projects/my-strapi
> strapi develop

[2020-09-22T02:02:44.865Z] info File created: /home/pi/projects/my-strapi/extensions/users-permissions/config/jwt.js

Project information

β”‚ Time β”‚ Tue Sep 22 2020 09:02:48 GMT+0700 (Indochina Ti… β”‚
β”‚ Launched in β”‚ 17044 ms β”‚
β”‚ Environment β”‚ development β”‚
β”‚ Process PID β”‚ 2068 β”‚
β”‚ Version β”‚ 3.1.5 (node v12.18.4) β”‚
β”‚ Edition β”‚ Community β”‚

Actions available

One more thing...
Create your first administrator πŸ’» by going to the administration panel at:

β”‚ http://localhost:1337/admin β”‚

[2020-09-22T02:02:49.393Z] debug HEAD /admin (50 ms) 200
[2020-09-22T02:02:49.406Z] info ⏳ Opening the admin panel...

register a admin with
first: last: email: password: ( one number, one big character, and longer as?? )
and system restarts:

found out that it uses per default "SQLite 3", means creates a file /.tmp/data.db
so backup your CMS should be easy..

following the documentation now need to create content tables, while the example is for a restaurant i start with a minimal BLOG:
articles under categories
while the minimal interface for a ( SQL defined ) table is:
WORLD: Select record, View,
OWNER: Add, Edit, Delete
the BLOG select & view interface is what you do for the front end...
possible the handling of the content might be already available via the
admin interface ( you need to learn anyhow... ), so the BLOG only has to SHOW the content.
( and that would be the MINIMAL BLOG CMS )

please find the browserpage localhost:1337/articles what shows already a SQL fetch?

when i see that result already in admin and ? in a view page?
the big question is how to setup the webpage / what frame work to use...
not knowing what i do, but ready to learn something new: try Vue Nuxt
but reading the comments the STRAPI dev says there, better use newer REACT GATSBY
here folow newer version manual.

npm install -g gatsby-cli
gatsby new frontend
cd frontend
gatsby develop

nano components/seo.js
nano src/assets/css/main.css

yarn add gatsby-source-strapi
nano gatsby-config.js

at frontend
nano .env.development
nano gatsby.config.js