This project is a full-stack web application with a Golang backend, a React TypeScript frontend, PostgreSQL for data storage, and Redis for upvote/downvote functionality.
- User authentication
- Real-time messaging
- Upvote/downvote functionality
- Responsive chat interface
- RESTful API for fetching historical message data
- Websockets for real-time messaging
- User authentication
- Vote handling with Redis
- RESTful API: Used for fetching historical data and user authentication.
- Websockets: Used for real-time messaging and vote updates.
- PostgreSQL: Used for storing usernames, passwords, and messages.
- Redis: Used for handling upvote and downvote counters.
Nimble-FullStack/
│
├── golang/
│ ├── Dockerfile.backend
│ ├── go.mod
│ ├── go.sum
│ ├── server.go
│ ├── .env
│ └── ... other directories and files
│
├── react-typescript/
│ ├── Dockerfile.frontend
│ ├── package.json
│ ├── package-lock.json
│ └── src/
│ ├── index.tsx
│ └── ... other files
│
├── postgres-init/
│ └── init.sql
│
├── Dockerfile.postgres
└── docker-compose.yml
docker-compose up --build
This command will build the Docker images and start the containers for the backend, frontend, PostgreSQL, and Redis.
You can access your application at:
- Frontend: http://localhost:3000
- Backend: http://localhost:8000
I follow these steps to test my backend, db and frontend setup using Docker.
First, set up redis
and postgres
using docker commands:
docker-compose up -d postgres
docker-compose up -d redis
Test PostgreSQL and Redis
docker exec -it $(docker ps -qf "name=postgres") psql -U postgres -d nimble_chat
docker exec -it $(docker ps -qf "name=redis") redis-cli
Inside the PostgreSQL shell:
\dt
SELECT * FROM user;
Navigate to the backend golang
directory:
go run server.go
Test backend docker image:
docker-compose up -d backend
Navigate to the frontend react-typescript
directory:
npm start
Test frontend docker image:
docker-compose up -d frontend