pearlselvan/testreact
0
1---2title: Test React3emoji: ⚛️4colorFrom: blue5colorTo: purple6sdk: docker7pinned: false8---9 10# Hello World React App11 12A simple React TypeScript application ready to deploy on Hugging Face Spaces.13 14## 🚀 Deploy to Hugging Face Spaces15 16### Step 1: Create a Hugging Face Space17 181. Go to [Hugging Face](https://huggingface.co/) and sign in192. Click on your profile → "New Space"203. Choose a name for your Space214. Select **Docker** as the Space SDK225. Choose visibility (Public or Private)236. Click "Create Space"24 25### Step 2: Push Your Code26 27#### Option A: Using Git28 29```bash30# Initialize git repository (if not already initialized)31git init32 33# Add Hugging Face Space as remote34git remote add space https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME35 36# Add and commit your files37git add .38git commit -m "Initial commit"39 40# Push to Hugging Face41git push space main42```43 44#### Option B: Using Hugging Face Web Interface45 461. Go to your Space page472. Click "Files" tab483. Upload the following files:49 - `Dockerfile`50 - `nginx.conf`51 - `package.json`52 - `tsconfig.json`53 - `public/` folder54 - `src/` folder55 56### Step 3: Wait for Build57 58Hugging 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.59 60### Step 4: Access Your App61 62Once built, your app will be available at:63`https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space`64 65## 🛠️ Local Development66 67```bash68# Install dependencies69npm install70 71# Start development server72npm start73 74# Build for production75npm run build76```77 78## 📝 Project Structure79 80```81hello-world-react82├── public/83│ └── index.html84├── src/85│ ├── App.tsx86│ ├── App.css87│ ├── index.tsx88│ └── index.css89├── Dockerfile90├── nginx.conf91├── package.json92├── tsconfig.json93└── README.md94```95 96## 📋 Notes97 98- The app runs on port 7860 (Hugging Face Spaces default)99- Docker multi-stage build optimizes image size100- Nginx serves the production build efficiently101 102## 🔧 Troubleshooting103 104If your Space doesn't start:1051. Check the "Logs" tab for build errors1062. Ensure `Dockerfile` is in the root directory1073. Verify all dependencies are in `package.json`1084. Make sure port 7860 is exposed in the Dockerfile