A social media web app powered by React, Gin, gRPC, and much more.
The portal application is split into services: auth, file, frontend, user, and post. These services communicate via gRPC and Protocol Buffer messages, defined here. All code not run in the browser is written in Go, but since each service runs in its own isolated Docker container and uses gRPC, they could be implemented in any supported language. The application uses the RDBMS MySQL and Object Storage Platform Minio for data storage.
The frontend service is split into two parts, a web app and a REST API that provides clients controlled access to the other services.
The web app is written with React, and uses a package-based architecture. Each package here, has a specific function, and contains all the state and UI management code needed for that function, or it is used as a build block for other packages. The app follows the Flux architecture, and uses Redux, Redux Saga, and a number of other libraries to accomplish this. It also uses styled components instead of stylesheets.
The REST API is a Go app that uses the Gin framework for routing. It serves the web app and provides routes for accessing user and post data here. These routes validate requests and call controllers that make necessary gRPC calls to the other services.
The auth service manages hashing and storing user passwords and admin data. It uses a MySQL table to manage this data, and has gRPC server handlers for accepting requests.
The file service manages uploading and fetching files. It uses Minio, an open source object store, and gRPC streams for its file data to accomplish this.
The user service manages user data such as name, description, and followers/following and fetching files. It uses two MySQL tables to manage this data, and has gRPC server handlers for accepting requests.
The post service manages user's posts, comments, and likes. It uses several MySQL tables to manage this data, and has gRPC server handlers for accepting requests.
- Install Docker Compose
- Clone this repo:
git clone https://github.com/mewil/portal
- Change directory to the deploy repo:
cd portal/deploy
- Start whatever environment you want
- Development
docker-compose -f development.yml up -d
- Your git repo will be linked to the development environment, so your local changes will be reflected with a container restart
- Production (more ENV data required)
docker-compose -f production.yml up -d
- NOTE: This takes care of setting up NGINX AND LetsEncrypt with the appropriate hosts and auto renewal
- Development
- Access
http://localhost:8000
and start developing! To view application logs, rundocker-compose -f development.yml logs -f