Working skeleton of a database based project with modern stack, React + Express + Typeorm. For simplicity we have not used more elaborate frameworks such as nextjs or nestjs.
We have prepared a video to help you to install: https://www.youtube.com/watch?v=H3FVW_YogM8
- nx
- react
- express
- postgresql - dev/prod
- sqlite - test
- typescript
- typeorm
- antd
- jest
- storybook
- Login
- Home Page
- User registration token based
- User explorer
- Password recovery with email
Choose and assemble all the pieces to start a new system is not an easy task.
This project is a working piece of the curated list ot technologies mentioned above. You just clone and begin to work with the features your client wants.
For free you have registration, login and password recovery process. Good practices such as not sending links in emails and using tokens and not cookies.
Note: We have translated to English recently, so please forgive the spanglish somewhere. Please feed back on this or give us your merge request.
This is a node project, therefore the first thing is to install node, there are several ways to do it; We recommend using nvm.
These are instructions for ubuntu linux:
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-22-04
better with nvm:
If no nvm installed:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
then
nvm install 18
nvm alias default 18
sudo apt install postgresql
Have nx globally installed simplify things:
npm i -g nx@latest
At the time of this writing latest is 17.
git clone https://github.com/hanspoo/b2b-starter
cd b2b-starter/
npm install
npm run test
Dev and prod uses postgresql.
In simple, create a database and put the credentials in the .env file, you can use this script:
sudo su postgres -s bin/create-db-as-postgres.sh b2b
This will create a database called b2b, with a user called b2b with password 123456.
Create .env.local file at the root of the project:
VITE_SERVER_URL=http://localhost:3333
PORT=3333
UPLOAD_FOLDER=/home/username/uploads
SMTP_USER=user@gmail.com
SMTP_PASS=xxxxxxxxx
; SMTP_SERVER=smtp.gmail.com
; SMTP_PORT=587
DB_NAME=b2b
DB_USER=b2b
DB_PASS=123456
The SMTP* variables are used by the registration and password recovery system.
Tip: If you want to use Gmail, first enable two-step authentication, and then create an app in section "App passwords", then use the app password here.
nx serve api
nx serve front
Go to browser: http://localhost:4200
Now you can log in with:
user: admin@starter.com password: 123456
npm run build
cd dist/apps/api
node main.js