A modern social media platform built with Go and React
View Demo
Β·
Report Bug
Β·
Request Feature
Table of Contents
Ryo.cat is a modern, full-stack social media platform that combines the power of Go's performance with React's dynamic user interface. The platform features a robust authentication system, media sharing capabilities, and a clean, responsive design with dark/light theme support.
Key Highlights:
- Secure Authentication: Google OAuth integration with JWT token management
- Media Sharing: Support for image and video uploads with cloud storage
- Admin Features: Administrative controls for content management
- Responsive Design: Mobile-first approach with TailwindCSS
- Real-time Updates: Modern React Query for efficient data fetching
- Dark/Light Theme: Seamless theme switching for better user experience
The platform is designed to be scalable, maintainable, and provides a solid foundation for building modern social applications.
This project leverages modern technologies and frameworks to deliver a robust and scalable social media platform:
Backend:
Frontend:
Database & Storage:
Authentication:
To get a local copy up and running, follow these simple steps.
Make sure you have the following installed on your system:
Backend Requirements:
- Go 1.24 or later
go version
Frontend Requirements:
- Node.js 18+ and bun (or pnpm)
node --version bun --version
-
Clone the repository
git clone https://github.com/lucialv/ryo.cat.git cd ryo.cat -
Backend Setup
cd api # Install Go dependencies go mod download # Copy environment variables cp .env.example .env # Edit .env with your configuration nano .env
-
Frontend Setup
cd ../web # Install dependencies bun install # Copy environment variables cp .env.example .env # Edit .env with your API URL nano .env
-
Environment Configuration
API (.env):
ADDR=:8080 FRONTEND_URL=http://localhost:5173 EXTERNAL_URL=http://localhost:8080 ENV=development JWT_SECRET=your-jwt-secret GOOGLE_CLIENT_ID=your-google-client-id GOOGLE_AUD=your-google-client-id GOOGLE_ISS=https://accounts.google.com DB_URL=your-database-url DB_TOKEN=your-database-token BUCKET_NAME=your-bucket-name ACCOUNT_ID=your-cloudflare-account-id ACCESS_KEY_ID=your-access-key ACCESS_KEY_SECRET=your-secret-key
Web (.env):
VITE_API_URL=http://localhost:8080
-
Database Setup
cd api # Run database migrations (if needed) # The app will auto-migrate on startup
-
Start the Development Servers
Backend (Terminal 1):
cd api go run cmd/main.goFrontend (Terminal 2):
cd web bun dev -
Access the Application
- Frontend: http://localhost:5173
- Backend API: http://localhost:8080
- Sign in with your Google account
- Secure JWT-based session management
- Automatic token refresh and validation
- Admin users can create posts with rich media content
- Support for images and videos
- Drag-and-drop file upload interface
- Upload and manage profile pictures
- Update personal information
- View post history
- Browse posts from all users
- Infinite scroll for seamless browsing
- Responsive design for mobile and desktop
For more examples and detailed API documentation, please refer to the API Documentation
- Google OAuth 2.0 integration
- JWT token-based authentication
- Secure cookie management
- Role-based access control (Admin/User)
- Modern, responsive design
- Dark/Light theme toggle
- Mobile-first approach
- Smooth animations and transitions
- Infinite scroll for posts
- Image and video upload support
- Cloud storage integration (Cloudflare R2)
- Automatic media optimization
- Media viewer with navigation controls
- Profile picture management
- User information display
- Post history and management
- Admin badges and permissions
- Efficient data fetching with React Query
- Optimized bundle size with Vite
- Lazy loading and code splitting
- Server-side rendering ready
GET /v1/login- Google OAuth loginPOST /v1/logout- User logout
GET /v1/profile- Get user profilePUT /v1/profile/picture- Update profile picturePOST /v1/profile/picture/upload- Upload profile pictureDELETE /v1/profile/picture- Delete profile picture
GET /v1/posts- Get all posts (paginated)POST /v1/posts- Create new post (Admin only)GET /v1/posts/:id- Get specific postDELETE /v1/posts/:id- Delete post (Admin only)GET /v1/posts/user/:userId- Get posts by userPOST /v1/posts/media/upload- Upload media for posts (Admin only)
POST /v1/storage/upload- Upload file to storageDELETE /v1/storage/:key- Delete file from storage
ryo.cat/
βββ api/ # Backend Go application
β βββ cmd/
β β βββ main.go # Application entry point
β β βββ api/ # API handlers and middleware
β βββ internal/
β β βββ auth/ # Authentication logic
β βββ pkg/
β β βββ env/ # Environment configuration
β β βββ storage/ # Cloud storage integration
β β βββ store/ # Database operations
β β βββ utils/ # Utility functions
β βββ go.mod # Go module dependencies
β βββ .env.example # Environment variables template
β
βββ web/ # Frontend React application
β βββ src/
β β βββ api/ # API client functions
β β βββ components/ # Reusable React components
β β βββ context/ # React context providers
β β βββ hooks/ # Custom React hooks
β β βββ pages/ # Page components
β β βββ assets/ # Static assets
β βββ public/ # Public assets
β βββ package.json # Node.js dependencies
β βββ .env.example # Environment variables template
β
βββ LICENSE # MIT License
βββ README.md # Project documentation
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow Go best practices for backend development
- Use TypeScript strictly for frontend development
- Maintain consistent code formatting
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
Distributed under the MIT License. See LICENSE for more information.
LucΓa Γlvarez - @lucialv
Project Link: https://github.com/lucialv/ryo.cat
Special thanks to the amazing tools and resources that made this project possible:
