zkt24/z1
2024-04-25 13:51:47 +02:00
..
backend 2nd assignment 2024-04-25 13:51:47 +02:00
frontend 2nd assignment 2024-04-25 13:51:47 +02:00
screenshots 2nd assignment 2024-04-25 13:51:47 +02:00
.env 2nd assignment 2024-04-25 13:51:47 +02:00
.gitignore 2nd assignment 2024-04-25 13:51:47 +02:00
docker-compose.yml 2nd assignment 2024-04-25 13:51:47 +02:00
Dockerfile 2nd assignment 2024-04-25 13:51:47 +02:00
nginx.conf 2nd assignment 2024-04-25 13:51:47 +02:00
README.md 2nd assignment 2024-04-25 13:51:47 +02:00
remove-app.sh 2nd assignment 2024-04-25 13:51:47 +02:00
start-app.sh 2nd assignment 2024-04-25 13:51:47 +02:00
stop-app.sh 2nd assignment 2024-04-25 13:51:47 +02:00

CopyBook

A messageboard type social website

The expected target environment is linux.

Backend

Fully coded in golang utilizing the following technologies:

The backend consists of multiple modules:

  • db.go: database modules setup with gorm
  • auth.go: authorization module with jwt tokens setup
  • server.go: main buisness logic functionality

running the backend without docker requires:

go mody tidy
go build
./social-network

Frontend

Typescript + nextjs + tailwindcss

all of the required packages are in package.json file

the frontend uses nextjs for server side rendering.

there are multiple pages each responsible for its own functionality:

  • index.tsx: mounted on / is the homepage for the messageboard.
  • login.tsx: mounted on /login the login page
  • logout.tsx: mounted on /logout for logging out and removing the jwt token.
  • profile.tsx: mounted on /profile is for the user profile info.
  • signup.tsx: mounted on /signup is for registering new users.

running the frontend manually can be done through

npm i
npm run dev

Devops

Fully dockerized and ready for deployment on any environment

backend setup consists of 2 containers one that builds the golang binary for and another that runs the server

the database for the backend is running a postgresql server with persistent storage enabled

frontend setup has 3 containers: deps: pulls the dependecies required for compiling the typescript files. builder: compiles the typescript files. runner: runs the nextjs server.

all of the previous services are running on internalnet virtual network and then afterwards its served with a nginx reverse proxy for traffic management and redundancy purposes

afterwards the application should be up and running http://localhost

the app can be turned off and on and removed through the following scripts:

start-app.sh
stop-app.sh
remove-app.sh

TODO

  • better db management
  • more documentation
  • user personalization
  • more ui changes