Skip to content

About

React starter template from Cloudways with PM2 and Apache proxy configuration to help developers get started with React applications.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Cloudways React Template

A minimal React + Vite starter you can deploy on Cloudways or any static host.

Includes a Cloudways-branded sample home page so you can confirm the deploy worked, then replace it with your own site.

Features

  • React 19 with TypeScript and Vite
  • Static site output (npm run build → dist/)
  • Cloudways-branded sample home page
  • .htaccess.example for SPA routing on Apache / Cloudways
  • Works on Cloudways, Netlify, Vercel, Cloudflare Pages, GitHub Pages, and any Apache/Nginx host

Quick start (local)

git clone https://github.com/YOUR_USERNAME/cloudways-react-template.git
cd cloudways-react-template
npm install
npm run dev

Open http://localhost:5173 to see the Cloudways-branded sample home page.

Command Description
npm run dev Start local development server
npm run build Build production files into dist/
npm run preview Preview the production build locally
npm run lint Run the linter

Deploy on Cloudways

Cloudways serves static sites from your application’s public_html directory over Apache (ports 80/443).

1. Create a Cloudways application

  1. Sign in to the Cloudways dashboard.
  2. Create a server (DigitalOcean, AWS, etc.).
  3. Add a new application (PHP/Custom Application is fine for static files).

2. Build the site

Option A — Build locally, then upload

npm install
npm run build

Upload the contents of dist/ into public_html/ via SFTP, or:

# Example: sync dist to Cloudways public_html
scp -r dist/* master@YOUR_SERVER_IP:~/applications/YOUR_APP/public_html/

Option B — Build on the server (SSH)

ssh master@YOUR_SERVER_IP
cd ~/applications/YOUR_APP/public_html
git clone https://github.com/YOUR_USERNAME/cloudways-react-template.git .
npm install
npm run build
# Move built files to the web root (or point the docroot at dist/)
cp -r dist/* .

3. Optional Apache rules

Copy .htaccess.example to public_html/.htaccess so client-side routes fall back to index.html.

For this single-page sample, Apache can serve the generated files as-is — no Node process or PM2 is required.

4. Verify

Visit your Cloudways application URL. You should see the Cloudways-branded sample home page.

Deploy elsewhere

This template is host-agnostic. Build once, deploy dist/.

Platform Notes
Netlify / Vercel / Cloudflare Pages Connect the repo; build command npm run build, publish directory dist
GitHub Pages Build in CI and publish dist/ (set base in vite.config.ts if needed)
Nginx / VPS / Docker Serve dist/ as the document root

Project structure

.
├── public/                 # Static assets (copied to dist as-is)
│   ├── cloudways-logo.svg
│   ├── favicon.ico
│   └── hero-cloud.svg
├── src/
│   ├── App.tsx             # Sample home page
│   ├── App.css             # Home page styles
│   ├── index.css           # Cloudways brand tokens
│   └── main.tsx            # React entry
├── .htaccess.example       # SPA fallback for Apache / Cloudways
├── index.html
├── vite.config.ts
└── package.json

Customization

  1. Edit src/App.tsx to replace the sample home page.
  2. Add components under src/ (or introduce React Router for multiple pages).
  3. Put images and other static files in public/.
  4. Update site metadata in index.html.

Troubleshooting (Cloudways)

Issue Fix
Blank page / old content Confirm public_html contains the latest dist/ output
CSS/images 404 Deploy the full dist/ folder, not only index.html
Client routes 404 Copy .htaccess.example to .htaccess
Build fails on server Use Node 20+ (node -v); upgrade via Cloudways if needed

License

MIT — see LICENSE.

Contributing

PRs welcome. Fork, branch, and open a pull request.


Use this repo as a GitHub template: click Use this template on GitHub to create your own project from this starter.

About

React starter template from Cloudways with PM2 and Apache proxy configuration to help developers get started with React applications.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages