Frontend repo: https://github.com/halo8880/sharevideo-fe
This is a simple project that allows users to share Youtube video URLs with each other. The backend service will fetch the video information and store it in the database. The frontend app will display the video information and allow users to play the video. The system also supports real-time notification when a new video is shared.
Backend Tech used: Java, Spring framework, Postgres, redis (as message broker and cache database), JWT authentication, websocket
Frontend tech: React, Material-UI
Important versions: Java 17
, React 18
, postgreSQL 11
, Redis 7
, Spring boot 3
Deployment: Docker, docker-compose
Development tools: Maven 3.8.3
Due to tight deadline and having spent too much time focusing on design and backend service, the frontend is not as good as I expected.
how to run locally using docker:
- make sure you have docker and docker-compose installed
- clone the repo
- cd into docker/deliver:
cd docker/deliver
- run
docker-compose up redis postgres -d
and wait for some seconds to make sure those services are up and running - run
docker-compose up backend frontend -d
to start the remaining services - The frontend app should be running at
http://localhost:3000
- The backend app should be running at
http://localhost:8081
POSTGRES_DB: mydb
POSTGRES_USER: user
POSTGRES_PASSWORD: user
- make sure you have docker, Java 17
- cd into docker/deliver:
cd docker/deliver
- run
docker-compose up redis postgres -d
and wait for some seconds to make sure those services are up and running - cd into root dir again:
cd ../../
- modify connection configs: in file
src/main/resources/application.properties
:
changespring.datasource.url=jdbc:postgresql://postgres:5432/mydb
tospring.datasource.url=jdbc:postgresql://localhost:5432/mydb
changeredis.host=redis
toredis.host=localhost
- For linux/mac: run
./mvnw spring-boot:run
to start the backend app - For windows: run
./mvnw.cmd spring-boot:run
to start the backend app - If get error at step 6, check JAVA_HOME environment variable, it should point to the root of your JDK installation
- The backend app should be running at
http://localhost:8081
- cd into frontend dir
- run
npm install
to install all the dependencies - run
npm start
to start the frontend app - The frontend app should be running at
http://localhost:3000
After signing in, there will be a button to share Youtube video URLs, the system current support 3 formats:
You won't be able to share same video twice.
The news feed will be updated once a new video is shared.
Will need to login again after refreshing the page.
If you enter a not existed username to login, it will automatically register that username/password account and do the login
A use is treated as offline if last activity is more than 5 minutes. (configurable in app.lastSeenThresholdInSeconds
)
Included the tests for important classes and methods.
- for linux/mac: run
./mvnw test
to run all the tests - for windows: run
./mvnw.cmd test
to run all the tests