A full-stack, AI-powered social media platform built on React frontend and Go backend for users to share images and videos. Users can register, create posts with images/videos, generate images with OpenAI DALL-E 3, and search or browse a shared collection.
- Account
- Register and sign in with JWT-based auth; stay signed in across sessions.
- Create content
- Manual posts: Add a message and upload an image or video.
- AI images: Enter a text prompt; the app uses DALL-E 3 to generate an image, then you can save it as a post.
- Collection
- View all posts in a photo gallery with lightbox (fullscreen, zoom, slideshow, thumbnails).
- Search by keywords (in post text) or by username.
- Delete your own posts.
- UI/UX
- Responsive layout, dark theme, nav bar, and toast notifications for actions.
| Layer | Technology |
|---|---|
| Frontend | React 18, React Router 6, Material-UI, Ant Design, Styled Components |
| Media / AI | react-photo-album, yet-another-react-lightbox, OpenAI SDK (DALL-E 3), Axios |
| Backend | Go (Gorilla Mux), JWT (Auth0 middleware) |
| Data | Elasticsearch (users + posts, search) |
| Storage | Google Cloud Storage (media files) |
| Deploy | Frontend: static build (e.g. hosting / CDN); Backend: Google App Engine Flex (Docker) |
Backend API: POST /signup, POST /signin, POST /upload, GET /search, DELETE /post/:id. Protected routes use Authorization: Bearer <token>.
.
├── backend/ # Go API service
│ ├── backend/ # Elasticsearch & GCS clients
│ ├── conf/ # deploy.yaml (gitignored), deploy.yaml.example
│ ├── constants/ # Index names etc.
│ ├── handler/ # HTTP handlers & router
│ ├── model/ # Data models
│ ├── service/ # Business logic
│ ├── util/ # Config loading
│ ├── main.go
│ ├── app.yaml # App Engine config
│ └── Dockerfile
├── public/ # Static assets for frontend
├── src/ # React app
│ ├── components/
│ ├── styles/
│ ├── constants.js
│ └── index.js
├── .env.example # Frontend env template
├── package.json # Frontend deps + root scripts
└── README.md
- Node.js 14+ and npm
- Go 1.25+ (for backend)
- Elasticsearch 7.x (for backend)
- Google Cloud project with GCS bucket (for backend media storage)
- OpenAI API key (for DALL-E 3 image generation in frontend)
git clone https://github.com/leo-Zhizhu/Social-AI-Frontend.git
cd Social-AI-Frontend
npm installcp .env.example .envEdit .env:
REACT_APP_BASE_URL=http://localhost:8080(local backend)REACT_APP_OPENAI_KEY=<your-openai-key>
cp backend/conf/deploy.yaml.example backend/conf/deploy.yamlEdit backend/conf/deploy.yaml with your Elasticsearch URL, username, password, GCS bucket name, and JWT secret. Do not commit this file.
Terminal 1 – backend (port 8080):
npm run start:backend
# or: cd backend && go run main.goTerminal 2 – frontend (port 3000):
npm startOpen http://localhost:3000. The app will call the backend at http://localhost:8080.
-
Config
- Ensure
backend/conf/deploy.yamlexists and is correct (not committed). App Engine may use Secret Manager or env vars for production; adjust to your setup.
- Ensure
-
Deploy
cd backend gcloud app deploy app.yamlBackend will be at
https://<project-id>.appspot.com(or your custom domain). -
Port
- Backend listens on
PORT(default 8080). GAE setsPORTautomatically.
- Backend listens on
-
Point to production API
- In your build environment, set:
REACT_APP_BASE_URL=https://<your-backend-url>(e.g.https://socialai-dot-socialai-477621.ue.r.appspot.com).
- Optional:
REACT_APP_OPENAI_KEYfor DALL-E (if you keep it in frontend; prefer backend proxy in production if possible).
- In your build environment, set:
-
Build
npm run build
Output is in
build/. -
Host
- Upload
build/to any static host (Firebase Hosting, Vercel, Netlify, Cloud Storage + Load Balancer, etc.).
- Upload
| Component | Command / action | Result |
|---|---|---|
| Backend | cd backend && gcloud app deploy app.yaml |
Live API on GAE |
| Frontend | Set REACT_APP_BASE_URL then npm run build; deploy build/ |
Live SPA |
- Frontend
.env:REACT_APP_BASE_URL,REACT_APP_OPENAI_KEY(see.env.example).
- Backend
backend/conf/deploy.yaml:elasticsearch(address, username, password),gcs(bucket),token(JWT secret). Copy frombackend/conf/deploy.yaml.example.
Sensitive data (.env, conf/deploy.yaml, API keys) must not be committed.
| Script | Description |
|---|---|
npm start |
Start frontend dev server |
npm run start:frontend |
Same as start |
npm run start:backend |
Run Go backend (backend/) |
npm run build |
Production frontend build |
npm test |
Frontend tests |
- Backend connection
- Confirm backend is running and
REACT_APP_BASE_URLmatches (e.g.http://localhost:8080locally).
- Confirm backend is running and
- CORS
- Backend allows
*origins; restrict in production if needed.
- Backend allows
- OpenAI errors
- Check
REACT_APP_OPENAI_KEYand OpenAI account/credits.
- Check
- Build
- If frontend build fails:
rm -rf node_modules package-lock.json && npm install.
- If frontend build fails:
Private / proprietary.
Built with React, Go, Elasticsearch, GCS, and OpenAI.