This repository contains the source code for the Tiktok Tech Immersion Backend Server Assignment project.
The project is a scalable messaging application backend that consists of an HTTP server, an RPC server, both coded in Go.
Data is stored in a Redis database.
- TikTok Tech Immersion 2023
- Project Description
- Code Template Repository
- Project Walkthrough by weixingp
http-server
: Contains the source code for the HTTP server component.rpc-server
: Contains the source code for the RPC server component.
Before running the project, make sure you have the following dependencies installed:
- Docker
- Docker Compose
To start the project using Docker Compose, follow these steps:
-
Clone this repository to your local machine:
git clone https://github.com/dthx2710/ttti-2023-asgn.git
-
Navigate to the project directory:
cd ttti-2023-asgn
-
Build the Docker images for the HTTP server, RPC server, and web application:
docker-compose build
-
Start the containers:
docker-compose up
This will start the HTTP server, RPC server, Redis database, and they will be accessible on the specified ports.
Once the containers are up and running, you can access the components using the following URLs:
- HTTP Server: http://localhost:8080
- RPC Server: http://localhost:8888
API Endpoints are defined in the http-server/main.go
file.
/api/send
- POST
Example body:
{
"sender": "user1",
"receiver": "user2",
"text": "hello"
}
/api/pull
- GET Example body:
{
"chat": "user1:user2",
"cursor": 0
"limit": 10
"reverse": true
}
The recommended way is to use Postman to send HTTP requests to the HTTP server.
Feel free to explore the project directories and make any necessary modifications to fit your requirements.
Credits to weixingp for the project walkthrough (especially on Redis for rpc-server handlers setup), and TikTok for code template & the immersion course.