This is a project created with nx using react + express template.
React application
The express application
Shared react components developed with storybook.
Typeorm data acces library
- typeorm
- storybook
- antd
- postgresql
Develop react components in a library called components. Components are developed using storybook. Storybook is configured with a proxy to allow the components to access de /api and be autonomus. Once ready the components, use them in the main react app flash. To scale, encapsulate the routes for each table in a route component for each table, in this case users.
To actually see all the requirements, i've tested on a docker machine running ubuntu 22.04 with nothing installed. All these steps are not necessary for a typical linux desktop that already comes with git and curl at least. Also, there are many ways to create the database.
sudo -s
apt update
apt install postgresql git curl -y
curl -s https://deb.nodesource.com/setup_16.x | bash
apt-get install -y nodejs
su - postgres
# Next command only if database isn't running.
pg_ctlcluster 14 main start
psql
create user flash encrypted password 'flash' createdb;
\q
psql -U flash -h localhost template1
create database flash;
\q
exit
Next commands should be executed with a normal user privileges, so we leave root level with exit. This should drop you to a normal shell in your computer.
exit
git clone https://github.com/hanspoo/flash-ws
cd flash-ws/
npm install
npm run test
npm i -g nx
nx serve flash
nx serve api
After typeorm has run, the task table is created, so we can insert a task, and reload the ui to see the data.
psql -U flash -h localhost flash
insert into todo (task, done) values ('Download some games for the kid', true);