This is a full-stack dynamic web application developed with PERN stack(PostgreSQL, Express.js, React, Node.js) and TypeScript. This application is built for home cooks and food enthusiasts who want to organize and share recipes.
- In the main page of repo, click the Code button, and then click the SSH tab, then copy the SSH URL
- In the VS Code Studio, open the terminal, and run
git clone <SSH URL>
- Switch to the root directory
cd <your-folder-name>
. - Install all dependencies with
npm install
.
- Start the PostgreSQL database
sudo service postgresql start
. - Check the PostgreSQL database status
sudo service postgresql status
. - Create a database
createdb <name-of-database>
- In the
server/.env
file, in theDATABASE_URL
value, replace database name with the name of your database, from the last step - While you are editing
server/.env
, also change the value ofTOKEN_SECRET
to a custom value, without spaces. - Run command
npm run db:import
to create all tables and import all existing data.
- Run
npm run dev
to start all servers including Vite and Express servers. - If you want stop servers, type
Ctrl-c
in the running server terminal.
- Go to the browser, and enter http://localhost:8080, a react app should be running. If not, make sure your database set up correctly, and your development servers are running.
start
- The
start
script starts the Node server inproduction
mode, without any file watchers.
- The
build
- The
build
script executesnpm run build
in the context of theclient
folder. This builds your React app for production. This is used during deployment, and not commonly needed during development.
- The
db:import
- The
db:import
script executesdatabase/import.sh
, which executes thedatabase/schema.sql
anddatabase/data.sql
files to build and populate your database.
- The
dev
- Starts all the development servers.
lint
- Runs ESLint against all the client and server code.
- Not directly used by developer
install:*
- These scripts install dependencies in the
client
andserver
folders, and copy.env.example
to.env
if it doesn't already exist.
dev:*
- These scripts start the individual development servers.
lint:*
- These scripts run lint in the client and server directories.
postinstall
- The
postinstall
script is automatically run when you runnpm install
. It is executed after the dependencies are installed. Specifically for this project thepostinstall
script is used to install theclient
andserver
dependencies.
- The
prepare
- The
prepare
script is similar topostinstall
— it is executed beforeinstall
. Specifically for this project it is used to installhusky
.
- The
deploy
- The
deploy
script is used to deploy the project by pushing themain
branch to thepub
branch, which triggers the GitHub Action that deploys the project.
- The