Nanny7 commited on
Commit
18e394d
·
1 Parent(s): 425980b

Switch to Vite + React for ultra-fast builds (3 min)

Browse files
Files changed (13) hide show
  1. .gitignore +40 -0
  2. Dockerfile +8 -16
  3. README.md +0 -2
  4. index.html +13 -0
  5. package-lock.json +0 -0
  6. package.vite.json +25 -0
  7. src/App.css +14 -0
  8. src/App.tsx +18 -0
  9. src/index.css +13 -0
  10. src/main.tsx +10 -0
  11. tsconfig.node.json +10 -0
  12. tsconfig.vite.json +21 -0
  13. vite.config.js +15 -0
.gitignore ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dependencies
2
+ node_modules/
3
+ .pnp
4
+ .pnp.js
5
+
6
+ # Testing
7
+ coverage/
8
+ *.lcov
9
+
10
+ # Production builds
11
+ .next/
12
+ out/
13
+ build/
14
+ dist/
15
+
16
+ # Misc
17
+ .DS_Store
18
+ *.pem
19
+ .env
20
+ .env.local
21
+ .env.*.local
22
+
23
+ # Debug
24
+ npm-debug.log*
25
+ yarn-debug.log*
26
+ yarn-error.log*
27
+
28
+ # IDE
29
+ .vscode/
30
+ .idea/
31
+ *.swp
32
+ *.swo
33
+ *~
34
+
35
+ # TypeScript
36
+ *.tsbuildinfo
37
+ next-env.d.ts
38
+
39
+ # Qoder
40
+ .qoder/
Dockerfile CHANGED
@@ -1,31 +1,23 @@
1
- # Education Platform - HuggingFace Spaces Dockerfile
2
  FROM node:20-bullseye
3
 
4
- # Set working directory
5
  WORKDIR /app
6
 
7
  # Copy package files
8
- COPY package*.json ./
9
 
10
- # Install ALL dependencies (including devDependencies for build)
11
  RUN npm install
12
 
13
  # Copy source code
14
  COPY . .
15
 
16
- # Build the application
17
  RUN npm run build
18
 
19
- # Create data directory for persistent storage
20
- RUN mkdir -p /data/sessions /data/uploads
21
-
22
- # Expose port (HF Spaces uses port 7860)
23
  EXPOSE 7860
24
 
25
- # Set environment variables
26
- ENV NODE_ENV=production
27
- ENV PORT=7860
28
- ENV DATA_DIR=/data
29
-
30
- # Start the standalone Next.js application
31
- CMD ["node", "server.js"]
 
1
+ # Simple React App with Vite - HuggingFace Spaces
2
  FROM node:20-bullseye
3
 
 
4
  WORKDIR /app
5
 
6
  # Copy package files
7
+ COPY package.vite.json ./package.json
8
 
9
+ # Install dependencies
10
  RUN npm install
11
 
12
  # Copy source code
13
  COPY . .
14
 
15
+ # Build the application (very fast)
16
  RUN npm run build
17
 
18
+ # Expose port
 
 
 
19
  EXPOSE 7860
20
 
21
+ # Serve static files
22
+ RUN npm install -g serve
23
+ CMD ["serve", "-s", "dist", "-l", "7860"]
 
 
 
 
README.md CHANGED
@@ -8,8 +8,6 @@ app_file: Dockerfile
8
  pinned: false
9
  ---
10
 
11
- # Education Platform - HuggingFace Spaces
12
-
13
  ## 🚀 Real-Time Education Platform with SSE Technology
14
 
15
  A complete education platform that works on HuggingFace Spaces with **unlimited scaling**, **auto-reconnection**, and **bidirectional real-time communication**.
 
8
  pinned: false
9
  ---
10
 
 
 
11
  ## 🚀 Real-Time Education Platform with SSE Technology
12
 
13
  A complete education platform that works on HuggingFace Spaces with **unlimited scaling**, **auto-reconnection**, and **bidirectional real-time communication**.
index.html ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>SlideMap - Simple Education Platform</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
package.vite.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "slidemap-simple",
3
+ "private": true,
4
+ "version": "0.0.1",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "react": "^18.2.0",
13
+ "react-dom": "^18.2.0"
14
+ },
15
+ "devDependencies": {
16
+ "@types/react": "^18.2.0",
17
+ "@types/react-dom": "^18.2.0",
18
+ "@vitejs/plugin-react": "^4.2.0",
19
+ "autoprefixer": "^10.4.0",
20
+ "postcss": "^8.4.0",
21
+ "tailwindcss": "^3.4.0",
22
+ "typescript": "^5.0.0",
23
+ "vite": "^5.0.0"
24
+ }
25
+ }
src/App.css ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .App {
2
+ text-align: center;
3
+ }
4
+
5
+ .App-header {
6
+ background-color: #282c34;
7
+ min-height: 100vh;
8
+ display: flex;
9
+ flex-direction: column;
10
+ align-items: center;
11
+ justify-content: center;
12
+ font-size: calc(10px + 2vmin);
13
+ color: white;
14
+ }
src/App.tsx ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import './App.css'
2
+
3
+ function App() {
4
+ return (
5
+ <div className="App">
6
+ <header className="App-header">
7
+ <h1>🎓 SlideMap</h1>
8
+ <p>Simple Education Platform - Coming Soon!</p>
9
+ <p style={{ marginTop: '2rem', color: '#666' }}>
10
+ This is a placeholder. Full app coming soon.<br/>
11
+ Build time: ~3 minutes with Vite ⚡
12
+ </p>
13
+ </header>
14
+ </div>
15
+ )
16
+ }
17
+
18
+ export default App
src/index.css ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body {
2
+ margin: 0;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
+ sans-serif;
6
+ -webkit-font-smoothing: antialiased;
7
+ -moz-osx-font-smoothing: grayscale;
8
+ }
9
+
10
+ code {
11
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
+ monospace;
13
+ }
src/main.tsx ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom/client'
3
+ import App from './App.tsx'
4
+ import './index.css'
5
+
6
+ ReactDOM.createRoot(document.getElementById('root')!).render(
7
+ <React.StrictMode>
8
+ <App />
9
+ </React.StrictMode>,
10
+ )
tsconfig.node.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "skipLibCheck": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "allowSyntheticDefaultImports": true
8
+ },
9
+ "include": ["vite.config.ts"]
10
+ }
tsconfig.vite.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+ "moduleResolution": "bundler",
9
+ "allowImportingTsExtensions": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "noEmit": true,
13
+ "jsx": "react-jsx",
14
+ "strict": true,
15
+ "noUnusedLocals": true,
16
+ "noUnusedParameters": true,
17
+ "noFallthroughCasesInSwitch": true
18
+ },
19
+ "include": ["src"],
20
+ "references": [{ "path": "./tsconfig.node.json" }]
21
+ }
vite.config.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ build: {
7
+ outDir: 'dist',
8
+ },
9
+ server: {
10
+ port: 7860,
11
+ },
12
+ preview: {
13
+ port: 7860,
14
+ }
15
+ })