create-sb-react-express
โก Scaffold a modern full-stack monorepo with React + Tailwind (Vite) frontend and Express + PostgreSQL backend โ in seconds.
๐ฆ Features
- ๐งฉ Monorepo structure with
npmworkspaces - โ๏ธ Frontend: React + Vite + Tailwind CSS
- ๐ Backend: Express + PostgreSQL (via
pg) - ๐ณ Docker-ready (
docker-compose.ymlfor Postgres) - ๐งช Test-ready frontend structure
- โก Unified
npm run devto start both servers at once - ๐งฐ CLI-based scaffolding via
npx
๐ Install
npm i -g create-sb-react-express๐ Usage
npx create-sb-react-express my-app
cd my-app
npm installThen:
npm run devThis runs both frontend (Vite on :5173) and backend (Express on :3000) using concurrently.
๐ Folder Structure
my-app/
โโโ client/ # React + Tailwind (Vite)
โ โโโ src/
โ โ โโโ components/ # Reusable components
โ โ โโโ context/ # React contexts & tests
โ โ โโโ pages/ # Page-level components
โ โ โโโ api/ # Fetch helpers
โ โ โโโ main.jsx
โ โโโ tailwind.config.js
โ
โโโ server/ # Express + PostgreSQL
โ โโโ controllers/ # Route handlers
โ โโโ db/ # Postgres pool, queries, seed
โ โโโ routes/ # API routes
โ โโโ expressInit.js
โ โโโ docker-compose.yml
โ
โโโ package.json # Root workspace with scripts
๐ฆ Root package.json
The generated project uses npm workspaces and unified dev scripts:
{
"name": "sb-react-express",
"private": true,
"workspaces": [
"client",
"server"
],
"scripts": {
"client": "npm run dev --prefix client",
"server": "npm run dev --prefix server",
"start": "concurrently \"npm run client\" \"npm run server\"",
"dev": "concurrently \"npm run client\" \"npm run server\""
},
"devDependencies": {
"concurrently": "^8.2.0",
"nodemon": "^3.0.1"
}
}๐ ๏ธ Development Setup
1. Start Postgres, Express, Nginx via Docker
docker-compose up -d2. Visit localhost:8080
Visit http://localhost:8080, you can change the port at docker-compose.override.yml
โ ๏ธ Make sure the database service is up and reachable before running this script.
3. Rename .env.example to .env
In server and client there is .env.example files
cd client && mv .env.example .env && cd ..
cd server && mv .env.example .env && cd ..4. Atlternative: Start both client/server (make sure you set up DB)
From root:
npm run devYou can use the provided sserver/docker-compose.yml to setup a db quickly.
Production
docker-compose.ynml is ready for building the app.
๐ License
MIT
๐ Author
Made by Mohammad Dahamshi
๐ Website
Made with โค๏ธ by SaraWebs
On this page
Languages
JavaScript61.3%CSS26.2%Shell10.0%Dockerfile1.0%TypeScript0.9%HTML0.6%
Contributors
Created July 30, 2025
Updated August 6, 2025