A small fullstack sample app (Express + Postgres backend, React + Vite frontend) for managing cafes and employees. The repo contains separate backend/ and frontend/ apps and a small SQL initializer in backend/db_init.
- Backend: Node.js, Express, pg (Postgres), Joi (validation)
- Frontend: React (Vite), Ant Design, Axios
- Dev: nodemon (backend), Vite dev server (frontend), Tailwind (optional)
backend/— Express server, routes, controllers, database utilityfrontend/— Vite React app (components, pages, API client)backend/db_init— SQL used to create tables and seed example data
- Node.js (LTS recommended)
- npm or pnpm
- PostgreSQL (local or remote)
- Git (To clone repo)
- Clone the Repository
git clone hhttps://github.com/Engulfy/fullstack_app.git
cd fullstack_app- Install dependencies for both projects
# from repository root
cd backend
npm install
cd ../frontend
npm install- Configure environment variables
- Backend: create
backend/.env(do NOT commit). Example values:
# backend/.env (example)
PORT = 5001
DB_HOST = localhost
DB_PORT = 5432
DB_USER = your_db_user
DB_PASSWORD = your_db_password
DB_DATABASE = cafedb- Frontend: create
frontend/.env.development(or use the provided file). Example:
VITE_API_URL=http://localhost:5001- Initialize the database (one-time) Create a PostgreSQL database, e.g.:
CREATE DATABASE cafe_employee_db;Run the SQL scripts in backend/db_init using your preferred PostgreSQL client (e.g., psql, PgAdmin, DBeaver). This will:
- Create the necessary tables (cafes and employees)
- Seed example data
- Start the apps (in separate terminals)
# Backend (development)
cd backend
npm run dev
# Frontend (Vite)
cd frontend
npm run dev
# open http://localhost:5173 (Vite default)Note: Default backend port used by this project is 5001 (check backend/.env or backend/src/index.js). The frontend reads VITE_API_URL to determine where to call the API.