Skip to content

Commit 0790049

Browse files
committed
adding frontend example
1 parent 46a36d2 commit 0790049

36 files changed

+2911
-5
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ test_*
1313
*.yml
1414
!.github/workflows/*.yml
1515
.DS_Store
16-
.vscode
16+
.vscode
17+
node_modules
18+
*.pptx
19+
*.js
20+
CSC490

docs/customize/.DS_Store

-8 KB
Binary file not shown.

docs/examples/.DS_Store

-6 KB
Binary file not shown.

frontend/.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts

frontend/CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
openbrowser.me

frontend/README.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# OpenBrowser Frontend
2+
3+
A modern chat interface for OpenBrowser AI. Built with Next.js, TypeScript, and Tailwind CSS, this frontend provides a sleek dark-themed UI for interacting with browser automation agents.
4+
5+
## Features
6+
7+
- Real-time chat interface with WebSocket communication
8+
- Sidebar navigation with projects and task history
9+
- Support for both Browser Agent and Code Agent
10+
- Screenshot display for browser automation tasks
11+
- File attachment preview (CSV, JSON, text, code, images)
12+
- Real-time backend log streaming
13+
- Responsive design with dark theme
14+
15+
## Tech Stack
16+
17+
- **Next.js 16** - React framework with App Router
18+
- **TypeScript** - Type safety
19+
- **Tailwind CSS 4** - Styling
20+
- **Framer Motion** - Animations
21+
- **Zustand** - State management
22+
- **Lucide React** - Icons
23+
24+
## Development
25+
26+
```bash
27+
# Install dependencies
28+
npm install
29+
30+
# Start development server
31+
npm run dev
32+
33+
# Build for production
34+
npm run build
35+
36+
# Export static files for GitHub Pages
37+
npm run export
38+
```
39+
40+
## Deployment
41+
42+
This frontend is deployed to GitHub Pages at [openbrowser.me](https://openbrowser.me).
43+
44+
### Architecture
45+
46+
```
47+
+-------------------+ +-------------------+
48+
| openbrowser.me | HTTPS | api.openbrowser.me|
49+
| (GitHub Pages) | -------> | (Backend) |
50+
| Frontend | WSS | FastAPI + WS |
51+
+-------------------+ +-------------------+
52+
```
53+
54+
### GitHub Pages Deployment
55+
56+
The frontend is automatically deployed via GitHub Actions when you push to the main branch.
57+
58+
**Manual deployment:**
59+
60+
```bash
61+
# Build and export static files
62+
npm run export
63+
64+
# Deploy to gh-pages branch
65+
npm run deploy
66+
```
67+
68+
### Environment Variables
69+
70+
For **production** (set in GitHub Actions secrets or `.env.production`):
71+
72+
```env
73+
NEXT_PUBLIC_API_URL=https://api.openbrowser.me
74+
NEXT_PUBLIC_WS_URL=wss://api.openbrowser.me/ws
75+
```
76+
77+
For **local development** (create `.env.local`):
78+
79+
```env
80+
NEXT_PUBLIC_API_URL=http://localhost:8000
81+
NEXT_PUBLIC_WS_URL=ws://localhost:8000/ws
82+
```
83+
84+
### Backend Deployment
85+
86+
The backend must be deployed separately to a platform that supports:
87+
- Python/Docker containers
88+
- WebSocket connections
89+
- Persistent processes (for browser automation)
90+
91+
Recommended platforms:
92+
- **Railway** - Easy Docker deployment
93+
- **Render** - Free tier available
94+
- **DigitalOcean App Platform** - Good for production
95+
- **AWS EC2/ECS** - Full control
96+
97+
See `/backend/README.md` and `/DEPLOYMENT.md` for backend deployment instructions.
98+
99+
## Project Structure
100+
101+
```
102+
src/
103+
app/
104+
globals.css # Global styles
105+
layout.tsx # Root layout
106+
page.tsx # Main chat page
107+
components/
108+
chat/
109+
ChatInput.tsx # Message input with quick actions
110+
ChatMessage.tsx # Individual message display
111+
ChatMessages.tsx # Message list container
112+
FileAttachment.tsx # File preview component
113+
LogPanel.tsx # Backend logs panel
114+
layout/
115+
Header.tsx # Top navigation bar
116+
Sidebar.tsx # Left sidebar navigation
117+
ui/
118+
Button.tsx # Button component
119+
Input.tsx # Input component
120+
Textarea.tsx # Textarea component
121+
hooks/
122+
useWebSocket.ts # WebSocket connection hook
123+
lib/
124+
config.ts # Configuration constants
125+
utils.ts # Utility functions
126+
store/
127+
index.ts # Zustand store
128+
types/
129+
index.ts # TypeScript types
130+
```
131+
132+
## Connecting to Backend
133+
134+
The frontend connects to the OpenBrowser backend via WebSocket for real-time communication.
135+
136+
1. Deploy the backend (see `/backend/README.md`)
137+
2. Set environment variables to point to your backend URL
138+
3. The WebSocket connection will be established automatically on page load
139+
140+
## License
141+
142+
MIT

frontend/env.local.example

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# API Configuration
2+
# For production, use:
3+
# NEXT_PUBLIC_API_URL=https://api.openbrowser.me
4+
# NEXT_PUBLIC_WS_URL=wss://api.openbrowser.me/ws
5+
6+
# For local development:
7+
NEXT_PUBLIC_API_URL=http://localhost:8000
8+
NEXT_PUBLIC_WS_URL=ws://localhost:8000/ws
9+

frontend/eslint.config.mjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { defineConfig, globalIgnores } from "eslint/config";
2+
import nextVitals from "eslint-config-next/core-web-vitals";
3+
import nextTs from "eslint-config-next/typescript";
4+
5+
const eslintConfig = defineConfig([
6+
...nextVitals,
7+
...nextTs,
8+
// Override default ignores of eslint-config-next.
9+
globalIgnores([
10+
// Default ignores of eslint-config-next:
11+
".next/**",
12+
"out/**",
13+
"build/**",
14+
"next-env.d.ts",
15+
]),
16+
]);
17+
18+
export default eslintConfig;

frontend/next.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { NextConfig } from "next";
2+
3+
const nextConfig: NextConfig = {
4+
// Enable static export for GitHub Pages
5+
output: "export",
6+
7+
// Disable image optimization for static export
8+
images: {
9+
unoptimized: true,
10+
},
11+
12+
// Trailing slash for GitHub Pages compatibility
13+
trailingSlash: true,
14+
};
15+
16+
export default nextConfig;

frontend/postcss.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const config = {
2+
plugins: {
3+
"@tailwindcss/postcss": {},
4+
},
5+
};
6+
7+
export default config;

0 commit comments

Comments
 (0)