A full-stack TypeScript monorepo with Express backend, React frontend, and Supabase database.
Required tools:
- Node.js 22+
- npm
- Git
# Clone the repository
git clone <your-repo-url>
cd base-project
# Install all dependencies
npm run install:all
# Build shared types package
cd packages/shared && npm run build && cd ../..
# Set up environment files
cd packages/backend && cp .env.example .env
cd ../frontend && cp .env.example .env && cd ../..
# Start both frontend and backend
npm run devThat's it! π
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001/api
- Health check: http://localhost:3001/api/health
- ποΈ Architecture Overview
- π§ Prerequisites
- ποΈ Database Setup (Supabase)
- π₯οΈ Backend Deployment (Render)
- π Frontend Deployment (Netlify)
- π Final Configuration
- β Testing Your Production Setup
- π οΈ Troubleshooting
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Backend β β Database β
β (Netlify) βββββΆβ (Render) βββββΆβ (Supabase) β
β React + TS β β Express + TS β β PostgreSQL β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
Live URLs after deployment:
- Frontend:
https://your-app.netlify.app - Backend API:
https://your-backend.onrender.com/api - Database: Managed by Supabase
Before starting, ensure you have accounts on:
- GitHub (for code repository)
- Supabase (database)
- Render (backend hosting)
- Netlify (frontend hosting)
-
Sign up/Login to Supabase
-
Create New Project
- Project name:
project-template-db(or your choice) - Database password: Generate and save securely
- Region: Choose closest to your users
- Click "Create new project"
- Project name:
-
Wait for setup (1-2 minutes)
- Go to SQL Editor in the left sidebar
- Click "New Query"
- Copy and paste this SQL:
-- Create the items table
CREATE TABLE IF NOT EXISTS items (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(255) NOT NULL,
type VARCHAR(100) NOT NULL,
amount DECIMAL(10, 2) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Create indexes for better performance
CREATE INDEX IF NOT EXISTS idx_items_type ON items(type);
CREATE INDEX IF NOT EXISTS idx_items_created_at ON items(created_at);
-- Enable Row Level Security
ALTER TABLE items ENABLE ROW LEVEL SECURITY;
-- Create policy to allow all operations (adjust as needed)
CREATE POLICY "Allow all operations on items" ON items
FOR ALL
TO public
USING (true)
WITH CHECK (true);- Click "RUN" to execute
- Go to Settings β API
- Copy and save these values:
- Project URL:
https://xxxxxxxxxxxxx.supabase.co - Anon Key:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... - Service Role Key:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...(for production)
- Project URL:
β οΈ Keep these credentials secure! Never commit them to git.
- Push your code to GitHub (if not already done):
git add .
git commit -m "Ready for production deployment"
git push origin main-
Sign up/Login to Render
-
Connect GitHub account if not already connected
-
Create New Web Service
- Click "New +" β "Web Service"
- Connect your repository
- Select your
project-templaterepository
-
Configure the service:
- Name:
project-template-backend - Region: Oregon (or closest to your users)
- Branch:
main - Root Directory:
packages/backend - Runtime: Node
- Build Command:
cd ../shared && npm install && npm run build && cd ../backend && npm ci --include=dev && npm run build
- Start Command:
npm start - Instance Type: Free
- Name:
In the Render dashboard, go to Environment tab and add:
| Key | Value | Notes |
|---|---|---|
NODE_ENV |
production |
|
CORS_ORIGIN |
https://your-frontend-url.netlify.app |
Update after frontend deployment |
SUPABASE_URL |
https://xxxxx.supabase.co |
From Supabase dashboard |
SUPABASE_ANON_KEY |
eyJhbGciOiJIUzI1... |
From Supabase dashboard |
SUPABASE_SERVICE_ROLE_KEY |
eyJhbGciOiJIUzI1... |
From Supabase dashboard (optional) |
- Click "Create Web Service"
- Wait for deployment (5-10 minutes)
- Test your backend: Visit
https://your-backend.onrender.com/api/health
π Save your backend URL - you'll need it for frontend configuration!
-
Sign up/Login to Netlify
-
Import Project
- Click "Add New..." β "Project"
- Import from GitHub
- Select your
project-templaterepository
-
Configure the project:
- Project Name:
project-template-frontend - Framework Preset: Create React App
- Base Directory:
packages/frontend - Build Command:
cd ../shared && npm install && npm run build && cd ../frontend && npm install && npm run build
- Publish Directory:
packages/frontend/build
- Project Name:
In Netlify dashboard, go to Settings β Environment Variables:
| Key | Value | Environment |
|---|---|---|
REACT_APP_API_URL |
https://your-backend.onrender.com/api |
Production |
REACT_APP_ENV |
production |
Production |
- Click "Deploy"
- Wait for deployment (3-5 minutes)
- Test your frontend: Visit your Netlify URL
- Go back to Render (backend)
- Update Environment Variables:
- Set
CORS_ORIGINto your actual Netlify URL:https://your-app.netlify.app
- Set
- Redeploy the backend service
For Render:
- Go to Settings β Build & Deploy
- Enable Auto-Deploy:
Yes
For Netlify:
- Auto-deploy is enabled by default
Visit: https://your-backend.onrender.com/api/health
Expected response:
{
"success": true,
"data": {
"status": "healthy",
"timestamp": "2025-05-25T...",
"uptime": 123.45,
"environment": "production"
}
}Visit: https://your-app.netlify.app
Should show:
- β Items list loads successfully
- β Backend status shows "healthy"
- β Clicking items shows details
- β No CORS errors in browser console
- Go to Supabase Dashboard β Table Editor
- Check items table has data
- Verify new items appear when backend initializes
Your full-stack application is now running in production with:
- β Frontend on Netlify with global CDN
- β Backend on Render with auto-scaling
- β Database on Supabase with backups
- β HTTPS enabled everywhere
- β Auto-deployment from GitHub
Happy coding! π