A full-stack contact management application with login and signup functionality, built using React for the frontend, Go Gin for the backend, and PostgreSQL for the database. The app is containerized and orchestrated using Docker Compose.
- User Authentication: Login and signup functionality for users.
- CRUD Operations: Users can create, read, update, and delete contact data.
- Responsive Design: Optimized for both desktop and mobile views.
- Containerized Deployment: Dockerized services for easy setup and scalability.
- React
- Go Gin Framework
- GORM (ORM for Go)
- Google UUID
- Crypto (for hashing password)
- PostgreSQL Driver
- PostgreSQL
- Docker
- Docker Compose
type User struct {
UserId string `gorm:"primary_key;not null;unique;type:uuid"`
Email string `gorm:"unique;not null"`
PasswordHash string `gorm:"column:password_hash;not null"`
Name string `gorm:"not null"`
}type Contact struct {
ContactId string `gorm:"primaryKey;not null;unique;type:uuid"`
UserId string `gorm:"not null;type:uuid;uniqueIndex:idx_name_user;uniqueIndex:idx_phone_user"`
User User // Foreign key relationship
Name string `gorm:"not null;uniqueIndex:idx_name_user"`
Phone string `gorm:"not null;uniqueIndex:idx_phone_user"`
Email string
Address string
}POST /signup: Register a new user.POST /login: Login with existing user credentials.
POST /contacts/add: Add a new contact.POST /contacts/fetch: Retrieve all contacts for a user.PUT /contacts/:contact_id: Update contact details.DELETE /contacts/:contact_id: Delete a contact.
| Login | Signup |
|---|---|
![]() |
![]() |
| Mobile View | Desktop View |
|---|---|
![]() |
![]() |
| Mobile View | Desktop View |
|---|---|
![]() |
![]() |
- Install Docker
- Install Docker Compose
-
Clone the repository:
git clone https://github.com/logeshswami/Contact-app.git cd contact-app -
Start the services:
docker-compose up --build
-
Access the application:
- Frontend: http://localhost:4173
- Backend: http://localhost:8080
version: '3.9'
services:
contact_db:
image: postgres:15
container_name: contact_db
environment:
POSTGRES_USER: contactuser
POSTGRES_PASSWORD: 1243
POSTGRES_DB: contactdb
ports:
- "5432:5432"
volumes:
- contact_db_data:/var/lib/postgresql/data
restart: unless-stopped
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: contact_backend
ports:
- "8080:8080"
env_file:
- ./backend/.env.txt
depends_on:
- contact_db
restart: unless-stopped
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: contact_frontend
ports:
- "4173:4173"
depends_on:
- backend
restart: unless-stopped
volumes:
contact_db_data:
driver: localWatch the live demo here: Demo Video Link
© 2024 LogeshS






