pearlselvan/testreact
0
Hello World React App
A simple React TypeScript application ready to deploy on Hugging Face Spaces.
๐ Deploy to Hugging Face Spaces
Step 1: Create a Hugging Face Space
- Go to Hugging Face and sign in
- Click on your profile โ "New Space"
- Choose a name for your Space
- Select Docker as the Space SDK
- Choose visibility (Public or Private)
- Click "Create Space"
Step 2: Push Your Code
Option A: Using Git
# Initialize git repository (if not already initialized)
git init
# Add Hugging Face Space as remote
git remote add space https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
# Add and commit your files
git add .
git commit -m "Initial commit"
# Push to Hugging Face
git push space mainOption B: Using Hugging Face Web Interface
- Go to your Space page
- Click "Files" tab
- Upload the following files:
Dockerfilenginx.confpackage.jsontsconfig.jsonpublic/foldersrc/folder
Step 3: Wait for Build
Hugging Face will automatically build your Docker container. This may take 5-10 minutes. You can monitor the build logs in the Space's "Logs" tab.
Step 4: Access Your App
Once built, your app will be available at: https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space
๐ ๏ธ Local Development
# Install dependencies
npm install
# Start development server
npm start
# Build for production
npm run build๐ Project Structure
hello-world-react
โโโ public/
โ โโโ index.html
โโโ src/
โ โโโ App.tsx
โ โโโ App.css
โ โโโ index.tsx
โ โโโ index.css
โโโ Dockerfile
โโโ nginx.conf
โโโ package.json
โโโ tsconfig.json
โโโ README.md๐ Notes
- The app runs on port 7860 (Hugging Face Spaces default)
- Docker multi-stage build optimizes image size
- Nginx serves the production build efficiently
๐ง Troubleshooting
If your Space doesn't start:
- Check the "Logs" tab for build errors
- Ensure
Dockerfileis in the root directory - Verify all dependencies are in
package.json - Make sure port 7860 is exposed in the Dockerfile
