[Vite+React] Vite-React,Postgresql Install-MacOS

๐Ÿ‘‰๐Ÿป Vite React๋Š” ์›น์‚ฌ์ดํŠธ๋ฅผ ๋งŒ๋“œ๋Š” ๊ฐœ๋ฐœ๋„๊ตฌ์ž…๋‹ˆ๋‹ค.
Vite React is a development tool for creating websites.

๐Ÿ‘‰๐Ÿป Vite๋Š” React ํ”„๋กœ์ ํŠธ์—์„œ ๋งค์šฐ ์ธ๊ธฐ ์žˆ๋Š” ๋นŒ๋“œ ๋„๊ตฌ์ด์ž ๊ฐœ๋ฐœ ์„œ๋ฒ„๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.
Vite is said to be a very popular build tool and development server for React projects.

๐Ÿ‘‰๐Ÿป Vite๋Š” ํ”„๋ž‘์Šค์–ด๋กœ “๋น ๋ฅด๋‹ค”๋ผ๋Š” ๋œป์ด๋ž๋‹ˆ๋‹ค. (๋ฐœ์Œ์€ ์˜์–ด๋กœ “veet”์ด๋ผ๊ณ  ์ฝ์Œ)
Vite means “fast” in French. (It’s pronounced “veet” in English.)

๐Ÿ‘‰๐Ÿป ๊ฐœ๋ฐœ์ž๋“ค์ด “๋นจ๋ฆฌ๋นจ๋ฆฌ ๊ฐœ๋ฐœํ•˜๊ณ  ์‹ถ๋‹ค”๋Š” ๋งˆ์Œ์„ ๋‹ด์•„์„œ ์ง€์€ ์ด๋ฆ„์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.
It is said that the name was created by developers with the intention of “wanting to develop quickly.”

๐Ÿ‘‰๐Ÿป ์š”์ฆ˜ ๊ฑฐ์˜ ๋ชจ๋“  ์ƒˆ๋กœ์šด React/Vue/Svelte ํ”„๋กœ์ ํŠธ์—์„œ Create React App ๋Œ€์‹  Vite + React ์กฐํ•ฉ์„ ๊ธฐ๋ณธ์œผ๋กœ ์„ ํƒํ•˜๋Š” ์ถ”์„ธ์ž…๋‹ˆ๋‹ค.
Nowadays, almost every new React/Vue/Svelte project is choosing the Vite + React combination as the default instead of Create React App.

๐Ÿ‘‰๐Ÿป React๋Š” ์›น์‚ฌ์ดํŠธ๋‚˜ ์•ฑ์—์„œ ํ™”๋ฉด(๋ฒ„ํŠผ, ๋ชฉ๋ก, ์ž…๋ ฅ์ฐฝ, ๋™์˜์ƒ ํ”Œ๋ ˆ์ด์–ด ๋“ฑ)์„ ์˜ˆ์˜๊ณ  ๋น ๋ฅด๊ฒŒ, ๊ทธ๋ฆฌ๊ณ  ๊ด€๋ฆฌํ•˜๊ธฐ ์‰ฝ๊ฒŒ ๋งŒ๋“œ๋Š” ๋„๊ตฌ ์ž…๋‹ˆ๋‹ค.
React is a tool for creating beautiful, fast, and easy-to-maintain screens (buttons, lists, input fields, video players, etc.) on websites and apps.

๐Ÿ‘‰๐Ÿป ์›น์‚ฌ์ดํŠธ ๊ฐœ๋ฐœ์ด ์ฃผ๋ ฅ ์—…๋ฌด๊ฐ€ ์•„๋‹ˆ๋”๋ผ๋„ ์„œ๋ฒ„๋ฅผ ๊ฐœ๋ฐœํ•˜๋‹ค๊ฐ€ ๋ณด๋ฉด ๊ด€๋ฆฌ์ž ํŒจ๋„ ์ •๋„๋Š” ์›น์„ ์‚ฌ์šฉํ•ด์•ผ ํ•  ์ผ์ด ์žˆ์Šต๋‹ˆ๋‹ค.
Even if website development isn’t your main job, you’ll probably need to use the web for things like the admin panel when developing servers.

๐Ÿ‘‰๐Ÿป ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋Š” postgresql์‚ฌ์šฉ ํ•ฉ๋‹ˆ๋‹ค.
The database uses PostgreSQL.

๐Ÿ‘‰๐Ÿป ์•„๋ž˜๋Š” MacOS์—์„œ VIte React ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ• ์ž…๋‹ˆ๋‹ค.
Below is how to install VIte React on macOS.

# 1. ์ตœ์‹  Vite + React + TypeScript ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ 
# Create a modern Vite + React + TypeScript project

npm create vite@latest ReactExample -- --template react-ts

# ๋งŒ์•ฝ yarn ์“ฐ์‹ ๋‹ค๋ฉด:
# If you use yarn:

# yarn create vite ReactExample --template react-ts

# 2. ํ”„๋กœ์ ํŠธ ํด๋”๋กœ ์ด๋™
# Go to the project folder

cd ReactExample

# 3. ์˜์กด์„ฑ ์„ค์น˜
# Installing dependencies

npm install

# 4. ๊ฐœ๋ฐœ ์„œ๋ฒ„ ์‹คํ–‰ (์ž๋™์œผ๋กœ ๋ธŒ๋ผ์šฐ์ € ์—ด๋ฆผ)
# Run the development server (browser opens automatically)

npm run dev

โœ”๏ธ ํ„ฐ๋ฏธ๋„์—์„œ npm create vite@latest ReactExample — –template react-ts ์‹คํ–‰ํ•  ๊ฒฝ์šฐ ์•„๋ž˜์˜ ๋‚ด์šฉ์„ ์ฐธ์กฐ ํ•˜์„ธ์š”
If you run npm create vite@latest ReactExample — –template react-ts in the terminal, see below.

โœ”๏ธ “Use rolldown-vite (Experimental)? ” ์ด ๋ถ€๋ถ„์„ yesํ•˜๋ฉด ์•ˆ์ •ํ™” ๋ฒ„์ „์ด ์•„๋‹Œ ์‹คํ—˜์ ์ธ ์ตœ์‹ ๋ฒ„์ „์ด ์„ค์น˜๋ฉ๋‹ˆ๋‹ค.
“Use rolldown-vite (Experimental)?” If you answer yes to this part, the experimental latest version will be installed, not the stable version.

% npm create vite@latest ReactExample -- --template react-ts

> npx
> "create-vite" ReactExample --template react-ts

โ”‚
โ—‡  Package name:
โ”‚  reactexample
โ”‚
โ—‡  Use rolldown-vite (Experimental)?:
โ”‚  No
โ”‚
โ—†  Install with npm and start now?
โ”‚  โ— Yes / โ—‹ No

โœ”๏ธ ์—”ํ„ฐ๋กœ ๊ณ„์† ์ง„ํ–‰ํ•˜๋ฉด ์•„๋ž˜ ์ฒ˜๋Ÿผ ๋ฉ”์„ธ์ง€๊ฐ€ ํ„ฐ๋ฏธ๋„์— ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.
If you continue by pressing Enter, a message like the one below will be printed in the terminal.

โœ”๏ธ๊ทธ๋Ÿฌ๋ฉด ์—ฌ๋Ÿฌ๋ถ„์˜ pc์—์„œ ๋ธŒ๋ผ์šฐ์ €๋ฅผ ์—ด๊ณ  http://localhost:5173 ์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
Then open a browser on your PC and go to http://localhost:5173.

  VITE v7.3.1  ready in 257 ms

  โžœ  Local:   http://localhost:5173/
  โžœ  Network: use --host to expose
  โžœ  press h + enter to show help

โœ”๏ธ ๋ชจ๋“  ๊ณผ์ •์ด ์ •์ƒ์ ์ด๋ฉด ๋ธŒ๋ผ์šฐ์ €์—์„œ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ™”๋ฉด์„ ๋ณด์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
If everything went well, you will see the following screen in your browser:

โœ”๏ธ ํ„ฐ๋ฏธ๋„์—์„œ ๊ฐœ๋ฐœ ์„œ๋ฒ„ ์ค‘์ง€ ํ• ๋•Œ๋Š” ctrl + cํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.
To stop the development server in the terminal, just press ctrl + c.

๐Ÿ‘‰๐Ÿปpostgresql ์„ค์น˜
install postgresql

โœ”๏ธ ํ™˜๊ฒฝ๋ณ€์ˆ˜์„ค์ • ๋ฐ ์‹คํ–‰
Setting environment variables and running

— ํ™˜๊ฒฝ๋ณ€์ˆ˜ ์„ค์ •์ด ๋˜์–ด์žˆ์ง€ ์•Š์œผ๋ฉด psql postgres ์ด ๋ช…๋ น์–ด๋ฅผ ๋ชป์ฐพ์Šต๋‹ˆ๋‹ค.
If the environment variable is not set, the psql postgres command will not be found.

— ํ•ด๋‹น ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•ด์„œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ด์ค˜์•ผํ•ฉ๋‹ˆ๋‹ค.
You need to go to that directory and run the command.

— ํ™˜๊ฒฝ๋ณ€์ˆ˜๊ฐ€ ์ž˜ ๋“ฑ๋ก๋˜๋ฉด psql postgres์ฒ˜๋Ÿผ ๊ฐ„๋‹จํžˆ postgresql์„ ์‹คํ–‰ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
Once the environment variables are properly registered, you can run postgresql simply like psql postgres.

# Homebrew postgresql@17์˜ bin ๊ฒฝ๋กœ ์ถ”๊ฐ€ (Apple Silicon Mac ๊ธฐ์ค€)
# Add the bin path for Homebrew postgresql@17 (based on Apple Silicon Mac)

echo 'export PATH="/opt/homebrew/opt/postgresql@17/bin:$PATH"' >> ~/.zshrc

# Intel Mac์ด๋ฉด /usr/local/opt/... ์ผ ์ˆ˜ ์žˆ์Œ โ†’ ์•„๋ž˜๋กœ ๋Œ€์ฒด
# If you have an Intel Mac, it may be /usr/local/opt/... โ†’ Replace with below

# echo 'export PATH="/usr/local/opt/postgresql@17/bin:$PATH"' >> ~/.zshrc

# ๋ณ€๊ฒฝ ์ ์šฉ (ํ„ฐ๋ฏธ๋„ ์žฌ์‹œ์ž‘ ์—†์ด ๋ฐ”๋กœ)
# Apply changes (immediately without restarting the terminal)
source ~/.zshrc

# ๋‹ค์‹œ ํ™•์ธ
# check again
psql --version

# ์‹คํ–‰ ,Mac์—์„œ๋Š”์ด๋ ‡๊ฒŒ ์‹คํ–‰ํ•˜๋ฉด ๋จ ์ˆ˜ํผ์œ ์ €๊ฐ€ postgres๊ฐ€ ์•„๋‹˜.
# Run , on Mac, run like this. The superuser is not postgres.
psql postgres

โœ”๏ธ psql postgres ์‹คํ–‰์‹œ ๋‹ค์Œ ์ฒ˜๋ฆ„ ํ”„๋กฌํ”„ํŠธ๊ฐ€ ๋ฐ”๋€Œ๋ฉด ์ •์ƒ์ ์œผ๋กœ ์„ค์น˜๋œ๊ฒ๋‹ˆ๋‹ค.
If the prompt changes to the following when running psql postgres, it has been installed successfully.

postgres=# 

Leave a Reply