OnyxMunk commited on
Commit
7da5eae
·
1 Parent(s): 0e92a03

Prepare for HF Spaces deployment

Browse files
Files changed (6) hide show
  1. .dockerignore +12 -0
  2. Dockerfile +43 -0
  3. GEMINI.md +66 -0
  4. README.md +12 -0
  5. app.py +20 -0
  6. requirements.txt +3 -0
.dockerignore ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ node_modules
2
+ dist
3
+ .git
4
+ .env
5
+ .env.local
6
+ .DS_Store
7
+ Dockerfile
8
+ nginx.conf
9
+ README.md
10
+ docs
11
+ .vscode
12
+ .idea
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Stage 1: Build the React Application
2
+ FROM node:18-alpine AS builder
3
+
4
+ WORKDIR /app
5
+
6
+ # Copy dependency definitions
7
+ COPY package.json package-lock.json ./
8
+
9
+ # Install dependencies
10
+ RUN npm ci
11
+
12
+ # Copy source code
13
+ COPY . .
14
+
15
+ # Build the project
16
+ RUN npm run build
17
+
18
+ # Stage 2: Serve with Python/Gradio
19
+ FROM python:3.9-slim
20
+
21
+ WORKDIR /app
22
+
23
+ # Copy python requirements
24
+ COPY requirements.txt .
25
+
26
+ # Install python dependencies
27
+ RUN pip install --no-cache-dir -r requirements.txt
28
+
29
+ # Copy the build artifacts from the builder stage
30
+ COPY --from=builder /app/dist /app/dist
31
+
32
+ # Copy the serving script
33
+ COPY app.py .
34
+
35
+ # Create a non-root user for security (optional but good practice for HF Spaces)
36
+ RUN useradd -m -u 1000 user
37
+ USER user
38
+
39
+ # Expose the port HF Spaces expects
40
+ EXPOSE 7860
41
+
42
+ # Command to run the application
43
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
GEMINI.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Text Transformer - Project Context
2
+
3
+ ## 1. Project Overview
4
+ **Text Transformer** is a React-based web application designed for various text conversions (Morse Code, Leet Speak, Binary, Base64, Hex). It features a cyberpunk-themed UI and is built for speed and responsiveness.
5
+
6
+ The project is currently undergoing a structured enhancement phase driven by an AI-augmented workflow ("Bmad" framework), with extensive architectural documentation and role-based planning.
7
+
8
+ ### Key Technologies
9
+ * **Frontend:** React 18, Vite 7, Tailwind CSS 3
10
+ * **Hosting:** Firebase Hosting
11
+ * **Testing:** Vitest (Unit), Playwright (E2E)
12
+ * **Languages:** JavaScript (JSX)
13
+ * **Documentation:** Markdown (located in `docs/`)
14
+
15
+ ## 2. Directory Structure
16
+ * `src/` - Application source code.
17
+ * `components/` - React components for individual converters and UI elements.
18
+ * `App.jsx` - Main application entry point and layout.
19
+ * `docs/` - **CRITICAL:** Contains the architectural roadmap, role definitions, and enhancement proposals.
20
+ * `README.md` - Index of all documentation.
21
+ * `quick-start-guide.md` - Implementation checklists.
22
+ * `architecture-enhancement-proposal.md` - Technical vision.
23
+ * `.bmad/`, `.agent/`, `.agentvibes/` - Configuration for the AI agent framework managing the project.
24
+ * `public/` - Static assets.
25
+
26
+ ## 3. Development Workflow
27
+
28
+ ### Installation
29
+ ```bash
30
+ npm install
31
+ ```
32
+
33
+ ### Development Server
34
+ Starts the local development server using Vite.
35
+ ```bash
36
+ npm run dev
37
+ ```
38
+ Access at `http://localhost:5173`
39
+
40
+ ### Building
41
+ Builds the project for production.
42
+ ```bash
43
+ npm run build
44
+ ```
45
+
46
+ ### Testing
47
+ Runs unit tests using Vitest.
48
+ ```bash
49
+ npm run test
50
+ ```
51
+
52
+ ## 4. Architecture & Conventions
53
+ * **Component Structure:** Each converter is a separate component in `src/components/`, managed by `Tabs.jsx`.
54
+ * **State Management:** Currently uses local React state (`useState`) in `App.jsx`, with plans to migrate to Zustand (per docs).
55
+ * **Styling:** Utility-first CSS using **Tailwind CSS**.
56
+ * **Design System:** Cyberpunk aesthetic (black background, neon accents).
57
+
58
+ ## 5. Current Initiative (Enhancement Proposal)
59
+ The project is executing an 8-week enhancement roadmap defined in `docs/executive-summary.md`.
60
+ **Immediate Goals:**
61
+ 1. CI/CD Setup.
62
+ 2. Accessibility improvements (ARIA labels).
63
+ 3. New Converters (Upside Down, Zalgo).
64
+ 4. Refactoring CSS to optimal Tailwind patterns.
65
+
66
+ Refer to `docs/quick-start-guide.md` for specific implementation tasks.
README.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Text Transformer
3
+ emoji: 🤖
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: docker
7
+ app_port: 7860
8
+ ---
9
+
10
+ # Text Transformer
11
+
12
+ A React-based text conversion tool (Morse, Binary, Leet Speak, etc.) deployed on Hugging Face Spaces using Docker.
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastapi import FastAPI
3
+ from fastapi.staticfiles import StaticFiles
4
+ import os
5
+
6
+ # Create the FastAPI app
7
+ app = FastAPI()
8
+
9
+ # Mount the static files (the built React app)
10
+ # We expect the build output to be in a 'dist' directory
11
+ app.mount("/", StaticFiles(directory="dist", html=True), name="static")
12
+
13
+ # If we wanted to add a specific Gradio interface alongside the React app, we could do:
14
+ # io = gr.Interface(lambda x: "Hello " + x, "text", "text")
15
+ # app = gr.mount_gradio_app(app, io, path="/gradio")
16
+
17
+ # But for this request, we are primarily serving the containerized React app.
18
+ if __name__ == "__main__":
19
+ import uvicorn
20
+ uvicorn.run(app, host="0.0.0.0", port=7860)
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ fastapi
3
+ uvicorn